Intra-frame search method and device, storage medium and electronic equipment

By step-by-step downsampling of the template and search area, the search scope is narrowed, and the problem of long search in the template matching prediction mode is solved, and the video encoding speed is improved.

CN120568075APending Publication Date: 2025-08-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410217262.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-28
Publication Date
2025-08-29

AI Technical Summary

Technical Problem

The search process for template matching prediction mode in intra prediction takes a long time and has a high complexity, resulting in a reduced encoding speed.

Method used

By downsampling the template and search area in step by step, the downsampled template is used to search in the downsampled search area, gradually narrowing the search range and improving the search speed.

Benefits of technology

This improves the prediction speed of the intra-frame search mode of template matching prediction, and thus improves the video encoding speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120568075A_ABST
    Figure CN120568075A_ABST
Patent Text Reader

Abstract

The invention discloses an intra-frame search method and device, a storage medium and electronic equipment, and belongs to the field of video coding and decoding. The method comprises the following steps: determining a current coding block and a current template; down-sampling is carried out on the target search area and the current template to obtain a first search area and a search template of the first search area, and the target search area belongs to an intra-frame coded area; searching a first template in the first search area; the first search area, the first template and the search template of the first search area are subjected to up-sampling, a second search area, a search reference template of the second search area and a search template of the second search area are obtained, and up-sampling is inverse operation of down-sampling; aiming at the search reference template of each second search area, determining a corresponding first neighborhood space in the second search area; and searching second templates in the first neighborhood space, determining a target template according to the second templates, and performing intra-frame prediction on the current coding block according to the target template. The method improves the coding speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of audio and video coding and decoding technology, and in particular to an intra-frame search method, device, storage medium, and electronic device. Background Art

[0002] Intra-frame prediction is a key technology in video coding. It primarily leverages spatial correlation in the video domain, using previously encoded pixels in the current image to predict the value of the current pixel, thereby removing spatial redundancy. This prediction is typically performed within the same frame, hence the name intra-frame prediction. In intra-frame prediction, the encoder selects the most appropriate prediction mode, but each prediction mode requires searching the coding block. Specifically, when the encoder makes a prediction, it searches the already encoded pixel region, or reconstructed pixel region, for relevant coding blocks, or reconstructed blocks, used to predict the pixel values ​​of the current block. However, this search process is time-consuming and complex, reducing coding speed. Summary of the Invention

[0003] The embodiments of the present application provide an intra-frame search method, device, storage medium, and electronic device to solve the problem in the template matching prediction mode in the related art that the search process is time-consuming and highly complex, thereby reducing the encoding speed.

[0004] According to one aspect of an embodiment of the present application, a method for intra-frame search is provided, the method comprising:

[0005] Determining a current coding block and a current template, wherein the current template and the current coding block have a first positional relationship;

[0006] Downsampling a target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area;

[0007] Searching in the first search area to obtain a plurality of first templates, wherein template matching distortion between the first templates and search templates in the first search area meets a preset requirement;

[0008] performing single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, search reference templates of each of the second search areas, and a search template of the second search area, where the upsampling is an inverse operation of the downsampling;

[0009] For each search reference template in the second search area, determining a corresponding first neighborhood space in the second search area that includes the search reference template; searching in the first neighborhood space to obtain a plurality of second templates, wherein template matching distortion between the second templates and the search templates in the second search area meets the preset requirement;

[0010] Determine a target template based on each of the second templates, where the target template is a pixel area in the target search area where the template matching distortion between the current template and the target search area meets the preset requirement;

[0011] Perform intra-frame prediction on the current coding block according to the target template.

[0012] According to one aspect of an embodiment of the present application, a frame search device is provided, the device comprising:

[0013] A search condition determination unit, configured to determine a current coding block and a current template, wherein the current template and the current coding block have a first positional relationship;

[0014] The search unit is used to perform the following operations:

[0015] Downsampling a target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area;

[0016] Searching in the first search area to obtain a plurality of first templates, wherein template matching distortion between the first templates and search templates in the first search area meets a preset requirement;

[0017] performing single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, search reference templates of each of the second search areas, and a search template of the second search area, where the upsampling is an inverse operation of the downsampling;

[0018] For each search reference template in the second search area, determining a corresponding first neighborhood space in the second search area that includes the search reference template; searching in the first neighborhood space to obtain a plurality of second templates, wherein template matching distortion between the second templates and the search templates in the second search area meets the preset requirement;

[0019] Determine a target template based on each of the second templates, where the target template is a pixel area in the target search area where the template matching distortion between the current template and the target search area meets the preset requirement;

[0020] Perform intra-frame prediction on the current coding block according to the target template.

[0021] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the above-mentioned intra-frame search method.

[0022] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, wherein the storage medium stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the above-mentioned intra-frame search method.

[0023] According to one aspect of an embodiment of the present application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to implement the above-described intra-frame search method.

[0024] The technical solutions provided in the embodiments of the present application can bring the following beneficial effects:

[0025] The present application embodiment specifically improves the search process of the template matching prediction mode and proposes an improved intra-frame search method. In the search phase of the template matching prediction mode, this method downsamples the template and search area in steps, and uses the downsampled template to search in the downsampled search area, gradually narrowing the search range. This speeds up the search and reduces the search time. This improves the prediction speed of the template matching prediction intra-frame search mode, thereby increasing the video encoding speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0027] Figure 1 This is a schematic diagram of a template matching prediction mode provided by an embodiment of the present application;

[0028] Figure 2 is a schematic diagram of an application program operating environment provided by an embodiment of the present application;

[0029] Figure 3 This is a flowchart of an intra-frame search method provided by an embodiment of the present application;

[0030] Figure 4 is an exemplary shape and position diagram of the current template provided by one embodiment of the present application;

[0031] Figure 5 is a schematic diagram of a target search area provided by an embodiment of the present application;

[0032] Figure 6 This is a schematic diagram of the change of the search area provided by an embodiment of the present application;

[0033] Figure 7 This is a schematic diagram of template changes provided by an embodiment of the present application;

[0034] Figure 8 This is a schematic diagram of an upsampling search process provided by an embodiment of the present application;

[0035] Figure 9 This is a schematic diagram of a search target coding block provided by an embodiment of the present application;

[0036] FIG10( a ) is a schematic diagram of a newly added prediction direction of a VCC prediction mode provided in one embodiment of the present application;

[0037] FIG10( b ) is a schematic diagram of a DC prediction mode provided by an embodiment of the present application;

