Filtering method, filtering model training method, and related devices

By determining K groups of filtering models based on the quantization parameter and selecting the target filtering model for minimum coding distortion, the method addresses the challenges of image distortion and reduced coding speed in existing filtering methods, achieving improved filtering performance and coding efficiency.

JP2025518756AActive Publication Date: 2025-06-19HUAWEI TECH CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
JP2024570746
Authority / Receiving Office
JP · JP
Patent Type
Applications
Current Assignee / Owner
Priority Date
2022-05-31
Filing Date
2023-05-17
Publication Date
2025-06-19
Estimated Expiration
2043-05-17

AI Technical Summary

Technical Problem

Existing filtering methods in coding technologies face challenges in efficiently filtering reconstruction blocks across different quantization parameters, leading to image distortion and reduced coding speed due to complex network structures.

Method used

A method that determines K groups of filtering models based on the quantization parameter of the target image, selecting the target filtering model corresponding to the minimum coding distortion, and filters the reconstruction block accordingly.

Benefits of technology

This approach simplifies the network model, improves filtering performance, and ensures effective filtering of coding blocks with different qualities and contents within the same image, thereby reducing coding distortion and enhancing coding speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 2025518756000001_ABST
    Figure 2025518756000001_ABST
Patent Text Reader

Abstract

This application discloses a filtering method, a filtering model training method, and related apparatuses, belonging to the field of coding technology. The method includes determining K filtering model groups based on quantization parameters of a target image, determining a reconstruction block corresponding to a current coding block in the target image, determining a target filtering model from the K filtering model groups, and filtering the reconstruction block based on the target filtering model. The same filtering model group is applicable to coding blocks having the same coding quality, different filtering model groups are applicable to coding blocks having different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks having different contents. Therefore, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups with reference to the coding quality and content of the coding block, and then the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] [Cross - reference to Related Applications] This application claims the priority of Chinese Patent Application No. 202210616061.5, titled "FILTERING METHOD, FILTERING MODEL TRAINING METHOD, AND RELATED APPARATUS", filed on May 31, 2022, and incorporates its entire content by reference. [Technical Field] This application relates to the field of coding technologies, and in particular, to filtering methods, filtering model training methods, and related apparatuses.

Background Art

[0002] Coding technologies are widely applied in fields such as multimedia services, broadcasting, video communication, and storage. In the encoding process, an image is divided into a plurality of non - overlapping coding blocks, and the plurality of coding blocks are sequentially encoded. In the decoding process, reconstruction blocks are sequentially parsed and retrieved from the bitstream to determine the reconstructed image. However, in some cases, there may be problems of excessive non - smoothness or discontinuous pixels between neighboring reconstruction blocks, resulting in image distortion between the reconstructed image and the original image. Therefore, the reconstruction blocks need to be filtered. Further, when the encoder side encodes a coding block in the intra - prediction mode or the inter - prediction mode, the encoder side also needs to filter the reconstruction blocks to ensure the coding quality of subsequent coding blocks.

[0003] In related technologies, a filtering model is pre-trained for each quantization parameter among a plurality of quantization parameters. When filtering a reconstruction block, on the encoder side, a filtering model corresponding to a plurality of quantization parameters in the vicinity of the quantization parameter of the image is selected from the pre-trained filtering model to obtain a plurality of filtering models. Then, a target filtering model is selected from the plurality of filtering models, and based on the target filtering model, the reconstruction block is filtered. Further, on the encoder side, the index of the target filtering model may be further encoded into a bitstream and the bitstream may be transmitted to the decoder side. After the decoder side receives the bitstream transmitted by the encoder side, by parsing the bitstream, the reconstruction block and the index of the target filtering model can be determined, and then based on the index of the target filtering model, by using the target filtering model, the reconstruction block is filtered.

[0004] One quantization parameter corresponds to one filtering model, but different filtering may be required for coding blocks having different contents within the same image. Therefore, in order to satisfy the filtering effect of each coding block within the same image, the network structure of the filtering model corresponding to each quantization parameter becomes complex. As a result, the filtering speed in the above method is affected, and the coding speed of the image may be affected. SUMMARY OF THE INVENTION

[0005] Embodiments of this application provide a filtering method, a filtering model training method, and related apparatuses for improving filtering performance based on simplifying a network model and satisfying the filtering effects of coding blocks having different qualities and different contents within the same image. The technical solutions are as follows.

[0006] According to a first aspect, a filtering method is provided and applied to the encoder side. In this method, K groups of filtering models are determined based on the quantization parameter of the target image. Each group of the K groups of filtering models includes M filtering models. The same group of filtering models corresponds to the same quantization parameter, and different groups of filtering models correspond to different quantization parameters. Both K and M are integers greater than 1. A reconstruction block corresponding to the current coding block in the target image is determined. The target filtering model is determined from the K groups of filtering models. The target filtering model is the filtering model corresponding to the minimum coding distortion that exists after the reconstruction block is filtered. The coding distortion that exists after the reconstruction block is filtered based on the target filtering model is smaller than the coding distortion of the reconstruction block. The reconstruction block is filtered based on the target filtering model.

[0007] Optionally, the encoder side obtains K reference quantization parameters from the target correspondence relationship based on the quantization parameter of the target image. Since one quantization parameter corresponds to one group of filtering models, the encoder side can determine K groups of filtering models based on the K reference quantization parameters.

[0008] The target correspondence relationship indicates the correspondence relationship between the image quantization parameter and the reference quantization parameter. In one example, the target correspondence relationship is the correspondence relationship between the quantization parameter range and the reference quantization parameter, or the target correspondence relationship is the correspondence relationship between the image quantization parameter and the reference quantization parameter.

[0009] When the target correspondence relationship is the correspondence relationship between the quantization parameter range and the reference quantization parameter, since the reference quantization parameters corresponding to all quantization parameters within the same quantization parameter range are the same, the encoder side only needs to remember the quantization parameter range, and does not need to remember all quantization parameters in sequence. This helps to save the memory space on the encoder side and improves the efficiency of determining K filtering model groups by the encoder side.

[0010] When the target correspondence relationship is the correspondence relationship between the image quantization parameter and the reference quantization parameter, one image quantization parameter corresponds to K reference quantization parameters, and the correlation between the K reference quantization parameters and the image quantization parameter is stronger. Therefore, the correlation between the quantization parameter of the target image and the K filtering model groups determined by the encoder side based on the target correspondence relationship is stronger. This can further improve the filtering effect.

[0011] The coding quality of a coding block is determined based on the quantization parameter corresponding to the coding block. That is, a smaller quantization parameter indicates higher coding quality, and a larger quantization parameter indicates lower coding quality. Further, the same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. Therefore, the coding quality of multiple coding blocks encoded based on the same quantization parameter is the same, and multiple coding blocks having the same coding quality can be filtered based on the same filtering model group. The coding quality of multiple coding blocks encoded based on different quantization parameters is different, and multiple coding blocks having different coding qualities can be filtered based on different filtering model groups. That is, the same filtering model group is applicable to coding blocks having the same coding quality, and different filtering model groups are applicable to coding blocks having different coding qualities.

[0012] Optionally, after K filtering model groups are determined based on the quantization parameter of the target image, the encoder side further needs to encode the quantization parameters corresponding to the K filtering model groups into the bitstream.

[0013] Optionally, the encoder side determines filtering instruction information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and the K filtering model groups, and the filtering instruction information indicates whether the reconstruction block needs to be filtered. When the filtering instruction information indicates that the reconstruction block needs to be filtered, the target filtering model is determined from the K filtering model groups.

[0014] On the encoder side, the reconstruction block is input into each of the K filtering model groups to obtain K*M filter blocks. Based on the current coding block, the reconstruction block, and the K*M filter blocks, the rate-distortion cost corresponding to the reconstruction block and the rate-distortion cost corresponding to each filter block are determined. If the rate-distortion cost corresponding to the reconstruction block is not smaller than the rate-distortion cost corresponding to each filter block, it is determined that the filtering indication information is the first indication information, and the first indication information indicates that the reconstruction block needs to be filtered. Or, if the rate-distortion cost corresponding to the reconstruction block is smaller than the rate-distortion cost corresponding to each filter block, it is determined that the filtering indication information is the second indication information, and the second indication information indicates that the reconstruction block does not need to be filtered.

[0015] The rate-distortion cost indicates the degree of image distortion between the reconstruction block and the original coding block, and the degree of image distortion between the filter block and the original coding block. If the rate-distortion cost corresponding to the reconstruction block is smaller than the rate-distortion cost corresponding to each filter block, this indicates that the image distortion between the reconstruction block and the original coding block is the smallest. In this way, the image distortion between the original image and the reconstructed image restored based on the reconstruction block is the smallest. In this case, the reconstruction block does not need to be filtered. If the rate-distortion cost corresponding to the reconstruction block is not smaller than the rate-distortion cost corresponding to each filter block, this indicates that the image distortion between the filter block and the original coding block is the smallest. In this way, the image distortion between the original image and the reconstructed image restored based on the filter block is the smallest. In this case, the reconstruction block needs to be filtered.

[0016] Based on the above description, an example where the rate distortion cost indicates the coding distortion is used. When the filtering indication information indicates that the reconstruction block needs to be filtered, the rate distortion costs corresponding to all the filter blocks are compared with each other, and the filtering model corresponding to the filter block with the minimum rate distortion cost is determined as the target filtering model. Obviously, in actual applications, the coding distortion can be further indicated by other parameters. This is not limited in the embodiments of this application.

[0017] Optionally, after determining the filtering indication information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and K groups of filtering models, the encoder side further needs to encode the filtering indication information into the bitstream.

[0018] Optionally, after determining the target filtering model from the K groups of filtering models, the encoder side further needs to encode the target index into the bitstream, and the target index indicates the target filtering model.

[0019] It should be noted that the above content is based on an example where the filtering indication information indicates that the reconstruction block needs to be filtered. Obviously, in actual applications, the filtering indication information may alternatively indicate that the reconstruction block does not need to be filtered. When the filtering indication information indicates that the reconstruction block does not need to be filtered, the reconstruction block is not filtered.

[0020] Since the same filtering model group is applicable to coding blocks having the same coding quality, different filtering model groups are applicable to coding blocks having different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks having different contents. Thus, after K filtering model groups are determined based on the quantization parameter of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups with reference to the coding quality and content of the coding block, and then the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Further, for coding blocks having different coding qualities and different contents within the same image, the filtering performance can be improved based on simplifying the network model, and the filtering effect of coding blocks having different qualities and different contents within the same image can be satisfied.

[0021] According to a second aspect, a filtering method is provided and applied on the decoder side. In this method, K filtering model groups are determined, each group of the K filtering model groups includes M filtering models, the same filtering model group corresponds to the same quantization parameter, different filtering model groups correspond to different quantization parameters, both K and M are integers greater than 1, a reconstruction block is determined based on the bitstream, a target filtering model within the K filtering model groups is determined, and the reconstruction block is filtered based on the target filtering model.

[0022] Optionally, the decoder side determines the K filtering model groups based on the quantization parameter of the target image to which the reconstruction block belongs.

[0023] Optionally, after determining K filtering model groups based on the quantization parameters of the target image, the encoder side further encodes the quantization parameters corresponding to the K filtering model groups into the bitstream. Therefore, after receiving the bitstream, the decoder side can parse and extract the quantization parameters corresponding to the K filtering model groups from the bitstream, and determine the K filtering model groups based on the quantization parameters corresponding to the K filtering model groups.

[0024] The decoder side determines the filtering instruction information of the reconstruction block, and the filtering instruction information indicates whether the reconstruction block needs to be filtered. When the filtering instruction information indicates that the reconstruction block needs to be filtered, the target filtering model within the K filtering model groups is determined.

[0025] After determining the filtering instruction information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and the K filtering model groups, the encoder side further encodes the filtering instruction information into the bitstream. Therefore, after receiving the bitstream, the decoder side can parse and extract the filtering instruction information from the bitstream, and determine whether the reconstruction block needs to be filtered based on the filtering instruction information. When the filtering instruction information indicates that the reconstruction block needs to be filtered, the decoder side can parse and extract the target index from the bitstream, and then determine the target filtering model based on the target index.