[0038] FIG10( c ) is a schematic diagram of a Planar prediction mode provided by an embodiment of the present application;

[0039] Figure 11 This is a block diagram of an intra-frame search device provided by one embodiment of the present application;

[0040] Figure 12 This is a structural block diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION

[0041] Before introducing the method embodiments provided in the present application, a brief introduction is first given to the relevant terms or nouns that may be involved in the method embodiments of the present application to facilitate understanding by those skilled in the art in the field of the present application.

[0042] Cloud technology refers to a hosting technology that unifies hardware, software, and network resources within a wide area network (WAN) or local area network (LAN) to enable data computing, storage, processing, and sharing. Cloud technology is a general term for network, information technology, integration technology, management platform technology, and application technology, all based on the cloud computing business model. It can form a resource pool that can be used on demand with flexibility and convenience. Cloud computing technology will become a crucial support. Backend services for technical network systems, such as video websites, image websites, and more portals, require extensive computing and storage resources. With the rapid development and application of the internet industry, every item will likely have its own unique identification mark and will need to be transmitted to backend systems for logical processing. Data of varying levels will be processed separately, and data from all industries will require a strong system backend, which can only be achieved through cloud computing.

[0043] Video encoding and decoding: Video encoding and decoding are common processing technologies in digital media. Video encoding, also known as video compression, primarily uses specific compression techniques to convert raw video data into another format, typically smaller in size, to reduce storage space and transmission bandwidth. The core of video encoding is to reduce the video data rate while preserving visual quality. Common compression techniques used in video encoding can be categorized as lossy or lossless. Lossy compression alters the image, reducing information content and resulting in a decrease in image quality, but it offers higher compression ratios. Lossless compression does not cause any loss in the video image, allowing for a complete restoration of the file, but at a relatively low compression ratio. Video decoding is the reverse process of video encoding. Its primary task is to decompress the encoded (compressed) video data and restore it to a playable video stream. Video decoding must ensure that the quality and detail of the original video are restored as closely as possible. In general, video encoding and decoding are interdependent and complementary technologies that together enable the compression, storage, transmission, and playback of video data. With increasing demand for high-definition video, video encoding and decoding technologies are constantly evolving to improve compression efficiency, reduce distortion, and enhance video quality.

[0044] Before describing the embodiments of the present application in detail, the relevant technical background related to the embodiments of the present application is introduced to facilitate understanding by those skilled in the art in the art of the present application.

[0045] Intra-frame prediction is a key technology in video coding. It primarily leverages spatial correlation in the video domain, using previously encoded pixels in the current image to predict the value of the current pixel, thereby removing spatial redundancy. This prediction is typically performed within the same frame, hence the name intra-frame prediction. In intra-frame prediction, the encoder selects the most appropriate prediction mode, but each prediction mode requires searching for coding blocks. Specifically, when the encoder makes a prediction, it searches for related coding blocks, or related reconstructed blocks, within the already encoded or reconstructed pixel regions to predict the pixel values ​​of the current block. However, this search process is time-consuming and complex, reducing coding speed.

[0046] Taking the template matching prediction mode as an example, the template matching prediction mode is used for intra-frame search to improve the intra-frame search performance. Template matching prediction can use the reconstructed pixels on the left and upper sides of the current block as a template, such as the Γ-shaped reconstructed pixels as a template, and search in the encoded and reconstructed area of ​​the current frame to obtain the target template that best matches the current Γ-shaped template. The reconstructed block corresponding to the target template is directly used as the prediction value of the current block. Please refer to Figure 1 , which shows a schematic diagram of the template matching prediction mode. In this diagram, the blocks involved in the intra-frame search can be represented by CU, i.e., coding unit. CU is a core concept in video coding, which represents an image area block that is processed independently. By flexibly selecting the division method and size of CU, the encoder can better adapt to different image contents and achieve efficient video compression. In one embodiment, the current coding block (CU) is within a given search range ( Figure 1 R1 to R4), search based on the Г-shaped template and get the best matching target template as Figure 1 As shown in the upper left corner, the block adjacent to the searched target template is the matching prediction block of the current CU template and is directly used as the prediction result for the current CU. For template matching prediction, the encoder only needs to indicate whether template matching prediction is used, without identifying other information, as this process can also be completed on the decoder. In template matching prediction mode, since the codec needs to use the template to search within a certain range, the search complexity is relatively high, which leads to the problem of long encoding time and reduced encoding speed.

[0047] In light of this, the present invention specifically improves the search process of the template matching prediction mode and proposes an improved intra-frame search method. During the search phase of the template matching prediction mode, this method downsamples the template and search area in steps, and uses the downsampled template to search the downsampled search area, gradually narrowing the search range. This improves the search speed, reduces the search time, and increases the prediction speed of the template matching prediction intra-frame search mode, thereby increasing the video encoding speed.

[0048] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.

[0049] Please refer to Figure 2 , which shows a schematic diagram of an application program running environment provided by an embodiment of the present application. The application program running environment may include: a terminal 10 and a server 20.

[0050] The terminal 10 includes, but is not limited to, electronic devices such as mobile phones, computers, intelligent voice interaction devices, smart home appliances, car terminals, game consoles, e-book readers, multimedia playback devices, wearable devices, etc. The terminal 10 may be installed with a client of an application.

[0051] In an embodiment of the present application, the above-mentioned application may be any application that can provide or use intra-frame prediction services. Typically, the application may be an audio and video application. Of course, in addition to audio and video application applications, other types of applications may also provide services that rely on or use intra-frame prediction services. For example, news applications, social applications, interactive entertainment applications, browser applications, shopping applications, content sharing applications, virtual reality (VR) applications, augmented reality (AR) applications, etc., which are not limited in this embodiment of the present application. Optionally, a client of the above-mentioned application is running in the terminal 10.

[0052] The server 20 is used to provide background services for the client of the application in the terminal 10. For example, the server 20 can run an audio and video application system or an audio and video encoding and decoding service system. For example, the server 20 can be the background server of the above-mentioned application. The server 20 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. Optionally, the server 20 provides background services for applications in multiple terminals 10 at the same time.

[0053] Optionally, the terminal 10 and the server 20 may communicate with each other via a network 30. The terminal 10 and the server 20 may be directly or indirectly connected via wired or wireless communication, which is not limited in this application.

[0054] Please refer to Figure 3 , which shows a flow chart of an intra-frame search method provided by an embodiment of the present application. The method can be run in a computer device, which refers to an electronic device with data calculation and processing capabilities. For example, the execution subject of each step can be Figure 2 The encoder or codec in the server 20 or terminal 10 in the application execution environment is shown.

[0055] S301. Determine a current coding block and a current template, where the current template and the current coding block have a first positional relationship.

[0056] The embodiments of the present application can be implemented in a scenario where an encoder performs intra-frame prediction encoding on a video, encoding each coding unit within the frame to obtain an encoding result. The coding unit can be understood as a coding block, and the current coding block is the coding block currently undergoing intra-frame prediction. This coding block has not yet been encoded, and the encoding method of the embodiments of the present application can complete the encoding of the current coding block. The current template is a pixel interval formed by pixels having a first positional relationship with the above-mentioned current coding block, and is a pixel interval that has already been encoded.

[0057] The template matching prediction mode is a prediction mode that searches for a related reconstructed block for predicting the current coding block in an already coded pixel region based on a template. The current template is a search basis used in the search process. The embodiments of the present application do not limit the specific shape and position of the current template. The current template can be understood as a pixel region including a number of pixels, and the pixel region has a unique positional relationship with the current coding block, namely the first positional relationship. Typically, the current template is composed of pixels adjacent to the current coding block.

[0058] Please refer to Figure 4 , which shows an exemplary shape and position diagram of the current template in an embodiment of the present application. Figure 4 The black part and the gray part correspond to the current template and the current coding block respectively. That is, the pixel area formed by the adjacent pixels on the left and the adjacent pixels on the top of the current coding block is the current template. Figure 4 CU represents the current coding block.

[0059] S302. Downsample the target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area.

[0060] In one embodiment, all pixel regions that have been encoded in the frame can be used as target search regions. In some other embodiments, regions of a preset shape that are closer to the current encoding block in the pixel regions that have been encoded in the frame can be used as target search regions to increase the search speed. This embodiment of the application does not limit the shape of the target search region. Please refer to Figure 5 , which shows a schematic diagram of the target search area of ​​an embodiment of the present application. Figure 5 The middle grey shaded area is the target search area, which includes the coded pixel areas on the left, top and upper left sides of the current coding block (CU).

[0061] Each downsampling can reduce the search range. After at least one downsampling, the downsampling results corresponding to the target search area and the current template are the first search area and the search template of the first search area. Take two downsampling as an example, please refer to Figure 6 , which shows a schematic diagram of the changes in the search area in an embodiment of the present application. Figure 6 The left picture shows the target search area. Figure 6 The middle picture shows the sampling result of the target search area after one downsampling. Figure 6 The right picture shows the first search area after further downsampling. Figure 7 , which shows a schematic diagram of template changes in an embodiment of the present application. Figure 7 The left picture is the current template. Figure 7 The middle picture shows the sampling result of the current template after one downsampling. Figure 7 The right picture shows the search template of the first search area obtained after further downsampling.

[0062] S303. Searching in the first search area to obtain a plurality of first templates, wherein the template matching distortion between the first template and the search template in the first search area satisfies a preset requirement;

[0063] The first template and the search template of the first search area should have the same shape, and the template matching distortion between the first template and the search template of the first search area should meet the preset requirements. In the embodiment of the present application, the first template is screened by template matching distortion, that is, a pixel area that meets the following requirements is found in the first search area: (1) The pixel area has the same shape as the search template of the first search area; (2) The template matching distortion between the pixel area and the search template of the first search area is small, small enough to meet the preset requirements. The pixel area that meets the above two requirements can be used as the first template. Of course, the embodiment of the present application does not limit the specific first template screening method.

[0064] The embodiments of the present application do not limit the preset requirements. The preset requirements may include a quantity requirement for the first templates or a requirement that the template matching distortion must be less than a certain preset value. The specific content of the preset requirements does not constitute an implementation obstacle, as long as a sufficient number of first templates are screened out to ensure the implementation of the embodiments of the present application.

[0065] S304. Perform a single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, a search reference template for each of the second search areas, and a search template for the second search area. The upsampling is the inverse of the downsampling.

[0066] Each time upsampling is performed, the search range is expanded appropriately to Figure 6 For example, if Figure 6 The right picture is the first search area, then Figure 6 The middle picture is the second search area. Figure 7 For example, if Figure 7 The right picture is the search template for the first search area. Figure 7 The middle figure is the search template of the second search area. After the single upsampling of each of the above first templates, the search reference template of the second search area can also be obtained. In other words, the search reference template of the second search area is the direct upsampling result of the corresponding first template.

[0067] S305. For each search reference template in the second search area, determine a corresponding first neighborhood space in the second search area that includes the search reference template; search the first neighborhood space to obtain multiple second templates, where the template matching distortion between the second templates and the search templates in the second search area meets the preset requirement;

[0068] The first neighborhood space is a pixel space centered on the search reference template of the corresponding second search area. This embodiment of the present application does not limit the shape of the pixel space; for example, it can be rectangular, circular, etc. This embodiment of the present application does not limit the specific size of the first neighborhood space, and it can be limited according to actual circumstances.

[0069] The second template and the search template of the second search area should have the same shape, and the template matching distortion between the second template and the search template of the second search area meets the preset requirements. The method of determining the second template is based on the same inventive concept as the method of determining the first template, and will not be elaborated here. The embodiment of the present application does not limit the preset requirements. The preset requirements may include a requirement for the number of second templates or a requirement that the template matching distortion must be less than a certain preset value. The specific content of the preset requirements does not constitute an implementation obstacle, as long as a sufficient number of second templates are screened out to ensure that the embodiment of the present application can be implemented.

[0070] In one embodiment, the above-mentioned search is performed in the above-mentioned first neighborhood space to obtain multiple second templates, including: determining the pixel distribution corresponding to each pixel interval of the same shape as the search template of the above-mentioned second search area in the above-mentioned first neighborhood space; calculating the sum of pixel absolute errors between the pixel distribution corresponding to each of the above-mentioned pixel intervals and the pixel distribution of the search template of the above-mentioned second search area, and the above-mentioned sum of pixel absolute errors is used to quantify the above-mentioned template matching distortion; and determining the above-mentioned pixel interval whose sum of pixel absolute errors meets the above-mentioned preset requirements as the above-mentioned second template.

[0071] The pixel area searched during the search process should have the same shape as the search template of the second search area, and each pixel area and the search template of the second search area include a number of pixels to form a pixel distribution. Since the pixel area and the search template of the second search area have the same shape, the template matching distortion can be quantified based on the difference between the pixels corresponding to each corresponding position. In one embodiment, the template matching distortion can be quantified by the pixel absolute error. The pixel absolute error sum refers to the absolute error sum between the pixels corresponding to the corresponding positions. The Sum of Absolute Differences (SAD) is an error measurement method commonly used in video coding. In the context of video coding, SAD is generally used to evaluate the accuracy of prediction.