[0026] Since the same filtering model group is applicable to coding blocks having the same coding quality, different filtering model groups are applicable to coding blocks having different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks having different contents. Thus, after K filtering model groups are determined based on the quantization parameter of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups with reference to the coding quality and content of the coding block, and then the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Further, for coding blocks having different coding qualities and different contents within the same image, the filtering performance can be improved based on simplifying the network model, and the filtering effect of coding blocks having different qualities and different contents within the same image can be satisfied.

[0027] According to a third aspect, a filtering model training method is provided. In this method, a training sample set is obtained. The training sample set includes a plurality of sample coding blocks and reconstruction blocks corresponding to each sample coding block. The quantization parameters of the images to which the plurality of sample coding blocks belong are the same quantization parameters. A filtering model to be trained is trained based on the training sample set to obtain an initial filtering model. The training sample set is divided into M initial sample subsets. Each initial sample subset includes at least two sample coding blocks and reconstruction blocks corresponding to the at least two sample coding blocks. The initial filtering model is separately trained based on the M initial sample subsets to obtain M optimized filtering models. The M optimized filtering models are trained based on the training sample set to obtain a group of filtering models.

[0028] The plurality of sample coding blocks are obtained by dividing a plurality of sample images, or the plurality of sample coding blocks are obtained by dividing one sample image. In other words, the plurality of sample coding blocks may be from the same sample image or different sample images under the condition that the quantization parameters of the images to which the plurality of sample coding blocks belong are the same. Since the plurality of sample coding blocks are obtained by dividing an image into a plurality of non-overlapping coding blocks, the contents of the plurality of sample coding blocks are different.

[0029] Reconstruction blocks corresponding to a plurality of sample coding blocks are input into an initial filtering model to obtain filter blocks corresponding to each sample coding block. The peak signal-to-noise ratio of the filter blocks corresponding to each sample coding block is determined based on the plurality of sample coding blocks and the filter blocks corresponding to each sample coding block. The plurality of sample coding blocks are ranked in the order of the peak signal-to-noise ratio. The training sample set is divided into M initial sample subsets based on the ranking result. The sample coding blocks included in each initial sample subset are at least two consecutive sample coding blocks in the ranking result.

[0030] M optimized filtering models are trained in a cyclic iteration manner based on the training sample set. The i-th iteration process in the cyclic iteration manner includes the following steps.

[0031] (1) Based on the plurality of sample coding blocks and the reconstruction blocks corresponding to each sample coding block, the training sample set is divided into M optimized sample subsets. The M optimized sample subsets correspond one-to-one to the M filtering models in the i-th iteration process. The M filtering models in the first iteration process are the M optimized filtering models.

[0032] Reconstruction blocks corresponding to a plurality of sample coding blocks are input into M filtering models in the i-th iteration process to obtain M filter blocks corresponding to each sample coding block, and the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block is determined based on the plurality of sample coding blocks and the M filter blocks corresponding to each sample coding block. The training sample set is divided into M optimized sample subsets based on the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block. Each sample coding block is located in the optimized sample subset of the filtering model corresponding to the filter block having the largest peak signal-to-noise ratio among the M filter blocks corresponding to the sample coding block.

[0033] (2) Based on the M optimized sample subsets, train the M filtering models in the i-th iteration process.

[0034] (3) If i is less than the iteration count threshold, use the M filtering models obtained through training in the i-th iteration process as the M filtering models in the (i + 1)-th iteration process, and execute the (i + 1)-th iteration process.

[0035] (4) If i is greater than or equal to the iteration count threshold, determine the M filtering models obtained through training in the i-th iteration process as one filtering model group.

[0036] In this application, M optimized filtering models are trained in a cyclic iterative manner. When the iteration number i of the M filtering models is less than the iteration number threshold, this indicates that the optimized filtering model obtained through the current training is not reliable. In this case, the M filtering models obtained through training in the i-th iteration process are used as the M filtering models in the (i + 1)-th iteration process, and the (i + 1)-th iteration process continues to be executed. When the iteration number i of the M filtering models is greater than or equal to the iteration number threshold, this indicates that the optimized filtering model obtained through the current training is reliable. In this case, the iterative process is stopped, and the M filtering models obtained through training in the i-th iteration process are used as one filtering model group.

[0037] The iteration number threshold is set in advance. The iteration number threshold is the specified number of iterations or the maximum number of iterations, and can be set based on different requirements. This is not limited in the embodiments of this application.

[0038] In the process of dividing the training sample set into M optimized sample subsets based on the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block, it should be noted that the training sample set may be divided into only one optimized sample subset. In other words, the maximum peak signal-to-noise ratio among the peak signal-to-noise ratios of the M filter blocks corresponding to each sample coding block in the training sample set corresponds to the same filtering model. In this case, based on one optimized sample subset obtained through the division, the filtering model in the i-th iteration process is trained, and the iterative process for other filtering models is stopped.

[0039] In this application, since the quantization parameters of the images to which the multiple sample coding blocks included in the training sample set belong are the same quantization parameters, an untrained filtering model is trained based on the training sample set, and one group of filtering models obtained through training is applicable to coding blocks having the same coding quality. Further, since the contents of the multiple sample coding blocks included in the training sample set are different, the M filtering models included in the filtering model group are applicable to coding blocks having different contents.

[0040] According to a fourth aspect, a filtering device is provided. The filtering device has a function of realizing the operations of the filtering method in the first aspect. The filtering device includes at least one module. The at least one module is configured to realize the filtering method provided in the first aspect.

[0041] According to a fifth aspect, a filtering device is provided. The filtering device has a function of realizing the operations of the filtering method in the second aspect. The filtering device includes at least one module. The at least one module is configured to realize the filtering method provided in the second aspect.

[0042] According to a sixth aspect, a filtering model training device is provided. The filtering device has a function of realizing the operations of the filtering model training method in the third aspect. The filtering model training device includes at least one module. The at least one module is configured to realize the filtering model training method provided in the third aspect.

[0043] According to a seventh aspect, an encoder-side device is provided. The encoder-side device includes a processor and a memory, and the memory is configured to store a computer program for executing the filtering method provided in the first aspect. The processor is configured to execute the computer program stored in the memory to implement the filtering method in the first aspect.

[0044] Optionally, the encoder-side device may further include a communication bus. The communication bus is configured to establish a connection between the processor and the memory.

[0045] According to an eighth aspect, a decoder-side device is provided. The decoder-side device includes a processor and a memory, and the memory is configured to store a computer program for executing the filtering method provided in the second aspect. The processor is configured to execute the computer program stored in the memory to implement the filtering method in the second aspect.

[0046] Optionally, the decoder-side device may further include a communication bus. The communication bus is configured to establish a connection between the processor and the memory.

[0047] According to a ninth aspect, a filtering model training device is provided. The filtering model training device includes a processor and a memory, and the memory is configured to store a computer program for executing the filtering model training method provided in the third aspect. The processor is configured to execute the computer program stored in the memory to implement the filtering model training method in the third aspect.

[0048] Optionally, the filtering model training device may further include a communication bus. The communication bus is configured to establish a connection between the processor and the memory.

[0049] According to the tenth aspect, a computer-readable storage medium is provided. The storage medium stores instructions, and when the instructions are executed on a computer, the computer can execute the steps of the filtering method in the first aspect, the steps of the filtering method in the second aspect, or the steps of the filtering model training method in the third aspect.

[0050] According to the eleventh aspect, a computer program product including instructions is provided. When the instructions are executed on a computer, the computer can execute the steps of the filtering method in the first aspect, the steps of the filtering method in the second aspect, or the steps of the filtering model training method in the third aspect. In other words, a computer program is provided. When the computer program is executed on a computer, the computer can execute the steps of the filtering method in the first aspect, the steps of the filtering method in the second aspect, or the steps of the filtering model training method in the third aspect.

[0051] The technical effects obtained in the fourth aspect to the eleventh aspect are the same as the technical effects obtained through the corresponding technical means in the first aspect, the second aspect, or the third aspect. Details are not described again here.

Brief Description of the Drawings

[0052]

Figure 1

Figure 2

Figure 3

Figure 4

Figure 5

Figure 6

Figure 7

Figure 8

Figure 9

Figure 10

Embodiments for Carrying Out the Invention

[0053] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be further described in detail below with reference to the accompanying drawings.

[0054] Before elaborating on the filtering method provided in the embodiments of this application in detail, the terms and implementation environment in the embodiments of this application will first be described.

[0055] For ease of understanding, the terms in the embodiments of this application will first be described.

[0056] Encoding: Encoding is a processing process of compressing an image to be encoded into a bitstream. The image can be any video frame included in a still image, a moving image, or a video.

[0057] Decoding: Decoding is a processing process of restoring an encoded bitstream to a reconstructed video according to specific syntax rules and processing methods.

[0058] Coding Block: A coding block is a coding area obtained by dividing the image to be coded. One image may be divided into multiple coding blocks, and multiple coding blocks jointly form an image. Each coding block may be coded independently. For example, the size of a coding block is 128*128.

[0059] Quantization: Quantization is a process of mapping the continuous values of a signal to a plurality of discrete amplitudes. Quantization can effectively reduce the value range of the signal to obtain a better compression effect, but quantization is also the fundamental cause of distortion.

[0060] Quantization Parameter (QP): The quantization parameter is an important parameter that controls the degree of quantization and reflects the image compression state. Generally, a smaller QP indicates finer quantization, more retained image details, and higher coding quality. Therefore, a higher coding bitrate is required. A larger QP indicates coarser quantization, a more significant loss of image details, lower coding quality, and more obvious distortion. Therefore, a lower coding bitrate is required. That is, the quantization parameter is negatively correlated with the coding bitrate.

[0061] Intra Prediction: Intra prediction is to predict the current coding block based on the reconstructed block corresponding to the coded coding block in the same image as the current coding block, which is located before the current coding block. For example, the current coding block is predicted based on the restored block corresponding to the coded coding block to the left of the current coding block and the restored block corresponding to the coded coding block above the current coding block.

[0062] Inter prediction: Inter prediction determines a reconstructed image corresponding to an encoded image located before the current image as a reference image, and predicts the current coding block based on a reconstructed block that is within the reference image and similar to the current coding block.

[0063] The implementation environment in the embodiments of this application will be described below.

[0064] Coding technology is widely applied in fields such as multimedia services, broadcasting, video communication, and storage. In the encoding process, an image is divided into a plurality of non-overlapping coding blocks, and the plurality of coding blocks are sequentially encoded. In the decoding process, reconstructed blocks are sequentially parsed and retrieved from the bitstream to determine a reconstructed image. However, in some cases, there may be problems of excessive non-smoothness or discontinuous pixels between neighboring reconstructed blocks, and as a result, image distortion occurs between the reconstructed image and the original image. Therefore, the reconstructed blocks need to be filtered. Furthermore, when the encoder side encodes a coding block in the intra prediction mode or the inter prediction mode, in order to ensure the coding quality of subsequent coding blocks, the encoder side also needs to filter the reconstructed blocks.

[0065] FIG. 1 is a diagram of an implementation environment according to an embodiment of this application. The implementation environment includes a source device 10, a destination device 20, a link 30, and a storage device 40. The source device 10 is configured to encode each coding block in an image, and is further configured to filter a reconstructed block corresponding to the coding block in a process of performing encoding in the intra prediction mode or the inter prediction mode. The destination device 20 is configured to parse the bitstream to determine a reconstructed block, and is further configured to filter the reconstructed block.

[0066] The source device 10 is configured to encode an image to generate a bitstream. Therefore, the source device 10 is also referred to as the image encoding device or the image encoder side. The destination device 20 is configured to decode the bitstream generated by the source device 10. Therefore, the destination device 20 is also referred to as the image decoding device or the image decoder side.

[0067] The link 30 is configured to receive the bitstream generated by the source device 10 and transmit the bitstream to the destination device 20. The storage device 40 is configured to receive the bitstream generated by the source device 10 and store the bitstream. In this case, the destination device 20 can directly obtain the bitstream from the storage device 40. Alternatively, the storage device 40 corresponds to a file server or other intermediate storage device that can store the bitstream generated by the source device 10. In this case, the destination device 20 can transmit in a streaming manner, or can download the bitstream stored in the storage device 40.