[0072] In the embodiment of the present application, To calculate SAD, where L0 represents the search template of the second search area, Li represents a certain (i-th) pixel area of ​​the second search area, M and N respectively represent the length and width of the search template of the second search area, and Loss(i) represents the sum of the absolute errors of the pixels in the pixel area.

[0073] In one embodiment, the above-mentioned pixel absolute errors and the above-mentioned pixel intervals that meet the above-mentioned preset requirements are determined as the above-mentioned second template, including: sorting the above-mentioned pixel absolute errors in ascending order, and determining the first several pixel absolute errors and the corresponding pixel intervals of the sorting results as the above-mentioned second template.

[0074] S306. Determine a target template based on each of the second templates, the target template being a pixel region in the target search region where the template matching distortion between the current template and the target search region meets the preset requirement;

[0075] In one embodiment, when the second search area is consistent with the target search area, a preset number of target templates are screened from each of the second templates, where the preset number is greater than 1. If the second search area is consistent with the target search area, it means that the second search area is the target search area, that is, only one downsampling was performed in step S302, and upsampling recovery was performed through upsampling in step S304. In this case, the second template can be considered to be a template search result that is highly similar to the current template. In some embodiments, the multiple second templates found can be screened and a preset number of second templates with minimal template matching distortion can be selected as the target template.

[0076] In one embodiment, if multiple downsampling steps are performed in step S302, then a further upsampling search is required based on the second template to obtain the target template. That is, performing at least one downsampling of the target search area and the current template to obtain the first search area and the search template for the first search area includes performing at least two downsampling steps on the target search area and the current template to obtain the first search area and the search template for the first search area. In the case of at least two downsampling steps, a further upsampling search is required.

[0077] Please refer to Figure 8 , which shows a schematic diagram of the upsampling search process of an embodiment of the present application. The above-mentioned determination of the target template based on each of the above-mentioned second templates includes:

[0078] S801. Perform a single upsampling operation on the second search area, each of the second templates, and the search template of the second search area, to obtain a third search area, a search reference template for each of the third search areas, and a search template for the third search area. The upsampling operation is the inverse of the downsampling operation.

[0079] S802. For each search reference template in the third search area, determine a corresponding second neighborhood space in the third search area that includes the search reference template; search the second neighborhood space to obtain multiple third templates, where the template matching distortion between the third templates and the search templates in the third search area meets the preset requirement;

[0080] In one embodiment, the second neighborhood space is a pixel space centered on the search reference template corresponding to the third search area, the size of the second neighborhood space is smaller than the size of the first neighborhood space, and the number of the third templates is smaller than the number of the second templates.

[0081] S803. Determine a target template based on each of the above third templates.

[0082] The implementation concept of step S801 to step S803 is substantially the same as the implementation concept of step S305 to step S306, and will not be repeated here.

[0083] In one embodiment, when the third search area is consistent with the target search area, the preset number of target templates are screened in each of the third templates, and the preset number is greater than 1. If the third search area is consistent with the target search area, it means that the third search area is the target search area, that is, only two downsamplings are performed in step S302, and the upsampling is performed in step S304 and step S801 respectively. In this case, the third template can be considered to be a template search result that is highly similar to the current template. In some embodiments, the plurality of third templates searched can be screened and a preset number of third templates with the smallest template matching distortion are selected as target templates. It is worth noting that the purpose of upsampling in the embodiment of the present application is to restore the sampling result of downsampling. Therefore, the sampling operation chain formed by upsampling is opposite to the sampling operation chain formed by downsampling. For example, if the target operation area is obtained by 1 / 2 downsampling-1 / 4 downsampling, then the sampling result is restored to the target operation area through the corresponding 1 / 4 upsampling-1 / 2 upsampling.

[0084] Of course, if downsampling is performed three times or more in step S302, upsampling search can be further performed based on the same inventive concept of the embodiment of the present application until the target template is determined.

[0085] S307. Perform intra-frame prediction on the current coding block according to the target template.

[0086] In an embodiment of the present application, the intra-frame prediction of the current coding block based on the target template includes: determining the target coding block corresponding to each of the target templates, the target template and the target coding block have a second positional relationship, and the first positional relationship and the second positional relationship are the same positional relationship; based on the fusion result obtained by fusing the pixel values ​​of each of the target coding blocks, determining the prediction value corresponding to the current coding block.

[0087] Please refer to Figure 9 , which shows a schematic diagram of searching for a target coding block according to an embodiment of the present application. During the search process, according to the current template of the black part, four target templates can be searched, namely L1, L2, L3, and L4, so that the target coding blocks P1, P2, P3, and P4 can be obtained, wherein the positional correspondence between the target coding block P1 and the target template L1 is the second positional relationship. Similarly, the positional correspondence between the target coding block P2 and the target template L2, the positional correspondence between the target coding block P3 and the target template L3, and the positional correspondence between the target coding block P4 and the target template L4 are all the second positional relationships, while the positional correspondence between the current coding block CU and the current template L0 is the first positional relationship. Obviously, the first positional relationship and the second positional relationship are the same, both indicating that the left side and the top of the coding block are surrounded by templates with corresponding relationships.

[0088] Unlike the solution in the related art that directly obtains the template matching prediction result, the embodiment of the present application selects multiple target coding blocks and fuses the pixel information to improve the accuracy of the prediction value. The above-mentioned fusion of the pixel values ​​of each of the above-mentioned target coding blocks to obtain the prediction value corresponding to the above-mentioned current coding block includes: obtaining the weight of each of the above-mentioned target coding blocks according to a preset weight calculation method, and the sum of the weights of each of the above-mentioned target coding blocks is 1; fusing the pixel values ​​of each of the above-mentioned target coding blocks based on the above-mentioned weights to obtain the prediction value corresponding to the above-mentioned current coding block.

[0089] The embodiment of the present application does not limit the weight calculation method. In one embodiment, the template matching distortion of the target template corresponding to each of the above-mentioned target coding blocks can be calculated; the weight corresponding to each of the above-mentioned target coding blocks is determined according to the proportion of the template matching distortion corresponding to each of the above-mentioned target templates in the total template matching distortion. The above-mentioned total template matching distortion is the sum of the template matching distortions corresponding to each of the above-mentioned target templates.