[0068] The source device 10 and the destination device 20 each include one or more processors and a memory connected to the one or more processors. The memory includes a random access memory (RAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, or any other medium that can be used to store the necessary program code in the form of instructions or data structures and is accessible to a computer. For example, the source device 10 and the destination device 20 each include a desktop computer, a mobile computing device, a notebook (e.g., laptop) computer, a tablet computer, a set-top box, a handheld telephone set such as a so-called "smartphone", a television set, a camera, a display device, a digital media player, a video game console, or an in-vehicle computer.

[0069] Link 30 includes one or more media or devices capable of transmitting a bitstream from the source device 10 to the destination device 20. In a possible implementation, link 30 includes one or more communication media that enable the source device 10 to directly transmit the bitstream to the destination device 20 in real time. In this embodiment of this application, the source device 10 modulates the bitstream according to a communication standard, which is a wireless communication protocol or the like, and transmits the bitstream to the destination device 20. The one or more communication media include wireless communication media and / or wired communication media. For example, the one or more communication media include a radio frequency (RF) spectrum or one or more physical transmission lines. The one or more communication media can be part of a packet-based network. The packet-based network can be a local area network, a wide area network, a global network (such as the Internet), etc. The one or more communication media include routers, switches, base stations, and other devices that facilitate communication from the source device 10 to the destination device 20, etc. This is not particularly limited in the embodiments of this application.

[0070] In a possible implementation, the storage device 40 is configured to store the received bitstream transmitted by the source device 10, and the destination device 20 can directly obtain the bitstream from the storage device 40. In this case, the storage device 40 includes any one of a plurality of distributed or locally accessible data storage media. For example, any one of the plurality of distributed or locally accessible data storage media can be a hard disk drive, a Blu-ray disc, a digital versatile disc (DVD), a compact disc read-only memory (CD-ROM), a flash memory, a volatile or non-volatile memory, or any other suitable digital storage media configured to store the bitstream.

[0071] In a possible implementation manner, the storage device 40 corresponds to a file server or other intermediate storage device that can store the bitstream generated by the source device 10. The destination device 20 may transmit in a streaming manner, or may download the image stored in the storage device 40. The file server is any type of server that can store the bitstream and transmit the bitstream to the destination device 20. In a possible implementation manner, the file server includes a network server, a file transfer protocol (FTP) server, a network attached storage (NAS) device, a local disk drive, etc. The destination device 20 can obtain the bitstream through any standard data connection (including an Internet connection). Any standard data connection includes a wireless channel (e.g., Wi-Fi connection), a wired connection (e.g., digital subscriber line (DSL) or cable modem), or a combination of a wireless channel and a wired connection suitable for obtaining the bitstream stored in the file server. The transmission of the bitstream from the storage device 40 may be in a streaming manner, a download manner, or a combination of these.

[0072] The implementation environment shown in FIG. 1 is merely a possible implementation manner. Furthermore, the technology in the embodiments of this application is applicable not only to the source device 10 that can encode an image and the destination device 20 that can decode a bitstream in FIG. 1, but also to other devices that can encode an image and decode a bitstream. This is not particularly limited in the embodiments of this application.

[0073] In the implementation environment shown in FIG. 1, the source device 10 includes a data source 120, an encoder 100, and an output interface 140. In some embodiments, the output interface 140 includes a modulator / demodulator (modem) and / or a transmitter. A transmitter is also sometimes referred to as a transceiver. The data source 120 includes an image capture device (e.g., a camera), an archive containing previously captured images, a feed-in interface for receiving images from an image content provider, and / or a computer graphics system for generating images, or a combination of these image sources.

[0074] The data source 120 is configured to send an image to the encoder 100, and the encoder 100 is configured to encode the received image sent from the data source 120 to obtain a bitstream. The encoder sends the bitstream to the output interface. In some embodiments, the source device 10 directly sends the bitstream to the destination device 20 through the output interface 140. In other embodiments, the bitstream may alternatively be stored in the storage device 40, such that the destination device 20 then obtains the bitstream for decoding and / or display.

[0075] In the implementation environment shown in FIG. 1, the destination device 20 includes an input interface 240, a decoder 200, and a display device 220. In some embodiments, the input interface 240 includes a receiver and / or a modem. The input interface 240 may receive a bitstream through the link 30 and / or from the storage device 40, and then transmit the bitstream to the decoder 200. The decoder 200 is configured to decode the received bitstream to obtain a reconstructed image. The decoder transmits the reconstructed image to the display device 220. The display device 220 may be integrated with the destination device 20 or may be disposed outside the destination device 20. Generally, the display device 220 displays the restored image. The display device 220 is one of several types of display devices. For example, the display device 220 is a liquid crystal display (LCD), a plasma display, an organic light-emitting diode (OLED) display, or another type of display device.

[0076] Although not shown in FIG. 1, in some aspects, the encoder 100 and the decoder 200 may be integrated with an audio encoder and an audio decoder, respectively, and may include a suitable multiplexer-demultiplexer (MUX-DEMUX) unit or other hardware and software for encoding both audio and video into the same data stream or separate data streams. In some embodiments, where applicable, the MUX-DEMUX unit may comply with the ITU H.223 multiplexer protocol or other protocols such as the user datagram protocol (UDP).

[0077] Encoder 100 and decoder 200 may each be any one of the following circuits, namely, one or more microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), discrete logic, hardware, or any combination thereof. When the technology in the embodiments of this application is partially realized by software, the device may store instructions for the software in a suitable non-volatile computer-readable storage medium, and may execute the instructions in hardware through one or more processors to realize the technology in the embodiments of this application. Any one of the above contents (including hardware, software, combination of hardware and software, etc.) may be considered as one or more processors. Each of encoder 100 and decoder 200 may be included in one or more encoders or decoders. Either the encoder or the decoder may be integrated as part of a combined encoder / decoder (codec) in the corresponding device.

[0078] In this embodiment of this application, encoder 100 generally may be referred to as "signaling" or "transmitting" some information to another device, for example, decoder 200. The terms "signaling" or "transmitting" may generally indicate syntax elements used to decode a bitstream and / or transmission of other data. Such transmission may be performed in real time or near real time. Alternatively, such communication may be performed after a certain period, for example, when syntax elements in an encoded bitstream are stored in a computer-readable storage medium during encoding. Then, the decoding device may retrieve the syntax elements at any time after the syntax elements are stored in the medium.

[0079] FIG. 2 is an exemplary block diagram of the encoder-side structure according to an embodiment of this application. The encoder side includes a predictor, a converter, a quantizer, an entropy encoder, an inverse quantizer, an inverse converter, a filter, and a memory. The predictor is an intra predictor or an inter predictor. Specifically, for a current coding block in a target image to be coded, the encoder side can perform an intra prediction on the current coding block by using the intra predictor, and can further perform an inter prediction on the current coding block by using the inter predictor. When performing an intra prediction on the current coding block, the encoder side acquires a first reference reconstruction block from the memory, and based on the first reference reconstruction block, performs an intra prediction on the current coding block by using the intra predictor to obtain a prediction block corresponding to the current coding block. The first reference reconstruction block is a reconstruction block corresponding to an encoded coding block that is in the target image and is located before the current coding block. Alternatively, when performing an inter prediction on the current coding block, the encoder side acquires a second reference reconstruction block from the memory, and then predicts the current coding block by using the inter predictor based on the second reference reconstruction block to obtain a prediction block corresponding to the current coding block. The second reference reconstruction block is a reconstruction block that is similar to the current coding block and is in an encoded image located before the target image.

[0080] By using an intra predictor or an inter predictor according to the above method, after determining a prediction block corresponding to a current coding block, the encoder side determines a difference between the current coding block and the prediction block as a residual block. Next, the residual block is transformed by using a transformer to obtain a transformed residual block, and the transformed residual block is quantized by using a quantizer to obtain a quantized and transformed residual block. Finally, an entropy encoder encodes the quantized and transformed residual block and prediction indication information into a bitstream, transmits the bitstream to the decoder side, and the prediction indication information indicates a prediction mode used when the current coding block is predicted.

[0081] To ensure the coding quality of the next coding block in the vicinity of the current coding block, before encoding the next coding block, the encoder side needs to perform inverse quantization on the quantized and transformed residual block by using an inverse quantizer to obtain a transformed residual block, and then perform inverse transformation on the transformed residual block by using an inverse transformer to obtain a reconstructed residual block. Next, the reconstructed residual block and the prediction block are added to obtain a reconstruction block corresponding to the current coding block. After determining the reconstruction block corresponding to the current coding block, the encoder side filters the reconstruction block corresponding to the current coding block by using a filter according to the filtering method provided in the embodiments of this application to obtain a filter block corresponding to the current coding block, and then stores the filter block corresponding to the current coding block in a memory to encode the next coding block.

[0082] Based on the above description, QP is an important parameter for controlling the degree of quantization. Therefore, in the process of encoding the current coding block by the encoder side, it is necessary to determine the QP corresponding to the current coding block. In actual applications, the QPs corresponding to different coding blocks within the same image may be the same or different. For example, the encoder side divides the target image into a plurality of non-overlapping coding blocks, and for any one of the plurality of coding blocks, the QP of the target image is used as the QP corresponding to the coding block. In another example, the encoder side divides the target image into a plurality of non-overlapping coding blocks, and for any one of the plurality of coding blocks, the QP of the target image is used as a reference for adaptively adjusting the QP of the coding block.

[0083] The plurality of coding blocks may be coding blocks of the same size or coding blocks of different sizes. In other words, the encoder side divides the target image into coding blocks of the same size, or the encoder side divides the target image into coding blocks of different sizes based on the content of the target image. The shape of the coding block is square or the shape of the coding block is other shapes. The shape of the coding block is not limited in the embodiments of this application.

[0084] Optionally, the converter is any one of a discrete cosine transform (DCT) device, a discrete sine transform (DST) device, or a Karhunen-Loeve transform (KLT) device.

[0085] FIG. 3 is an exemplary block diagram of the decoder-side structure according to an embodiment of this application. The decoder side includes an entropy decoder, a predictor, an inverse quantizer, an inverse transformer, a memory, and a filter. The predictor is an intra predictor or an inter predictor. Specifically, for a target image, when the encoder side performs intra prediction on each coding block in the target image, the decoder side also needs to determine a prediction block by using an intra predictor. When the encoder side performs inter prediction on each coding block in the target image, the decoder side also needs to determine a prediction block by using an inter predictor.

[0086] After receiving the bitstream, the decoder side decodes the received bitstream by using an entropy decoder to obtain a quantized and transformed residual block and prediction instruction information. The prediction instruction information indicates a prediction mode used when the current coding block is predicted. Next, the decoder side determines a specific predictor (intra predictor or inter predictor) used to perform prediction based on the prediction instruction information. When it is determined that prediction is to be performed by using an intra predictor, the decoder side obtains a first reference reconstruction block from the memory and determines a prediction block corresponding to the current coding block by using the intra predictor. When it is determined that prediction is to be performed by using an inter predictor, the decoder side obtains a second reference reconstruction block from the memory and determines a prediction block corresponding to the current coding block by using the inter predictor. Next, the quantized and transformed residual block is sequentially processed by using an inverse quantizer and an inverse transformer to obtain a reconstructed residual block, and the reconstructed residual block and the prediction block are added to obtain a reconstruction block corresponding to the current coding block.

[0087] To avoid image distortion between the current coding block and the reconstruction block corresponding to the current coding block, and to avoid excessive non-smoothness or discontinuous pixel problems between neighboring reconstruction blocks, on the decoder side, the reconstruction blocks can be further filtered by using a filter according to the filtering method provided in the embodiments of this application.

[0088] It should be noted that the service scenarios described in the embodiments of this application are intended to more clearly explain the technical solutions in the embodiments of this application and do not constitute a limitation to the technical solutions provided in the embodiments of this application. Those skilled in the art can recognize that the technical solutions provided in the embodiments of this application are also applicable to similar technical problems caused by the emergence of new service scenarios.

[0089] The filtering method provided in the embodiments of this application will be described in detail below.

[0090] FIG. 4 is a flowchart of a filtering method according to an embodiment of this application. The method is applied to the encoder side. As shown in FIG. 4, the method includes the following steps.

[0091] Step 401: Determine K groups of filtering model groups based on the quantization parameters of the target image. Each group of the K groups of filtering model groups includes M filtering models. The same filtering model group corresponds to the same quantization parameter, different filtering model groups correspond to different quantization parameters, and both K and M are integers greater than 1.

[0092] In some embodiments, the encoder side obtains K reference quantization parameters from the target correspondence relationship based on the quantization parameters of the target image. Since one quantization parameter corresponds to one filtering model group, the encoder side can determine K filtering model groups based on the K reference quantization parameters.

[0093] The target correspondence relationship indicates the correspondence between the image quantization parameters and the reference quantization parameters. In one example, the target correspondence relationship is the correspondence between the quantization parameter range and the reference quantization parameters, or the target correspondence relationship is the correspondence between the image quantization parameters and the reference quantization parameters.

[0094] When the target correspondence relationship is the correspondence between the quantization parameter range and the reference quantization parameters, the encoder side first determines the quantization parameter range in which the quantization parameters of the target image are included to obtain the target quantization parameter range, and then obtains K reference quantization parameters corresponding to the target quantization parameter range from the target correspondence relationship based on the target quantization parameter range.

[0095] For example, the target correspondence relationship is shown in Table 1. In Table 1, one quantization parameter range corresponds to three reference quantization parameters. In Table 1, for example, each quantization parameter range corresponds to three reference quantization parameters, that is, the number of reference quantization parameters corresponding to all quantization parameter ranges is the same. Obviously, in actual applications, the number of reference quantization parameters corresponding to all quantization parameter ranges may alternatively be different.

Table 1

[0096] When the target correspondence is the correspondence between the image quantization parameter and the reference quantization parameter, the encoder side directly obtains K reference quantization parameters corresponding to the quantization parameter of the target image from the target correspondence based on the quantization parameter of the target image.

[0097] For example, the target correspondence is shown in Table 2. In Table 2, one image quantization parameter corresponds to three reference quantization parameters. In Table 2, for example, each image quantization parameter corresponds to three reference quantization parameters, that is, the number of reference quantization parameters corresponding to all image quantization parameters is the same. Obviously, in actual applications, the number of reference quantization parameters corresponding to all image quantization parameters may be different as an alternative.

Table 2

[0098] When the target correspondence is the correspondence between the quantization parameter range and the reference quantization parameter, since the reference quantization parameters corresponding to all quantization parameters within the same quantization parameter range are the same, the encoder side only needs to remember the quantization parameter range and does not need to remember all quantization parameters in sequence. This helps to save the memory space on the encoder side and improves the efficiency of determining K filtering model groups by the encoder side.

[0099] When the target correspondence is the correspondence between the image quantization parameter and the reference quantization parameter, one image quantization parameter corresponds to K reference quantization parameters, and the correlation between the K reference quantization parameters and the image quantization parameter is stronger. Therefore, the correlation between the quantization parameter of the target image and the K filtering model groups determined by the encoder side based on the target correspondence is stronger. This can further improve the filtering effect.

[0100] The coding quality of a coding block is determined based on the quantization parameter corresponding to the coding block. That is, a smaller quantization parameter indicates higher coding quality, and a larger quantization parameter indicates lower coding quality. Further, the same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. Therefore, the coding quality of multiple coding blocks encoded based on the same quantization parameter is the same, and multiple coding blocks having the same coding quality can be filtered based on the same filtering model group. The coding quality of multiple coding blocks encoded based on different quantization parameters is different, and multiple coding blocks having different coding qualities can be filtered based on different filtering model groups. That is, the same filtering model group is applicable to coding blocks having the same coding quality, and different filtering model groups are applicable to coding blocks having different coding qualities.

[0101] In some embodiments, after determining K filtering model groups based on the quantization parameters of the target image, the encoder side further needs to encode the quantization parameters corresponding to the K filtering model groups into the bitstream. In this way, after receiving the bitstream, the decoder side can parse and extract the quantization parameters corresponding to the K filtering model groups from the bitstream, and determine the K filtering model groups based on the quantization parameters corresponding to the K filtering model groups.

[0102] The structure of the filtering model may be a convolutional neural network (CNN) structure, or other structures. The structure of the filtering model is not limited in the embodiments of this application.

[0103] Step 402: Determine a reconstruction block corresponding to the current coding block in the target image.

[0104] For the process in which the encoder side determines a reconstruction block corresponding to the current coding block in the target image, refer to the relevant description in FIG. 2. Details are not described again here.

[0105] Step 403: Determine a target filtering model from K groups of filtering models, where the target filtering model is the filtering model corresponding to the minimum coding distortion that exists after the reconstruction block is filtered, and the coding distortion that exists after the reconstruction block is filtered based on the target filtering model is smaller than the coding distortion of the reconstruction block.

[0106] In some embodiments, the encoder side can determine the target filtering model from the K groups of filtering models by performing the following steps (1) and (2).

[0107] (1) Based on the current coding block, the reconstruction block, and the K groups of filtering models, determine filtering instruction information corresponding to the reconstruction block, where the filtering instruction information indicates whether the reconstruction block needs to be filtered.

[0108] On the encoder side, the reconstruction block is input into each of the K filtering model groups to obtain K*M filter blocks. Based on the current coding block, the reconstruction block, and the K*M filter blocks, the rate-distortion cost corresponding to the reconstruction block and the rate-distortion cost corresponding to each filter block are determined. If the rate-distortion cost corresponding to the reconstruction block is not smaller than the rate-distortion cost corresponding to each filter block, it is determined that the filtering indication information is the first indication information, and the first indication information indicates that the reconstruction block needs to be filtered. Or, if the rate-distortion cost corresponding to the reconstruction block is smaller than the rate-distortion cost corresponding to each filter block, it is determined that the filtering indication information is the second indication information, and the second indication information indicates that the reconstruction block does not need to be filtered.

[0109] In one example, the rate-distortion cost corresponding to the reconstruction block can be determined according to Equation (1). J = D + λR (1)

[0110] In Equation (1), J represents the rate-distortion cost, D represents the error between the pixel values of the pixels in the reconstruction block and the pixel values of the pixels in the current coding block, λ represents the distortion parameter, which is usually the default value, and R represents the number of bits required to encode the current coding block into a bitstream when the reconstruction block does not need to be filtered. Obviously, in actual applications, the rate-distortion cost corresponding to each filter block may also be determined according to Equation (1). In this case, in Equation (1), D represents the error between the pixel values of the pixels in the filter block and the pixel values of the pixels in the current coding block, and R represents the number of bits required to encode the current coding block into a bitstream when the reconstruction block needs to be filtered.

[0111] When the reconstructed block does not need to be filtered, the number of bits required to encode the current coding block into a bitstream includes the number of bits required to encode the filtering indication information, the number of bits required to encode the quantized and transformed residual block, and the number of bits required to encode the prediction indication information. When the reconstructed block needs to be filtered, the number of bits required to encode the current coding block into a bitstream includes the number of bits required to encode the filtering indication information, the number of bits required to encode the quantized and transformed residual block, the number of bits required to encode the prediction indication information, and the number of bits required to encode the filtering model index.

[0112] In some embodiments, the encoder side stores the correspondence between the filtering model index and the number of bits required to encode the filtering model index. Therefore, after determining the K*M filtering models, the encoder side can obtain the number of bits required to encode the K*M filtering model indexes from the stored correspondence between the filtering model index and the number of bits required to encode the filtering model index based on the model indexes of the K*M filtering models, and then determine the rate-distortion cost corresponding to each filter block according to Equation (1).

[0113] The above content is based on an example where the number of bits required to encode different filtering model indexes is different, that is, different filtering model indexes correspond to different numbers of bits for encoding. Obviously, in actual applications, the number of bits required to encode different filtering model indexes may alternatively be the same, that is, different filtering model indexes correspond to the same number of bits for encoding. Thus, when the rate-distortion cost corresponding to each filter block is determined according to Equation (1), the rate-distortion cost corresponding to each of the K*M filter blocks mainly depends on the pixel error between the current coding block and the filter blocks within the K*M filter blocks.

[0114] When the rate-distortion cost corresponding to the reconstruction block and the rate-distortion cost corresponding to each filter block are determined according to Equation (1), it should be noted that the error between the pixel values of the pixels in the reconstruction block and the pixel values of the pixels in the current coding block, and the error between the pixel values of the pixels in the current coding block and the pixel values of the pixels in each of the K*M filter blocks are each any one of the sum of absolute difference (SAD), sum of absolute transformed difference (SATD), and mean squared error (MSE).

[0115] The rate distortion cost indicates the degree of image distortion between the reconstructed block and the original coding block, and the degree of image distortion between the filtering block and the original coding block. If the rate distortion cost corresponding to the reconstructed block is smaller than the rate distortion costs corresponding to the respective filtering blocks, this indicates that the image distortion between the reconstructed block and the original coding block is minimal. Thus, the image distortion between the original image and the reconstructed image restored based on the reconstructed block is minimal. In this case, the reconstructed block need not be filtered. If the rate distortion cost corresponding to the reconstructed block is not smaller than the rate distortion costs corresponding to the respective filtering blocks, this indicates that the image distortion between the filtering block and the original coding block is minimal. Thus, the image distortion between the original image and the reconstructed image restored based on the filtering block is minimal. In this case, the reconstructed block needs to be filtered.

[0116] The first instruction information and the second instruction information may be in a plurality of formats, for example, values or characters. When the first instruction information and the second instruction information are values, the first instruction information is 0 and the second instruction information is 1. Obviously, the values of the first instruction information and the second instruction information may be reversed as an alternative, or may be other values. This is not limited in the embodiments of this application.

[0117] In some embodiments, after determining the filtering instruction information corresponding to the reconstructed block based on the current coding block, the reconstructed block, and the K filtering model groups, the encoder side further needs to encode the filtering instruction information into the bitstream. Thus, after receiving the bitstream, the decoder side can determine whether the reconstructed block needs to be filtered based on the bitstream.

[0118] (2) When the filtering instruction information indicates that the reconstruction block needs to be filtered, a target filtering model is determined from K filtering model groups.

[0119] Based on the above description, an example where the rate distortion cost indicates the coding distortion is used. When the filtering instruction information indicates that the reconstruction block needs to be filtered, the rate distortion costs corresponding to all filtering blocks are compared with each other, and the filtering model corresponding to the filtering block with the minimum rate distortion cost is determined as the target filtering model. Obviously, in actual applications, the coding distortion can be further indicated by other parameters. This is not limited in the embodiments of this application.

[0120] In some embodiments, after determining the target filtering model from the K filtering model groups, the encoder side further needs to encode the target index into the bitstream, and the target index indicates the target filtering model. In this way, after receiving the bitstream, the decoder side can determine the target filtering model for filtering the reconstruction block based on the bitstream.

[0121] In one example, to distinguish between different filtering models, each filtering model corresponds to one model index, and different filtering models correspond to different model indexes. In this case, the target index includes the target model index, and the target model index indicates the target filtering model within the K filtering model groups.

[0122] In other examples, the same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. Therefore, in order to distinguish between different filtering models, the same filtering model group corresponds to the same quality index, and different filtering model groups correspond to different quality indexes. Different filtering models within the same filtering model group correspond to different content indexes, and filtering models in different groups may have the same content index. In this case, the target index includes a target quality index and a target content index. The target quality index indicates the filtering model group to which the target filtering model belongs, and the target content index indicates the model within the filtering model group that is the target filtering model.

[0123] It should be noted that the above content is based on an example where the filtering instruction information indicates that the reconstruction block needs to be filtered. Obviously, in actual applications, the filtering instruction information may alternatively indicate that the reconstruction block does not need to be filtered. When the filtering instruction information indicates that the reconstruction block does not need to be filtered, the reconstruction block is not filtered.

[0124] Step 404: Filter the reconstruction block based on the target filtering model.

[0125] The reconstruction block is input into the target filtering model, and the target filtering model outputs a filter block according to the relevant algorithm to filter the reconstruction block.

[0126] In this embodiment of the present application, each filtering model group includes M filtering models. The same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. That is, the same filtering model group is applicable to coding blocks having the same coding quality, different filtering model groups are applicable to coding blocks having different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks having different contents. In this way, after K filtering model groups are determined based on the quantization parameters of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups by referring to the coding quality and content of the coding block. Then, the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Furthermore, for coding blocks having different coding qualities and different contents within the same image, the filtering performance can be improved based on simplifying the network model, and the filtering effects of coding blocks having different qualities and different contents within the same image can be satisfied.

[0127] Figure 5 is a flowchart of another filtering method according to an embodiment of the present application. The method is applied on the decoder side. As shown in Figure 5, the method includes the following steps.