[0090] Taking the existence of three target templates as an example, the template matching distortions corresponding to the three target templates are Loss1, Loss2, and Loss3 respectively. Then the total template matching distortion loss_All is loss_All = Loss(1) + Loss(2) + Loss(3). Then the weights corresponding to each of the above second coding blocks are: wi = ((loss_All – Loss(i)) / (2*loss_All), i = 1, 2, 3. For example, assuming Loss1 = 1, Loss2 = 2, and Loss3 = 3, the weights calculated respectively are w1 = 5 / 12, w2 = 4 / 12, and w3 = 3 / 12.

[0091] In one embodiment, each of the target coding blocks may be determined to have the same weight. For example, if there are three target templates, the three weights are all 1 / 3.

[0092] In one embodiment, the weight of any of the target coding blocks may be determined as the preset value, and the weights of the other second coding blocks may be determined as 0.

[0093] The method for intra-frame prediction based on the embodiment of the present application can obtain the predicted value of the current coding block. Furthermore, intra-frame prediction can be performed on the current coding block based on other intra-frame prediction modes. If the pixel difference between the prediction results of other intra-frame prediction modes and the above-mentioned current coding block is greater than the intra-frame prediction result obtained in step S307, the template matching prediction mode of the embodiment of the present application is used; otherwise, the intra-frame prediction mode corresponding to the prediction result with the smallest pixel difference between the prediction results of other intra-frame prediction modes and the above-mentioned current coding block is used. The intra-frame prediction mode actually used is encoded.

[0094] There are many other intra-frame prediction modes that can be used in this application. The following is a brief introduction:

[0095] VVC Intra-frame Prediction Modes: VVC (Versatile Video Coding, also known as H.266) is a next-generation video coding standard designed to provide higher coding efficiency and a wider range of applications than HEVC (H.265). In VVC, intra-frame prediction technology has been further optimized and expanded. First, the number of intra-frame prediction modes in VVC has increased from 33 in HEVC to 65, primarily to accommodate prediction requirements for a wider range of directions and textures. Furthermore, VVC introduces new intra-frame prediction technologies, such as wide-angle intra prediction and block-based quadtree partitioning. To accommodate a wider range of prediction directions, the number of intra-frame angular prediction modes in VVC has increased to 65. Together with the DC mode and planar mode, the total number of intra-frame prediction modes in VVC is 67. Please refer to Figure 10(a), which shows a schematic diagram of the newly added prediction directions in the VVC prediction mode. The dashed lines in Figure 10(a) represent the prediction directions added to VVC compared to HEVC.

[0096] DC prediction mode: DC prediction mode is an intra-frame prediction mode, which is mainly suitable for predicting large flat areas, that is, scenes where the pixel values ​​in the area are basically unchanged. In DC prediction mode, the pixel value of the current block is obtained by the average value of the reference pixels above and to the left of it. Please refer to Figure 10(b), which shows a schematic diagram of the DC prediction mode. According to the shape of the current block, for a square current block, the average value of the reference pixels on the top and left is calculated, and for a non-square current block, the average value of the long side is calculated, and then the current block is filled, as follows: when the width is equal to the height, the average value of the left reference pixels and the upper reference pixels is used as the prediction value to fill the entire current block; when the width is greater than the height, the average value of the upper reference pixels is used as the prediction value to fill the entire current block; when the width is less than the height, the average value of the left reference pixels is used as the prediction value to fill the entire current block.

[0097] Planar prediction mode: Planar prediction mode is an intra-frame prediction mode suitable for pixel gradients, that is, areas where pixel values ​​change slowly. See Figure 10(c), which shows a schematic diagram of the Planar prediction mode. The Planar prediction mode is calculated by taking a weighted average of the pixel values ​​corresponding to four preset parameters: a, b, c, and d, with the weights being distance-dependent.

[0098] MIP (Matrix Weighted Intra Prediction) prediction mode: This intra prediction technique uses linear affine transformations. First, a current block with a width of W and a height of H is predicted. The prediction references the reconstructed pixels W above and H to the left. The reconstructed pixels are obtained in the same way as traditional intra prediction. These (W + H) pixels are then averaged, affine transformed, and upsampled to obtain the final prediction value.

[0099] MRL (Multiple Reference Line) prediction mode: In HEVC, only the left column and the top row of pixels are used as reference pixels, while VVC allows the use of multiple reference lines (MRL). By using multiple reference lines, the MRL prediction mode can better capture local changes and texture information in the image, thereby providing more accurate predictions. In VVC, the MRL prediction mode can use multiple different reference line indexes, such as reference lines 0, 1, 3, etc. The encoder selects the appropriate reference line index based on the image content and prediction accuracy requirements. For each reference line index, the encoder generates a prediction block and uses rate-distortion optimization (Rate-Distortion Optimization) technology to select the best prediction block as the final prediction result.

[0100] IBC (Intra block copy) prediction mode: IBC is a block-level coding mode. IBC coding is regarded as the third prediction mode in addition to the intra-frame or inter-frame prediction mode. Similar to the inter-frame technology, the encoding end performs motion search (Block Matching, Block Maching, BM) to find the best block vector (Block Vector, also called Motion Vector) for each current block. The block vector is used to indicate the displacement from the current block to the reference block. The difference from the inter-frame technology is that the best block vector of IBC is searched in the reconstructed area of ​​the frame where the current block is located, while the inter-frame motion vector is obtained by searching in the adjacent reference frames.

[0101] This embodiment of the present application does not limit the quantization method of pixel differences. For example, the square sum of the error between the prediction result and the original pixel of the current coding block can be used to quantize the pixel difference, that is, dist= dist represents the sum of squared errors, orig(x,y) represents the original pixel of the current coding block, and pred(x,y) is the pixel value of the predicted result.

[0102] In one embodiment, after determining the prediction value corresponding to the current coding block based on the fusion result obtained by fusing the pixel values ​​of each of the target coding blocks, the method further includes: in the case where the prediction value corresponding to the current coding block is the prediction value obtained by fusing the pixel values ​​of each of the target coding blocks, determining the target prediction flag as a template prediction flag, the target prediction flag is used to indicate the prediction mode to the decoding end, and the template prediction flag indicates the template matching prediction mode; encoding the target prediction flag to obtain the encoding result. The method used in steps S301 to S307 of the embodiment of the present application is the template matching prediction mode, that is, if the target prediction flag is determined to be a template matching prediction flag, the decoder can be instructed to perform decoding based on steps S301 to S307 of the embodiment of the present application, otherwise, other intra-frame prediction modes are used for decoding.

[0103] Of course, steps S301 to S307 in the embodiment of the present application are technical solutions used for prediction of the current coding block, and intra-frame prediction and intra-frame coding can be performed on each coding block in the frame through a loop execution.

[0104] The embodiment of the present application proposes an intra-frame search method. Taking into account the high complexity brought by the full-pixel search of the template matching prediction mode, this method is a specific improvement to the search process of the template matching prediction mode, and proposes an improved intra-frame search method. In the search link of the template matching prediction mode, this method downsamples the template and the search area in steps, and uses the downsampled template to search in the downsampled search area, gradually narrowing the search range, thereby increasing the search speed, reducing the time consumption of the search process, and increasing the prediction speed of the template matching prediction intra-frame search mode, thereby increasing the video encoding speed. The embodiment of the present application is essentially based on a progressive fast template matching prediction method, which reduces the impact of template matching prediction on the encoding and decoding speed. It can be applied to short video compression and video call scenarios to increase the encoding and decoding speed and improve the user experience.

[0105] Furthermore, the embodiment of the present application also provides a specific embodiment of intra-frame search, which has the following steps:

[0106] Step 1: Downsample the Г-shaped template and region R around the current coding block by 1 / 2 in both horizontal and vertical directions. The Г-shaped template is the current template. Figure 7 In the left picture, area R is the target search area, which can be referred to Figure 6 In the left figure, the so-called 1 / 2 downsampling refers to the downsampling operation with a sampling ratio of 1 / 2. The sampling results can be referred to Figure 7 The template in the middle figure is the template L0' and Figure 6The area in the middle is the area R'. Obviously, the size of the template L0' and the area R' are both 1 / 4 of the size before sampling. Based on the same operation, the template L0' and the area R' are downsampled by 1 / 2 in both horizontal and vertical directions to obtain Figure 7 The template on the right is denoted as template L0" and Figure 6 The area in the right figure is denoted as area R", and the sizes of template L0" and area R" are 1 / 4 of the sizes of template L0' and area R', respectively. Among them, area R" and template L0" are the first search area and the search template of the first search area, area R' and template L0' are the second search area and the search template of the second search area, and area R and template L0 are the third search area and the search template of the third search area.

[0107] Step 2: Use the L0 template to search in region R to obtain several best-matching templates. Sort these templates in ascending order of template matching distortion to obtain n matching templates, which are represented by L1, L2, …, Ln. L1, L2, …, Ln can all be understood as the first template in the first search region.

[0108] Step 3: Based on the n first templates Li”(i=1, . . . , n), obtain n search reference templates for the second search area at corresponding positions in the R′ search area.

[0109] Step 4: In region R', search for multiple templates Li' that best match template L0' within the range S'xS' around the search reference template in each second search region (first neighborhood space), and finally screen out a total of m best-matching second templates.

[0110] Step 5: Based on the m second templates obtained in the above steps, obtain the search reference templates of the third search area corresponding to the m second templates in the third search area.

[0111] Step 6: Search within the range SxS around the search reference template in each third search area (the second neighborhood interval) to ultimately obtain the w most matching target templates. The adjacent blocks corresponding to the w target templates can be used for encoding prediction of the current block. In this embodiment, the search range is S'x S' and SxS (S'>S), and n>m>w, where w is an integer greater than 1. For example, S'=9, S=3, n=9, m=6, and w=3 can be set.

[0112] The embodiments of the present application can be applied to various applications or application scenarios related to video encoding, such as video calls, short videos, video websites, remote conferences, etc. For example, it can be applied to the background compression scenario of the video service of the instant messaging program to improve the speed of the video service.

[0113] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0114] Please refer to Figure 11 , which shows a block diagram of an intra-frame search device provided by one embodiment of the present application. The device can be a computer device or can be set in a computer device. The device can include:

[0115] A search condition determination unit 1121 is configured to determine a current coding block and a current template, wherein the current template and the current coding block have a first positional relationship;

[0116] The search unit 1102 is configured to perform the following operations:

[0117] Downsampling the target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area;

[0118] Searching in the first search area to obtain a plurality of first templates, wherein template matching distortion between the first templates and search templates in the first search area meets a preset requirement;

[0119] performing single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, a search reference template of each of the second search areas, and a search template of the second search area, wherein the upsampling is an inverse operation of the downsampling;

[0120] For each search reference template in the second search area, determining a corresponding first neighborhood space in the second search area that includes the search reference template; searching in the first neighborhood space to obtain a plurality of second templates, wherein template matching distortion between the second templates and the search templates in the second search area meets the preset requirement;

[0121] Determine a target template based on each of the second templates, where the target template is a pixel area in the target search area where the template matching distortion between the current template and the target search area meets the preset requirement;

[0122] Perform intra-frame prediction on the current coding block according to the target template.

[0123] In one embodiment, the search unit 1102 is configured to perform the following operations:

[0124] In a case where the second search area is consistent with the target search area, a preset number of target templates are screened from each of the second templates, where the preset number is greater than 1.

[0125] In one embodiment, the search unit 1102 is configured to perform the following operations:

[0126] Downsampling the target search area and the current template at least twice to obtain the first search area and the search template of the first search area;

[0127] performing single upsampling on the second search area, each of the second templates, and the search template of the second search area, to obtain a third search area, a search reference template for each of the third search areas, and a search template for the third search area, wherein the upsampling is an inverse operation of the downsampling;

[0128] For each search reference template in the third search area, determining a corresponding second neighborhood space in the third search area that includes the search reference template; searching in the second neighborhood space to obtain a plurality of third templates, wherein template matching distortion between the third templates and the search templates in the third search area meets the preset requirement;

[0129] A target template is determined based on each of the above third templates.

[0130] In one embodiment, the search unit 1102 is configured to perform the following operations:

[0131] In a case where the third search area is consistent with the target search area, the preset number of target templates are screened from each of the third templates, where the preset number is greater than 1.

[0132] In one embodiment, the first neighborhood space is a pixel space centered on the search reference template corresponding to the second search area, and the second neighborhood space is a pixel space centered on the search reference template corresponding to the third search area.

[0133] The size of the second neighborhood space is smaller than that of the first neighborhood space, and the number of the third templates is smaller than the number of the second templates.

[0134] In one embodiment, the search unit 1102 is configured to perform the following operations:

[0135] Determining, in the first neighborhood space, pixel distributions corresponding to respective pixel intervals of the same shape as the search template of the second search area;

[0136] Calculating a sum of absolute pixel errors between a pixel distribution corresponding to each pixel interval and a pixel distribution of a search template in the second search area, wherein the sum of absolute pixel errors is used to quantify the template matching distortion;

[0137] The pixel absolute error and the pixel interval that meets the preset requirements are determined as the second template.

[0138] In one embodiment, the search unit 1102 is configured to perform the following operations:

[0139] Determining a target coding block corresponding to each of the target templates, wherein the target template and the target coding block have a second positional relationship, and the first positional relationship and the second positional relationship are the same positional relationship;

[0140] Based on a fusion result obtained by fusing the pixel values ​​of each of the target coding blocks, a prediction value corresponding to the current coding block is determined.

[0141] In one embodiment, the search unit 1102 is configured to perform the following operations:

[0142] In a case where the prediction value corresponding to the current coding block is a prediction value obtained by fusing pixel values ​​of the target coding blocks, determining the target prediction flag as a template prediction flag, the target prediction flag being used to indicate a prediction mode to a decoding end, and the template prediction flag indicating a template matching prediction mode;

[0143] The target prediction identification bit is encoded to obtain an encoding result.

[0144] It should be noted that the apparatus provided in the above embodiments, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0145] Please refer to Figure 12 , which shows a block diagram of a computer device provided by an embodiment of the present application. The computer device may be a server for executing the above-mentioned intra-frame search method. Specifically:

[0146] Computer device 1200 includes a central processing unit (CPU) 1201, a system memory 1204 including a random access memory (RAM) 1202 and a read-only memory (ROM) 1203, and a system bus 1205 connecting system memory 1204 and CPU 1201. Computer device 1200 also includes a basic input / output system (I / O system) 1206 that facilitates information transfer between various components within the computer, and a mass storage device 1207 for storing an operating system 1213, application programs 1214, and other program modules 1215.

[0147] The basic input / output system 1206 includes a display 1208 for displaying information and an input device 1209, such as a mouse and keyboard, for user input. Both the display 1208 and the input device 1209 are connected to the central processing unit 1201 via an input / output controller 1210 connected to the system bus 1205. The basic input / output system 1206 may also include an input / output controller 1210 for receiving and processing input from a variety of other devices, such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1210 also provides output to a display screen, printer, or other types of output devices.

[0148] The mass storage device 1207 is connected to the central processing unit 1201 via a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1207 and its associated computer-readable media provide non-volatile storage for the computer device 1200. In other words, the mass storage device 1207 may include computer-readable media (not shown) such as a hard disk or a CD-ROM (Compact Disc Read-Only Memory) drive.

[0149] Without loss of generality, computer-readable media may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid-state storage technologies, CD-ROM, DVD (Digital Video Disc) or other optical storage, tape cassettes, magnetic tape, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that computer storage media are not limited to the above-mentioned ones. The above-mentioned system memory 1204 and mass storage device 1207 can be collectively referred to as memory.