[0128] Step 501: Determine K filtering model groups, where each group of the K filtering model groups includes M filtering models. The same filtering model group corresponds to the same quantization parameter, different filtering model groups correspond to different quantization parameters, and both K and M are integers greater than 1.

[0129] In some embodiments, the decoder side determines K filtering model groups based on the quantization parameters of the target image to which this reconstruction block belongs. For the detailed implementation process, refer to the related description in step 401. Details will not be described again here.

[0130] In some other embodiments, after determining K filtering model groups based on the quantization parameters of the target image, the encoder side further encodes the quantization parameters corresponding to the K filtering model groups into the bitstream. Therefore, after receiving the bitstream, the decoder side can parse and extract the quantization parameters corresponding to the K filtering model groups from the bitstream, and determine the K filtering model groups based on the quantization parameters corresponding to the K filtering model groups.

[0131] Step 502: Determine the reconstruction block based on the bitstream.

[0132] After receiving the bitstream, the decoder side parses and extracts the reconstruction block corresponding to the current coding block from the bitstream. For the process of the decoder side parsing and extracting the reconstruction block corresponding to the current coding block from the bitstream, refer to the related description in FIG. 3. Details will not be described again here.

[0133] Step 503: Determine the target filtering model from the K filtering model groups.

[0134] In some embodiments, the decoder side determines filtering instruction information for a reconstruction block, and the filtering instruction information indicates whether the reconstruction block needs to be filtered. When the filtering instruction information indicates that the reconstruction block needs to be filtered, a target filtering model within K filtering model groups is determined.

[0135] After determining the filtering instruction information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and the K filtering model groups, the encoder side further encodes the filtering instruction information into the bitstream. Therefore, after receiving the bitstream, the decoder side can parse and extract the filtering instruction information from the bitstream, and determine whether the reconstruction block needs to be filtered based on the filtering instruction information.

[0136] When the filtering instruction information indicates that the reconstruction block needs to be filtered, after determining the target filtering model from the K filtering model groups, the encoder side further encodes a target index for indicating the target filtering model into the bitstream. Therefore, the decoder side can further parse and extract the target index from the bitstream, and then determine the target filtering model based on the target index.

[0137] Based on the above description, the target index includes a target model index, or includes a target quality index and a target content index. In different cases, the process by which the decoder side determines the target filtering model based on the target index is different. Therefore, the following two cases will be described separately below.

[0138] In the first case, the target index includes the target model index. In this case, the decoder directly selects the corresponding filtering model from the K filtering model groups based on the target model index and determines the selected filtering model as the target filtering model.

[0139] In the second case, the target index includes the target quality index and the target content index. In this case, the decoder first selects the corresponding filtering model group from the K filtering model groups based on the target quality index, and then determines the filtering model corresponding to the target content index from the selected filtering model group based on the target content index to obtain the target filtering model.

[0140] Step 504: Filter the reconstruction block based on the target filtering model.

[0141] The reconstruction block is input into the target filtering model, and the target filtering model outputs a filter block according to the relevant algorithm to filter the reconstruction block.

[0142] In this embodiment of the present application, each filtering model group includes M filtering models. The same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. That is, the same filtering model group is applicable to coding blocks with the same coding quality, different filtering model groups are applicable to coding blocks with different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks with different contents. In this way, after K filtering model groups are determined based on the quantization parameters of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups by referring to the coding quality and content of the coding block. Then, the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Furthermore, based on simplifying the network model, the filtering performance can be improved for coding blocks with different coding qualities and different contents in the same image, and the filtering effects of coding blocks with different qualities and different contents in the same image can be satisfied.

[0143] Before the encoder side and the decoder side filter the reconstruction block based on the relevant content in the above steps, it is further necessary to train an untrained filtering model to obtain a filtering model group corresponding to one quantization parameter. The filtering model group includes M filtering models. FIG. 6 is a flowchart of a filtering model training method according to an embodiment of the present application. Referring to FIG. 6, the method includes the following steps.

[0144] Step 601: Obtain a training sample set. The training sample set includes a plurality of sample coding blocks and a reconstruction block corresponding to each sample coding block. The quantization parameters of the images to which the plurality of sample coding blocks belong are the same quantization parameters.

[0145] The plurality of sample coding blocks are obtained by dividing a plurality of sample images, or the plurality of sample coding blocks are obtained by dividing one sample image. In other words, the plurality of sample coding blocks may be from the same sample image or from different sample images under the condition that the quantization parameters of the images to which the plurality of sample coding blocks belong are the same. Since the plurality of sample coding blocks are obtained by dividing an image into a plurality of non-overlapping coding blocks, the contents of the plurality of sample coding blocks are different.

[0146] For the process of obtaining the reconstruction block corresponding to each sample coding block, refer to the related description in FIG. 2 regarding the determination of the reconstruction block corresponding to the current coding block by the encoder side. Details will not be described again here.

[0147] Step 602: Train a filtering model to be trained based on the training sample set to obtain an initial filtering model.

[0148] The reconstruction blocks corresponding to the plurality of sample coding blocks included in the training sample set are used as the input of the filtering model to be trained, the plurality of sample coding blocks are used as the output of the filtering model to be trained, and the filtering model to be trained is trained to obtain an initial filtering model.

[0149] Step 603: Divide the training sample set into M initial sample subsets, where each initial sample subset includes at least two sample coding blocks and at least two reconstruction blocks corresponding to the at least two sample coding blocks.

[0150] The reconstruction blocks corresponding to the multiple sample coding blocks are input into the initial filtering model to obtain the filter blocks corresponding to each sample coding block. The peak signal-to-noise ratio of the filter blocks corresponding to each sample coding block is determined based on the multiple sample coding blocks and the filter blocks corresponding to each sample coding block. The multiple sample coding blocks are ranked in the order of the peak signal-to-noise ratio, and the training sample set is divided into M initial sample subsets based on the ranking result. The sample coding blocks included in each initial sample subset are at least two consecutive sample coding blocks in the ranking result.

[0151] For any one of the multiple sample coding blocks, the peak signal-to-noise ratio of the filter block corresponding to the sample coding block is determined according to Equation (2).

Equation

[0152] In Equation (2), PSNR represents the peak signal-to-noise ratio of the filter block corresponding to the sample coding block, n represents the number of bits required to encode each pixel in the sample coding block, which is usually 8, and MSE represents the mean square error between the pixel values of the pixels in the sample coding block and the pixel values of the pixels in the corresponding filter block.

[0153] For example, the training sample set is evenly divided into M initial sample subsets based on the ranking results of a plurality of sample coding blocks, and each initial sample subset contains the same number of sample coding blocks. Obviously, in actual applications, after a plurality of sample coding blocks are ranked in the order of peak signal-to-noise ratio, the training sample set can be further divided into M initial sample subsets according to other criteria. This is not limited in the embodiments of this application.

[0154] For example, the training sample set includes 16 sample coding blocks and reconstruction blocks corresponding to each sample coding block. Assume that the 16 sample coding blocks are B0 to B15, and the reconstruction blocks corresponding to the 16 sample coding blocks are C0 to C15. The 16 reconstruction blocks C0 to C15 are separately input into 16 filter blocks L0 to L15 of the initial filtering model. Then, the peak signal-to-noise ratios of L0 to L15 are determined according to Equation (2), and 16 obtained peak signal-to-noise ratios PSNR0 to PSNR15 are obtained. Then, B0 to B15 are ranked in the order of the values of PSNR0 to PSNR15, and B0 to B15 are evenly classified into 4 initial sample subsets based on the ranking results of B0 to B15, and each initial sample subset contains 4 sample coding blocks.

[0155] It should be noted that an example is that a plurality of sample coding blocks are ranked in the order of peak signal-to-noise ratio, and the training sample set is further divided into M initial sample subsets. In some other embodiments, the training sample set can alternatively be divided into M initial sample subsets in other ways. For example, the average pixel value corresponding to each sample coding block is determined, and the average pixel value is the average value of the pixel values of the pixels within the sample coding block. Then, the plurality of sample coding blocks are ranked in the order of the average pixel value, and the training sample set is divided into M initial sample subsets based on the ranking result. In another example, the pixel variance corresponding to each sample coding block is determined, and the pixel variance is the variance of the pixel values of the pixels within the sample coding block. Then, the plurality of sample coding blocks are ranked in the order of the pixel variance, and the training sample set is divided into M initial sample subsets based on the ranking result.

[0156] Step 604: Train an initial filtering model separately based on the M initial sample subsets to obtain M optimized filtering models.

[0157] For any one of the M initial sample subsets, reconstruction blocks corresponding to at least two sample coding blocks included in the initial sample subset are used as the input of the initial filtering model, and at least two sample coding blocks are used as the output of the initial filtering model to train the initial filtering model, thereby obtaining an optimized filtering model. In this way, the initial filtering model can be trained based on each of the M initial sample subsets by performing the above steps to obtain M optimized filtering models.

[0158] Based on the above description, it is assumed that the training sample sets B0 to B15 are evenly classified into four initial sample subsets. In this case, the initial filtering model is separately trained based on the four initial sample subsets to obtain four optimized filtering models, namely, filtering model A, filtering model B, filtering model C, and filtering model D.

[0159] Step 605: Train M optimized filtering models based on the training sample set to obtain a filtering model group.

[0160] The M optimized filtering models are trained in a cyclic iteration manner based on the training sample set. The i-th iteration process in the cyclic iteration manner includes the following steps.

[0161] (1) Based on a plurality of sample coding blocks and the reconstruction blocks corresponding to each sample coding block, the training sample set is divided into M optimized sample subsets. The M optimized sample subsets correspond one-to-one to the M filtering models in the i-th iteration process, and the M filtering models in the first iteration process are the M optimized filtering models.

[0162] Reconstruction blocks corresponding to a plurality of sample coding blocks are input into M filtering models in the i-th iteration process to obtain M filter blocks corresponding to each sample coding block. The peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block is determined based on the plurality of sample coding blocks and the M filter blocks corresponding to each sample coding block. The training sample set is divided into M optimized sample subsets based on the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block. Each sample coding block is located in the optimized sample subset of the filtering model corresponding to the filter block having the largest peak signal-to-noise ratio among the M filter blocks corresponding to the sample coding block.

[0163] For the process of determining the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block, refer to the related description of determining the peak signal-to-noise ratio according to Equation (2) in Step 603. Details will not be described again here. For any one of the plurality of sample coding blocks, the filtering model corresponding to the largest peak signal-to-noise ratio among the peak signal-to-noise ratios of the M filter blocks corresponding to the sample coding block is determined, and then the sample coding block is assigned to the optimized sample subset corresponding to the filtering model.

[0164] Based on the above description, the training sample set includes 16 sample coding blocks and reconstruction blocks corresponding to each sample coding block. Assume that the reconstruction blocks corresponding to the 16 sample coding blocks are C0 to C15. The reconstruction block C0 among the 16 reconstruction blocks is used as an example. The reconstruction block C0 is separately input into four filtering models in the i-th iteration process, and the four filter blocks corresponding to the sample coding block B0 and output by the four filtering models are L0 A , L0 B , L0 C and L0 D . According to Equation (2), assume that the four peak signal-to-noise ratios corresponding to the sample coding block B0 are PSNR0 A , PSNR0 B , PSNR0 C and PSNR0 D . When the peak signal-to-noise ratio PSNR0 C is the largest, the sample coding block B0 is assigned to the optimized sample subset corresponding to the filtering model C.

[0165] (2) Based on the M optimized sample subsets, train the M filtering models in the i-th iteration process.

[0166] For any one of the M optimized sample subsets, the reconstruction block corresponding to the sample coding block included in the optimized sample subset is used as the input of the corresponding filtering model, and the sample coding block is used as the output of the corresponding filtering model to train the corresponding filtering model.

[0167] (3) If i is smaller than the iteration number threshold, use the M filtering models obtained through training in the i-th iteration process as the M filtering models in the (i + 1)-th iteration process, and execute the (i + 1)-th iteration process.

[0168] (4) If i is greater than or equal to the iteration count threshold, determine the M filtering models obtained through training in the i-th iteration process as one filtering model group.

[0169] In this embodiment of this application, the M optimized filtering models are trained in a cyclic iteration manner. When the iteration count i of the M filtering models is less than the iteration count threshold, this indicates that the optimized filtering model obtained through the current training is not reliable. In this case, the M filtering models obtained through training in the i-th iteration process are used as the M filtering models in the (i + 1)-th iteration process, and the (i + 1)-th iteration process continues to be executed. When the iteration count i of the M filtering models is greater than or equal to the iteration count threshold, this indicates that the optimized filtering model obtained through the current training is reliable. In this case, the iteration process is stopped, and the M filtering models obtained through training in the i-th iteration process are used as one filtering model group.

[0170] The iteration count threshold is set in advance. The iteration count threshold is the specified iteration count or the maximum iteration count, and can be set based on different requirements. This is not limited in the embodiments of this application.

[0171] In the process of dividing a training sample set into M optimized sample subsets based on the peak signal-to-noise ratios of M filter blocks corresponding to each sample coding block, it should be noted that the training sample set may be divided into only one optimized sample subset. In other words, the maximum peak signal-to-noise ratio among the peak signal-to-noise ratios of the M filter blocks corresponding to each sample coding block in the training sample set corresponds to the same filtering model. In this case, based on one optimized sample subset obtained through the division, the filtering model in the i-th iteration is trained, and the iteration for other filtering models is stopped.

[0172] In this embodiment of the present application, since the quantization parameters of the images to which the plurality of sample coding blocks included in the training sample set belong are the same quantization parameters, an untrained filtering model is trained based on the training sample set, and one group of filtering models obtained through training is applicable to coding blocks having the same coding quality. Further, since the contents of the plurality of sample coding blocks included in the training sample set are different, the M filtering models included in the filtering model group are applicable to coding blocks having different contents. In this way, after K groups of filtering models are determined based on the quantization parameters of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K groups of filtering models by referring to the coding quality and content of the coding block, and then the reconstruction block is filtered based on the target filtering model to reduce the coding distortion and improve the filtering performance. Further, based on simplifying the network model, the filtering performance can be improved for coding blocks having different coding qualities and different contents within the same image, and the filtering effect of coding blocks having different qualities and different contents within the same image can be satisfied.

[0173] FIG. 7 is a diagram of the structure of a filtering apparatus according to an embodiment of the present application. The filtering apparatus may be implemented as part or all of an encoder-side device by using software, hardware, or a combination thereof. The encoder-side device may be the source device shown in FIG. 1. As shown in FIG. 7, the apparatus includes a first determination module 701, a second determination module 702, a third determination module 703, and a first filtering module 704.

[0174] The first determination module 701 is configured to determine K groups of filtering models based on the quantization parameters of the target image. Each group of the K groups of filtering models includes M filtering models. The same group of filtering models corresponds to the same quantization parameter, different groups of filtering models correspond to different quantization parameters, and both K and M are integers greater than 1. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0175] The second determination module 702 is configured to determine a reconstruction block corresponding to the current coding block in the target image. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0176] The third determination module 703 is configured to determine a target filtering model from the K groups of filtering models. The target filtering model is the filtering model corresponding to the minimum coding distortion that exists after the reconstruction block is filtered. The coding distortion that exists after the reconstruction block is filtered based on the target filtering model is smaller than the coding distortion of the reconstruction block. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0177] The first filtering module 704 is configured to filter the reconstruction block based on the target filtering model. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0178] Optionally, the third determination module 703 A first determination unit configured to determine filtering instruction information corresponding to a reconstruction block based on a current coding block, a reconstruction block, and K filtering model groups, where the filtering instruction information indicates whether the reconstruction block needs to be filtered; A second determination unit configured to determine a target filtering model from K filtering model groups when the filtering instruction information indicates that the reconstruction block needs to be filtered; and it includes.

[0179] Optionally, the first determination unit inputs the reconstruction block into each of the K filtering model groups to obtain K*M filter blocks, determines a rate-distortion cost corresponding to the reconstruction block and rate-distortion costs corresponding to each filter block based on the current coding block, the reconstruction block, and the K*M filter blocks, if the rate-distortion cost corresponding to the reconstruction block is not smaller than the rate-distortion costs corresponding to each filter block, determines that the filtering instruction information is the first instruction information, where the first instruction information indicates that the reconstruction block needs to be filtered, or if the rate-distortion cost corresponding to the reconstruction block is smaller than the rate-distortion costs corresponding to each filter block, determines that the filtering instruction information is the second instruction information, where the second instruction information indicates that the reconstruction block does not need to be filtered and is specifically configured in this way.

[0180] Optionally, the apparatus further includes a second filtering module configured to skip filtering the reconstruction block when the filtering instruction information indicates that the reconstruction block does not need to be filtered.

[0181] Optionally, the third determination module 703 further includes an encoding unit configured to encode filtering instruction information into a bit stream.

[0182] Optionally, the apparatus further includes a first encoding module configured to encode a target index into a bit stream, where the target index indicates a target filtering model.

[0183] Optionally, the apparatus further includes a second encoding module configured to encode quantization parameters corresponding to K groups of filtering models into a bit stream.

[0184] In this embodiment of this application, each filtering model group includes M filtering models. The same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. That is, the same filtering model group is applicable to coding blocks having the same coding quality, different filtering model groups are applicable to coding blocks having different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks having different contents. In this way, after K filtering model groups are determined based on the quantization parameters of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups by referring to the coding quality and content of the coding block. Then, the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Furthermore, for coding blocks having different coding qualities and different contents within the same image, the filtering performance can be improved based on simplifying the network model, and the filtering effect of coding blocks having different qualities and different contents within the same image can be satisfied.

[0185] It should be noted that in the filtering by the filtering device provided in the above embodiment, the division into the above function modules is merely used as an example for illustration. In actual applications, the above functions may be assigned to different function modules and realized based on requirements. Specifically, the internal structure of the device is divided into different function modules to realize all or part of the above functions. Furthermore, the embodiments of the filtering device and the filtering method provided in the above embodiment belong to the same concept. For the specific implementation process of the filtering device, refer to the embodiment of the method in detail. Details are not described again here.

[0186] FIG. 8 is a diagram of the structure of another filtering device according to an embodiment of this application. The filtering device may be implemented as part or all of the decoder-side device by using software, hardware, or a combination thereof. The decoder-side device may be the destination device shown in FIG. 1. As shown in FIG. 8, the device includes a first determination module 801, a second determination module 802, a third determination module 803, and a filtering module 804.

[0187] The first determination module 801 is configured to determine K groups of filtering models. Each group of the K groups of filtering models includes M filtering models. The same group of filtering models corresponds to the same quantization parameter, different groups of filtering models correspond to different quantization parameters, and both K and M are integers greater than 1. For the detailed implementation process, refer to the corresponding content in the above embodiment. Details are not described again here.

[0188] The second determination module 802 is configured to determine a reconstruction block based on the bitstream. For the detailed implementation process, refer to the corresponding content in the above embodiment. Details are not described again here.

[0189] The third determination module 803 is configured to determine a target filtering model from the K groups of filtering models. For the detailed implementation process, refer to the corresponding content in the above embodiment. Details are not described again here.

[0190] The filtering module 804 is configured to filter the reconstruction block based on the target filtering model. For the detailed implementation process, refer to the corresponding content in the above embodiment. Details are not described again here.

[0191] Optionally, the first determination module 801 is specifically configured to determine K filtering model groups based on the quantization parameters of the target image to which the reconstruction block belongs.

[0192] Optionally, the first determination module 801 parses and extracts the quantization parameters corresponding to the K filtering model groups from the bitstream, and is specifically configured to determine the K filtering model groups based on the quantization parameters corresponding to the K filtering model groups.

[0193] Optionally, the third determination module 803 is a first determination unit configured to determine the filtering instruction information of the reconstruction block, and the filtering instruction information includes a first determination unit indicating whether the reconstruction block needs to be filtered, and a second determination unit configured to determine a target filtering model from the K filtering model groups when the filtering instruction information indicates that the reconstruction block needs to be filtered. and includes.

[0194] Optionally, the first determination unit is specifically configured to parse and extract the filtering instruction information from the bitstream.

[0195] Optionally, the third determination module 803 parses and extracts a target index from the bitstream, where the target index indicates the target filtering model, and is specifically configured to determine the target filtering model based on the target index.

[0196] In this embodiment of this application, each filtering model group includes M filtering models. The same filtering model group corresponds to the same quantization parameter, and different filtering model groups correspond to different quantization parameters. That is, the same filtering model group is applicable to coding blocks having the same coding quality, different filtering model groups are applicable to coding blocks having different coding qualities, and different filtering models within the same filtering model group are applicable to coding blocks having different contents. In this way, after K filtering model groups are determined based on the quantization parameters of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K filtering model groups by referring to the coding quality and content of the coding block. Then, the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Furthermore, for coding blocks having different coding qualities and different contents within the same image, the filtering performance can be improved based on simplifying the network model, and the filtering effect of coding blocks having different qualities and different contents within the same image can be satisfied.

[0197] It should be noted that in the filtering by the filtering device provided in the above embodiment, the division into the above functional modules is used only as an example for illustration. In actual applications, the above functions may be assigned to different functional modules and realized based on requirements. Specifically, the internal structure of the device is divided into different functional modules to realize all or part of the above functions. Furthermore, the embodiments of the filtering device and the filtering method provided in the above embodiment belong to the same concept. For the specific implementation process of the filtering device, refer to the embodiment of the method in detail. Details are not described again here.

[0198] FIG. 9 is a diagram of the structure of a filtering model training apparatus according to an embodiment of this application. The filtering model training apparatus may be realized as part or all of a filtering model training device by using software, hardware, or a combination thereof. As shown in FIG. 9, the apparatus includes an acquisition module 901, a first training module 902, a splitting module 903, a second training module 904, and a third training module 905.

[0199] The acquisition module 901 is configured to acquire a training sample set, and the training sample set includes a plurality of sample coding blocks and reconstruction blocks corresponding to each sample coding block. The quantization parameters of the images to which the plurality of sample coding blocks belong are the same quantization parameters. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0200] The first training module 902 is configured to train a filtering model to be trained based on the training sample set to obtain an initial filtering model. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0201] The splitting module 903 is configured to split the training sample set into M initial sample subsets, and each initial sample subset includes at least two sample coding blocks and reconstruction blocks corresponding to the at least two sample coding blocks. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details are not described again here.

[0202] The second training module 904 is configured to separately train an initial filtering model based on M initial sample subsets to obtain M optimized filtering models. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details will not be described again here.

[0203] The third training module 905 is configured to train M optimized filtering models based on a training sample set to obtain a group of filtering models. For the detailed implementation process, refer to the corresponding content in the above embodiments. Details will not be described again here.

[0204] Optionally, the splitting module 903 inputs a reconstruction block corresponding to a plurality of sample coding blocks into the initial filtering model to obtain a filter block corresponding to each sample coding block, determines the peak signal-to-noise ratio of the filter block corresponding to each sample coding block based on the plurality of sample coding blocks and the filter block corresponding to each sample coding block, ranks the plurality of sample coding blocks in the order of the peak signal-to-noise ratio, and is specifically configured to divide the training sample set into M initial sample subsets based on the ranking result, where the sample coding blocks included in each initial sample subset are at least two consecutive sample coding blocks in the ranking result.

[0205] Optionally, the third training module 905 is specifically configured to train M optimized filtering models in a cyclic iteration manner based on the training sample set, and the i-th iteration process in the cyclic iteration manner is the following steps, that is, Based on a plurality of sample coding blocks and reconstruction blocks corresponding to each sample coding block, dividing a training sample set into M optimized sample subsets, where the M optimized sample subsets correspond one-to-one to the M filtering models in the i-th iteration process, and the M filtering models in the first iteration process are M optimized filtering models; Based on the M optimized sample subsets, training M filtering models in the i-th iteration process; If i is less than the iteration count threshold, using the M filtering models obtained through training in the i-th iteration process as the M filtering models in the (i + 1)-th iteration process and executing the (i + 1)-th iteration process, or If i is greater than or equal to the iteration count threshold, determining the M filtering models obtained through training in the i-th iteration process as one filtering model group; Including.

[0206] Optionally, the third training module 905 Inputs the reconstruction blocks corresponding to the plurality of sample coding blocks in the i-th iteration process into the M filtering models to obtain M filter blocks corresponding to each sample coding block; Based on the plurality of sample coding blocks and the M filter blocks corresponding to each sample coding block, determining the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block; Specifically configured to divide the training sample set into M optimized sample subsets based on the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block, and each sample coding block is located in the optimized sample subset of the filtering model corresponding to the filter block having the largest peak signal-to-noise ratio among the M filter blocks corresponding to the sample coding block.