[0150] According to various embodiments of the present application, the computer device 1200 may also be connected to a remote computer on a network such as the Internet for operation. That is, the computer device 1200 may be connected to the network 1212 via the network interface unit 1211 connected to the system bus 1205, or the network interface unit 1211 may be used to connect to other types of networks or remote computer systems (not shown).

[0151] The memory further includes a computer program, which is stored in the memory and configured to be executed by one or more processors to implement the intra-frame search method.

[0152] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one instruction, at least one program, code set or instruction set is stored. When the at least one instruction, at least one program, code set or instruction set is executed by a processor, the intra-frame search method is implemented.

[0153] Specifically, the intra-frame search method includes:

[0154] Determining a current coding block and a current template, wherein the current template and the current coding block have a first positional relationship;

[0155] Downsampling the target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area;

[0156] Searching in the first search area to obtain a plurality of first templates, wherein template matching distortion between the first templates and search templates in the first search area meets a preset requirement;

[0157] performing single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, a search reference template of each of the second search areas, and a search template of the second search area, wherein the upsampling is an inverse operation of the downsampling;

[0158] For each search reference template in the second search area, determining a corresponding first neighborhood space in the second search area that includes the search reference template; searching in the first neighborhood space to obtain a plurality of second templates, wherein template matching distortion between the second templates and the search templates in the second search area meets the preset requirement;

[0159] Determine a target template based on each of the second templates, where the target template is a pixel area in the target search area where the template matching distortion between the current template and the target search area meets the preset requirement;

[0160] Perform intra-frame prediction on the current coding block according to the target template.

[0161] In one embodiment, determining the target template according to each of the second templates includes:

[0162] In a case where the second search area is consistent with the target search area, a preset number of target templates are screened from each of the second templates, where the preset number is greater than 1.

[0163] In one embodiment, downsampling the target search area and the current template at least once to obtain the first search area and the search template of the first search area includes: downsampling the target search area and the current template at least twice to obtain the first search area and the search template of the first search area;

[0164] The above-mentioned determining the target template according to each of the above-mentioned second templates includes:

[0165] performing single upsampling on the second search area, each of the second templates, and the search template of the second search area, to obtain a third search area, a search reference template for each of the third search areas, and a search template for the third search area, wherein the upsampling is an inverse operation of the downsampling;

[0166] For each search reference template in the third search area, determining a corresponding second neighborhood space in the third search area that includes the search reference template; searching in the second neighborhood space to obtain a plurality of third templates, wherein template matching distortion between the third templates and the search templates in the third search area meets the preset requirement;

[0167] A target template is determined based on each of the above third templates.

[0168] In one embodiment, determining the target template according to each of the third templates includes:

[0169] In a case where the third search area is consistent with the target search area, the preset number of target templates are screened from each of the third templates, where the preset number is greater than 1.

[0170] In one embodiment, the first neighborhood space is a pixel space centered on the search reference template corresponding to the second search area, and the second neighborhood space is a pixel space centered on the search reference template corresponding to the third search area.

[0171] The size of the second neighborhood space is smaller than that of the first neighborhood space, and the number of the third templates is smaller than the number of the second templates.

[0172] In one embodiment, the search in the first neighborhood space is performed to obtain multiple second templates, including:

[0173] Determining, in the first neighborhood space, pixel distributions corresponding to respective pixel intervals of the same shape as the search template of the second search area;

[0174] Calculating a sum of absolute pixel errors between a pixel distribution corresponding to each pixel interval and a pixel distribution of a search template in the second search area, wherein the sum of absolute pixel errors is used to quantify the template matching distortion;

[0175] The pixel absolute error and the pixel interval that meets the preset requirements are determined as the second template.

[0176] In one embodiment, performing intra-frame prediction on the current coding block according to the target template includes:

[0177] Determining a target coding block corresponding to each of the target templates, wherein the target template and the target coding block have a second positional relationship, and the first positional relationship and the second positional relationship are the same positional relationship;

[0178] Based on a fusion result obtained by fusing the pixel values ​​of each of the target coding blocks, a prediction value corresponding to the current coding block is determined.

[0179] In one embodiment, after determining the prediction value corresponding to the current coding block based on the fusion result obtained by fusing the pixel values ​​of the target coding blocks, the method further includes:

[0180] In a case where the prediction value corresponding to the current coding block is a prediction value obtained by fusing pixel values ​​of the target coding blocks, determining the target prediction flag as a template prediction flag, the target prediction flag being used to indicate a prediction mode to a decoding end, and the template prediction flag indicating a template matching prediction mode;

[0181] The target prediction identification bit is encoded to obtain an encoding result.

[0182] Optionally, the computer-readable storage medium may include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives), or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).

[0183] In an exemplary embodiment, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-described intra-frame search method.

[0184] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.

[0185] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a 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 part of an overall module or unit that includes the function of the module or unit.

[0186] In addition, in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0187] The above are merely exemplary embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A method for searching within a frame, characterized in that: The method comprises: Determining a current coding block and a current template, wherein the current template and the current coding block have a first positional relationship; Downsampling a target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area; Searching in the first search area to obtain a plurality of first templates, wherein template matching distortion between the first templates and search templates in the first search area meets a preset requirement; performing single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, search reference templates of each of the second search areas, and a search template of the second search area, where the upsampling is an inverse operation of the downsampling; For each search reference template in the second search area, determining a corresponding first neighborhood space in the second search area that includes the search reference template; searching in the first neighborhood space to obtain a plurality of second templates, wherein template matching distortion between the second templates and the search templates in the second search area meets the preset requirement; Determine a target template based on each of the second templates, where the target template is a pixel area in the target search area where the template matching distortion between the current template and the target search area meets the preset requirement; Perform intra-frame prediction on the current coding block according to the target template.

2. The method according to claim 1, characterized in that The determining of the target template according to each of the second templates includes: In a case where the second search area is consistent with the target search area, a preset number of target templates are screened from each of the second templates, where the preset number is greater than 1.

3. The method according to claim 1, characterized in that The downsampling the target search area and the current template at least once to obtain the first search area and the search template of the first search area includes: downsampling the target search area and the current template at least twice to obtain the first search area and the search template of the first search area; The determining of the target template according to each of the second templates includes: performing single upsampling on the second search area, each of the second templates, and the search template of the second search area, to correspondingly obtain a third search area, a search reference template for each of the third search areas, and a search template for the third search area, where the upsampling is an inverse operation of the downsampling; For each search reference template in the third search area, determining a corresponding second neighborhood space in the third search area that includes the search reference template; searching in the second neighborhood space to obtain a plurality of third templates, wherein template matching distortion between the third templates and the search templates in the third search area meets the preset requirement; A target template is determined according to each of the third templates.

4. The method according to claim 3, characterized in that The determining of the target template according to each of the third templates includes: In a case where the third search area is consistent with the target search area, the preset number of target templates are screened from each of the third templates, where the preset number is greater than 1.

5. The method according to claim 3 or 4, characterized in that The first neighborhood space is a pixel space centered on the search reference template corresponding to the second search area, and the second neighborhood space is a pixel space centered on the search reference template corresponding to the third search area. The size of the second neighborhood space is smaller than that of the first neighborhood space, and the number of the third templates is smaller than the number of the second templates.

6. The method according to claim 1, characterized in that The searching in the first neighborhood space to obtain a plurality of second templates includes: Determining, in the first neighborhood space, pixel distributions corresponding to respective pixel intervals of the same shape as the search template of the second search area; Calculating a pixel absolute error sum between a pixel distribution corresponding to each pixel interval and a pixel distribution of a search template in the second search area, wherein the pixel absolute error sum is used to quantify the template matching distortion; The pixel absolute error and the pixel interval that meets the preset requirements are determined as the second template.

7. The method according to claim 1, characterized in that The performing intra-frame prediction on the current coding block according to the target template includes: Determining a target coding block corresponding to each target template, wherein the target template and the target coding block have a second positional relationship, and the first positional relationship and the second positional relationship are the same positional relationship; Based on a fusion result obtained by fusing the pixel values ​​of each of the target coding blocks, a prediction value corresponding to the current coding block is determined.

8. The method according to claim 7, characterized in that After determining the prediction value corresponding to the current coding block based on the fusion result obtained by fusing the pixel values ​​of each target coding block, the method further includes: In a case where the prediction value corresponding to the current coding block is a prediction value obtained by fusing pixel values ​​of each target coding block, determining the target prediction flag as a template prediction flag, the target prediction flag being used to indicate a prediction mode to a decoding end, and the template prediction flag indicating a template matching prediction mode; The target prediction identification bit is encoded to obtain an encoding result.

9. An intra-frame search device, characterized in that: The device comprises: A search condition determination unit, configured to determine a current coding block and a current template, wherein the current template and the current coding block have a first positional relationship; The search unit is used to perform the following operations: Downsampling a target search area and the current template at least once to obtain a first search area and a search template for the first search area, wherein the target search area belongs to an intra-frame coded area; Searching in the first search area to obtain a plurality of first templates, wherein template matching distortion between the first templates and search templates in the first search area meets a preset requirement; performing single upsampling on the first search area, each of the first templates, and the search template of the first search area, to obtain a second search area, search reference templates of each of the second search areas, and a search template of the second search area, where the upsampling is an inverse operation of the downsampling; For each search reference template in the second search area, determining a corresponding first neighborhood space in the second search area that includes the search reference template; searching in the first neighborhood space to obtain a plurality of second templates, wherein template matching distortion between the second templates and the search templates in the second search area meets the preset requirement; Determine a target template based on each of the second templates, where the target template is a pixel area in the target search area where the template matching distortion between the current template and the target search area meets the preset requirement; Perform intra-frame prediction on the current coding block according to the target template.

10. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set, or an instruction set, and the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the intra-frame search method according to any one of claims 1 to 8.

11. A computer program product, characterized in that The computer program product includes computer instructions, which are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes to implement the intra-frame search method according to any one of claims 1 to 8.

12. A computer storage medium, characterized in that The storage medium stores at least one instruction, and the at least one instruction and at least one program are loaded by a processor to execute the intra-frame search method according to any one of claims 1 to 8.