[0207] In this embodiment of the present application, since the quantization parameters of the images to which the plurality of sample coding blocks included in the training sample set belong are the same quantization parameters, an untrained filtering model is trained based on the training sample set, and one group of filtering models obtained through training is applicable to coding blocks having the same coding quality. Further, since the contents of the plurality of sample coding blocks included in the training sample set are different, the M filtering models included in the filtering model group are applicable to coding blocks having different contents. Thus, after K groups of filtering models are determined based on the quantization parameters of the target image, for the reconstruction block corresponding to the current coding block, the target filtering model can be selected from the K groups of filtering models with reference to the coding quality and content of the coding block, and then the reconstruction block is filtered based on the target filtering model to reduce coding distortion and improve filtering performance. Further, for coding blocks having different coding qualities and different contents within the same image, the filtering performance can be improved based on simplifying the network model, and the filtering effect of coding blocks having different qualities and different contents within the same image can be satisfied.

[0208] In the filtering model training executed by the filtering model training device provided in the above embodiment, it should be noted that the division into the above functional modules is used only as an example for explanation. In actual applications, the above functions may be assigned to different functional modules and realized based on requirements. Specifically, the internal structure of the device is divided into different functional modules to realize all or part of the above functions. Furthermore, the embodiments of the filtering model training device and the filtering model training method provided in the above embodiment belong to the same concept. For the specific implementation process of the filtering model training device, refer to the embodiment of the method in detail. Details will not be described again here.

[0209] FIG. 10 is a block diagram of a computer device 1000 according to an embodiment of this application. The computer device 1000 may include a processor 1001, a memory 1002, and a bus system 1003. The processor 1001 and the memory 1002 are connected through the bus system 1003. The memory 1002 is configured to store instructions. The processor 1001 is configured to execute the instructions stored in the memory 1002 to execute the filtering method and the filtering model training method described in the embodiments of this application. To avoid repetition, details will not be described again here.

[0210] In this embodiment of this application, the processor 1001 may be a central processing unit (CPU), or the processor 1001 may be other general-purpose processors, DSPs, ASICs, FPGAs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc.

[0211] Memory 1002 may include a ROM device or a RAM device. Any other suitable type of storage device may also function as memory 1002. Memory 1002 may include code and data 10021 that are accessed by processor 1001 through bus 1003. Memory 1002 may further include an operating system 10023 and an application 10022. Application 10022 includes at least one program that enables processor 1001 to execute the filtering method or the filtering model training method described in the embodiments of this application. For example, application 10022 may include applications 1 to N, and may further include an application for executing the filtering method or the filtering model training method described in the embodiments of this application.

[0212] In addition to a data bus, bus system 1003 may further include a power bus, a control bus, a status signal bus, etc. However, for the sake of clarity, the various types of buses in the drawings are labeled as bus system 1003.

[0213] Optionally, computer device 1000 may further include one or more output devices, such as display 1004. In one example, display 1004 may be a touch-sensitive display that combines a touch-sensitive unit capable of sensing touch input and a display. Display 1004 may be connected to processor 1001 through bus 1003.

[0214] It should be noted that computer device 1000 may execute the filtering method in the embodiments of this application, or may execute the filtering model training method in the embodiments of this application.

[0215] Those skilled in the art will recognize that the functions described with reference to the various exemplary logical blocks, modules, and algorithm steps disclosed and described herein may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions described with reference to the exemplary logical blocks, modules, and steps may be stored on a computer-readable medium as one or more instructions or code or transmitted on a computer-readable medium and executed by a hardware-based processing unit. The computer-readable medium may include a computer-readable storage medium corresponding to a tangible medium such as a data storage medium, or may include any communication medium that facilitates the transmission of a computer program from one place to another (e.g., according to a communication protocol). Thus, the computer-readable medium may generally correspond to (1) a non-transitory tangible computer-readable storage medium or (2) a communication medium such as a signal or carrier wave. The data storage medium may be any usable medium accessible by one or more computers or one or more processors to retrieve instructions, code, and / or data structures for implementing the techniques described in this application. A computer program product may include a computer-readable medium.

[0216] By way of example and not limitation, such computer-readable storage media may include RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, flash memory, or any other medium that can store the required program code in the form of instructions or data structures and is accessible by a computer. Further, any connection may be properly termed a computer-readable medium. For example, if the instructions are transmitted from a website, server or other remote source via a coaxial cable, fiber optic cable, twisted pair, digital subscriber line (DSL), or using wireless technologies such as infrared, radio or microwave, the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio or microwave are included in the definition of the medium. However, it should be understood that computer-readable storage media and data storage media do not include connections, carrier waves, signals or other transient media, but rather actually mean non-transitory tangible storage media. As used herein, disk and disc include compact disc (CD), laser disc, optical disc, DVD and Blu-ray disc. Disk typically magnetically reproduces data, and disc optically reproduces data through a laser. The above combinations should also be included within the scope of computer-readable media.

[0217] The commands may be executed by one or more processors such as one or more digital signal processors (DSPs), general-purpose microprocessors, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), or equivalent integrated circuits or discrete logic circuits. Thus, the term "processor" as used in this specification may refer to the above structures, or any other structure to which the techniques described in this specification may be applied. Further, in some aspects, the functions described with reference to the exemplary logic blocks, modules, and steps described in this specification may be provided within dedicated hardware and / or software modules configured for encoding and decoding, or may be incorporated into a combined codec. Further, the techniques may be fully implemented in one or more circuits or logic elements. In one example, the various exemplary logic blocks, units, and modules in the encoder and decoder may be understood as corresponding circuit devices or logic elements.

[0218] The techniques in the embodiments of this application may be implemented in various devices or apparatuses, including wireless handsets, integrated circuits (ICs) or sets of ICs (e.g., chip sets). The various components, modules, or units are described in the embodiments of this application to emphasize the functional aspects of the apparatuses configured to execute the disclosed techniques, but do not necessarily have to be implemented by different hardware units. In fact, as described above, the various units may be combined with appropriate software and / or firmware to form codec hardware units, or may be provided by interoperable hardware units (including one or more of the above processors).

[0219] In other words, all or part of the above-described embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When software is used to implement an embodiment, all or part of the embodiment may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, the procedures or functions according to the embodiments of this application are all or partially generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or may be transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted in a wired (e.g., coaxial cable, optical fiber, or digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, or microwave) manner from a website, computer, server, or data center to another website, computer, server, or data center. The computer-readable storage medium may be any usable medium accessible by a computer, or a data storage device such as a server or data center integrating one or more usable media. The usable media may be a magnetic medium (e.g., floppy disk, hard disk drive, or magnetic tape), an optical medium (e.g., digital versatile disc (DVD)), a semiconductor medium (e.g., solid-state disk (SSD)), etc. It should be noted that the computer-readable storage medium referred to in the embodiments of this application may be a non-volatile storage medium, that is, a non-temporary storage medium.

[0220] In some embodiments, an encoder-side device is provided. The encoder-side device includes a memory and a processor.

[0221] The memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to implement a filtering method.

[0222] In some embodiments, a decoder-side device is provided. The decoder-side device includes a memory and a processor.

[0223] The memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to implement a filtering method.

[0224] In some embodiments, a filtering model training device is provided. The filtering model training device includes a memory and a processor.

[0225] The memory is configured to store a computer program, and the processor is configured to execute the computer program stored in the memory to implement a filtering model training method.

[0226] In some embodiments, a computer-readable storage medium is provided. The storage medium stores instructions. When the instructions are executed on a computer, the computer can execute the steps of the above method.

[0227] In some embodiments, a computer program is provided. When the computer program is executed, the above method is implemented.

[0228] In this specification, "a plurality" should be understood to mean two or more. In the description of the embodiments of this application, unless otherwise specified, " / " means "or". For example, A / B may indicate A or B. In this specification, "and / or" only describes the association relationship between related objects and indicates that three relationships may exist. For example, A and / or B may indicate the following three cases, namely, only A exists, both A and B exist, and only B exists. Further, in order to clearly explain the technical solutions in the embodiments of this application, terms such as "first" and "second" are used in the embodiments of this application to distinguish between the same items or similar items that basically provide the same function or purpose. Those skilled in the art can understand that terms such as "first" and "second" do not limit the number or execution order, and that terms such as "first" and "second" do not indicate a clear difference.

[0229] The information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.) and signals in the embodiments of this application are used under the permission of the user or the full permission of all parties, and it should be noted that the capture, use and processing of the relevant data need to comply with the relevant laws, regulations and standards of the relevant countries and regions. For example, the quantization parameters, filtering models, current coding blocks and reconstruction blocks in the embodiments of this application are all obtained under full permission.

[0230] The above description is only an exemplary embodiment of this application and is not intended to limit this application. Any modification, equivalent replacement or improvement made without departing from the spirit and principle of this application should fall within the protection scope of this application.

Claims

1. A filtering method applied to the encoder side, comprising: determining K groups of filtering models based on quantization parameters of a target image, each group of the K groups of filtering models including M filtering models, the same group of filtering models corresponding to the same quantization parameter, different groups of filtering models corresponding to different quantization parameters, and both K and M being integers greater than 1; determining a reconstructed block corresponding to a current coding block in the target image; determining a target filtering model from the K groups of filtering models, the target filtering model being a filtering model corresponding to the minimum coding distortion that exists after the reconstructed block is filtered, and the coding distortion that exists after the reconstructed block is filtered based on the target filtering model being smaller than the coding distortion of the reconstructed block; filtering the reconstructed block based on the target filtering model; and A method comprising the above steps.

2. The step of determining a target filtering model from the K groups of filtering models comprises: determining filtering instruction information corresponding to the reconstructed block based on the current coding block, the reconstructed block, and the K groups of filtering models, the filtering instruction information indicating whether the reconstructed block needs to be filtered; when the filtering instruction information indicates that the reconstructed block needs to be filtered, determining the target filtering model from the K groups of filtering models. The method according to claim 1, comprising the above steps.

3. The step of determining filtering instruction information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and the K filtering model groups includes: Inputting the reconstruction block into each of the K filtering model groups to obtain K*M filter blocks; Determining a rate distortion cost corresponding to the reconstruction block and rate distortion costs corresponding to each filter block based on the current coding block, the reconstruction block, and the K*M filter blocks; When the rate distortion cost corresponding to the reconstruction block is not less than the rate distortion costs corresponding to each filter block, determining that the filtering instruction information is first instruction information, where the first instruction information indicates that the reconstruction block needs to be filtered, or When the rate distortion cost corresponding to the reconstruction block is less than the rate distortion costs corresponding to each filter block, determining that the filtering instruction information is second instruction information, where the second instruction information indicates that the reconstruction block does not need to be filtered. The method according to claim 2, comprising the above steps.

4. The method according to claim 2 or 3, further comprising skipping the step of filtering the reconstruction block when the filtering instruction information indicates that the reconstruction block does not need to be filtered.

5. After determining the filtering instruction information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and the K filtering model groups, The method according to any one of claims 2 to 4, further comprising encoding the filtering instruction information into a bitstream.

6. After determining a target filtering model from the K filtering model groups, A step of encoding a target index into the bitstream, where the target index is used to indicate the target filtering model, the method according to any one of claims 1 to 5 further comprising the step.

7. After determining K groups of filtering models based on the quantization parameters of the target image, The method according to any one of claims 1 to 6 further comprising the step of encoding quantization parameters corresponding to the K groups of filtering models into the bitstream.

8. A filtering method applied on the decoder side, A step of determining K groups of filtering models, each group of the K groups of filtering models including M filtering models, the same filtering model group corresponding to the same quantization parameter, different filtering model groups corresponding to different quantization parameters, both K and M being integers greater than 1, the step; A step of determining a reconstruction block based on the bitstream; A step of determining a target filtering model from the K groups of filtering models; A step of filtering the reconstruction block based on the target filtering model and a method including.

9. The step of determining K groups of filtering models is The method according to claim 8, including the step of determining the K groups of filtering models based on the quantization parameters of the target image to which the reconstruction block belongs.

10. The step of determining K groups of filtering models is extracting, by parsing, quantization parameters corresponding to the K filtering model groups from the bit stream; determining the K filtering model groups based on the quantization parameters corresponding to the K filtering model groups; The method according to claim 8, comprising:

11. The step of determining a target filtering model from the K filtering model groups includes: determining filtering instruction information of the reconstruction block, the filtering instruction information indicating whether the reconstruction block needs to be filtered; when the filtering instruction information indicates that the reconstruction block needs to be filtered, determining the target filtering model from the K filtering model groups; The method according to any one of claims 8 to 10, comprising:

12. The step of determining the filtering instruction information of the reconstruction block includes: The method according to claim 11, comprising extracting the filtering instruction information by parsing from the bit stream.

13. The step of determining a target filtering model from the K filtering model groups includes: extracting, by parsing, a target index from the bit stream, the target index indicating the target filtering model; determining the target filtering model based on the target index; The method according to any one of claims 8 to 12, comprising:

14. A method for training a filtering model, comprising: A step of obtaining a training sample set, wherein the training sample set includes a plurality of sample coding blocks and a reconstruction block corresponding to each sample coding block, and quantization parameters of images to which the plurality of sample coding blocks belong are the same quantization parameters, the step; A step of training a filtering model to be trained based on the training sample set to obtain an initial filtering model; A step of dividing the training sample set into M initial sample subsets, each initial sample subset including at least two sample coding blocks and a reconstruction block corresponding to the at least two sample coding blocks, the step; A step of separately training the initial filtering model based on the M initial sample subsets to obtain M optimized filtering models; A step of training the M optimized filtering models based on the training sample set to obtain a group of filtering models A method including.

15. The step of dividing the training sample set into M initial sample subsets is A step of inputting the reconstruction block corresponding to the plurality of sample coding blocks into the initial filtering model to obtain a filter block corresponding to each sample coding block; A step of determining a peak signal-to-noise ratio of the filter block corresponding to each sample coding block based on the plurality of sample coding blocks and the filter block corresponding to each sample coding block; A step of ranking the plurality of sample coding blocks in the order of the peak signal-to-noise ratio; A step of dividing the training sample set into the M initial sample subsets based on the ranking result, where the sample coding blocks included in each initial sample subset are at least two consecutive sample coding blocks in the ranking result, and the step The method according to claim 14, including . **Claim 16** The step of training the M optimized filtering models based on the training sample set to obtain a group of filtering models is Including the step of training the M optimized filtering models based on the training sample set in a cyclic iteration manner, and the i-th iteration process in the cyclic iteration manner includes the following steps, that is A step of dividing the training sample set into M optimized sample subsets based on the plurality of sample coding blocks and the reconstruction blocks corresponding to each sample coding block, where the M optimized sample subsets correspond one-to-one to the M filtering models in the i-th iteration process, and the M filtering models in the first iteration process are the M optimized filtering models, and the step A step of training the M filtering models in the i-th iteration process based on the M optimized sample subsets When i is smaller than the iteration count threshold, using the M filtering models obtained through training in the i-th iteration process as the M filtering models in the (i + 1)-th iteration process and executing the (i + 1)-th iteration process, or When i is greater than or equal to the iteration count threshold, determining the M filtering models obtained through training in the i-th iteration process as the group of filtering models The method according to claim 14 or 15, including the above. **Claim 17** Based on the plurality of sample coding blocks and the reconstruction blocks corresponding to each sample coding block, the step of dividing the training sample set into M optimized sample subsets is as follows: In the i-th iteration, inputting the reconstruction blocks corresponding to the plurality of sample coding blocks into the M filtering models to obtain M filter blocks corresponding to each sample coding block; Based on the plurality of sample coding blocks and the M filter blocks corresponding to each sample coding block, determining the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block; Based on the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block, dividing the training sample set into the M optimized sample subsets, where each sample coding block is located in the optimized sample subset of the filtering model corresponding to the filter block having the largest peak signal-to-noise ratio among the M filter blocks corresponding to the sample coding block; The method according to claim 16, comprising:

18. A filtering device used on the encoder side, A first determination module configured to determine K groups of filtering models based on the quantization parameters of the target image, each group of the K groups of filtering models includes M filtering models, the same filtering model group corresponds to the same quantization parameter, different filtering model groups correspond to different quantization parameters, and both K and M are integers greater than 1; A second determination module configured to determine a reconstruction block corresponding to the current coding block in the target image; A third determination module configured to determine a target filtering model from the K filtering model groups, wherein the target filtering model is a filtering model corresponding to the minimum coding distortion that exists after the reconstruction block is filtered, and the coding distortion that exists after the reconstruction block is filtered based on the target filtering model is smaller than the coding distortion of the reconstruction block, and a third determination module; A first filtering module configured to filter the reconstruction block based on the target filtering model An apparatus comprising. **Claim 19** The third determination module A first determination unit configured to determine filtering instruction information corresponding to the reconstruction block based on the current coding block, the reconstruction block, and the K filtering model groups, wherein the filtering instruction information indicates whether the reconstruction block needs to be filtered, and a first determination unit; A second determination unit configured to determine the target filtering model from the K filtering model groups when the filtering instruction information indicates that the reconstruction block needs to be filtered The apparatus according to claim 18, comprising. **Claim 20** The first determination unit Input the reconstruction block into each of the K filtering model groups to obtain K*M filter blocks, Based on the current coding block, the reconstruction block, and the K*M filter blocks, determine the rate-distortion cost corresponding to the reconstruction block and the rate-distortion cost corresponding to each filter block, If the rate-distortion cost corresponding to the reconstruction block is not smaller than the rate-distortion cost corresponding to each filter block, it is determined that the filtering instruction information is the first instruction information, and the first instruction information indicates that the reconstruction block needs to be filtered, or If the rate-distortion cost corresponding to the reconstruction block is smaller than the rate-distortion cost corresponding to each filter block, it is determined that the filtering instruction information is the second instruction information, and the second instruction information indicates that the reconstruction block does not need to be filtered The apparatus according to claim 19, which is specifically configured as described above.

21. When the filtering instruction information indicates that the reconstruction block does not need to be filtered, the apparatus according to claim 19 or 20, further comprising a second filtering module configured to skip filtering the reconstruction block.

22. The third determination module The apparatus according to any one of claims 19 to 21, further comprising an encoding unit configured to encode the filtering instruction information into a bitstream.

23. A first encoding module configured to encode a target index into the bitstream, where the target index indicates the target filtering model, and the apparatus according to any one of claims 18 to 22, further comprising the first encoding module.

24. The apparatus according to any one of claims 18 to 23, further comprising a second encoding module configured to encode quantization parameters corresponding to the K filtering model groups into the bitstream.

25. A filtering apparatus used on the decoder side, A first determination module configured to determine K filtering model groups, each group of the K filtering model groups includes M filtering models, the same filtering model group corresponds to the same quantization parameter, different filtering model groups correspond to different quantization parameters, and both K and M are integers greater than 1, the first determination module; A second determination module configured to determine a reconstruction block based on a bitstream; A third determination module configured to determine a target filtering model from the K filtering model groups; A filtering module configured to filter the reconstruction block based on the target filtering model; An apparatus including.

26. The first determination module is: Specifically configured to determine the K filtering model groups based on the quantization parameter of the target image to which the reconstruction block belongs, the apparatus according to claim 25.

27. The first determination module is: Parse and extract the quantization parameters corresponding to the K filtering model groups from the bitstream, Specifically configured to determine the K filtering model groups based on the quantization parameters corresponding to the K filtering model groups, the apparatus according to claim 25.

28. The third determination module is: A first determination unit configured to determine filtering instruction information for the reconstruction block, the filtering instruction information indicating whether the reconstruction block needs to be filtered, the first determination unit; When the filtering instruction information indicates that the reconstruction block needs to be filtered, a second determination unit configured to determine the target filtering model from the K filtering model groups The apparatus according to any one of claims 25 to 27, comprising: **Claim 29** The first determination unit The apparatus according to claim 28, specifically configured to parse and extract the filtering instruction information from the bitstream. **Claim 30** The third determination module Parses and extracts a target index from the bitstream, where the target index indicates the target filtering model, and determines the target filtering model based on the target index The apparatus according to any one of claims 25 to 29, specifically configured as follows. **Claim 31** A filtering model training apparatus, comprising: An acquisition module configured to acquire a training sample set, where the training sample set includes a plurality of sample coding blocks and reconstruction blocks corresponding to each sample coding block, and quantization parameters of images to which the plurality of sample coding blocks belong are the same quantization parameters, the acquisition module; A first training module configured to train a filtering model of a training target based on the training sample set to obtain an initial filtering model; A division module configured to divide the training sample set into M initial sample subsets, where each initial sample subset includes at least two sample coding blocks and reconstruction blocks corresponding to the at least two sample coding blocks, the division module; A second training module that separately trains the initial filtering model based on the M initial sample subsets to obtain M optimized filtering models; A third training module that trains the M optimized filtering models based on the training sample set to obtain a group of filtering models; An apparatus comprising.

32. The splitting module: Inputs the reconstruction blocks corresponding to the plurality of sample coding blocks into the initial filtering model to obtain filter blocks corresponding to each sample coding block; Based on the plurality of sample coding blocks and the filter blocks corresponding to each sample coding block, determines the peak signal-to-noise ratio of the filter blocks corresponding to each sample coding block; Ranks the plurality of sample coding blocks in the order of the peak signal-to-noise ratio; Is specifically configured to divide the training sample set into the M initial sample subsets based on the ranking result, and the sample coding blocks included in each initial sample subset are at least two consecutive sample coding blocks in the ranking result. The apparatus according to claim 31.

33. The third training module: Is specifically configured to train the M optimized filtering models in a cyclic iteration manner based on the training sample set. The i-th iteration process in the cyclic iteration manner includes the following steps, that is, Based on the plurality of sample coding blocks and the reconstruction blocks corresponding to each sample coding block, dividing the training sample set into M optimized sample subsets, where the M optimized sample subsets correspond one-to-one to the M filtering models in the i-th iteration process, and the M filtering models in the first iteration process are the M optimized filtering models; Based on the M optimized sample subsets, training the M filtering models in the i-th iteration process; When i is smaller than the iteration count threshold, using the M filtering models obtained through training in the i-th iteration process as the M filtering models in the (i + 1)-th iteration process and executing the (i + 1)-th iteration process, or When i is greater than or equal to the iteration count threshold, determining the M filtering models obtained through training in the i-th iteration process as the one filtering model group; The apparatus according to claim 31 or 32, comprising.

34. The third training module: Inputting the reconstruction blocks corresponding to the plurality of sample coding blocks in the i-th iteration process into the M filtering models to obtain M filter blocks corresponding to each sample coding block; Based on the plurality of sample coding blocks and the M filter blocks corresponding to each sample coding block, determining the peak signal-to-noise ratio of the M filter blocks corresponding to each sample coding block; Specifically configured to divide the training sample set into the M optimized sample subsets based on the peak signal-to-noise ratios of the M filter blocks corresponding to each sample coding block, each sample coding block being located in an optimized sample subset of a filtering model corresponding to the filter block having the largest peak signal-to-noise ratio among the M filter blocks corresponding to the sample coding block, the apparatus according to claim 33. **Claim 35** An encoder-side device, wherein the encoder-side device includes a memory and a processor, the memory being configured to store a computer program, and the processor being configured to execute the computer program stored in the memory to implement the method according to any one of claims 1 to 7, the encoder-side device. **Claim 36** A decoder-side device, wherein the decoder-side device includes a memory and a processor, the memory being configured to store a computer program, and the processor being configured to execute the computer program stored in the memory to implement the method according to any one of claims 8 to 13, the encoder-side device. **Claim 37** A filtering model training device, wherein the filtering model training device includes a memory and a processor, the memory being configured to store a computer program, and the processor being configured to execute the computer program stored in the memory to implement the method according to any one of claims 14 to 17, the filtering model training device. **Claim 38** A computer-readable storage medium, A computer-readable storage medium that stores instructions, and when the instructions are executed on a computer, the computer is capable of performing the steps of the method according to any one of claims 1 to 17. Claim 39 A computer program that includes instructions, and when the instructions are executed on a computer, the computer is capable of performing the steps of the method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Method and apparatus for adaptive loop filtering

    JP2013534388A

  • Method and Apparatus of Adaptive Loop Filtering

    US20120082241A1

  • Image encoding device, image decoding device, image encoding method, and image decoding method

    US20120087595A1

  • Method and apparatus for filtering

    US20210266604A1

  • Image encoder, image decoder, image encoding method and image decoding method

    WO2010137322A1