Picture filtering method and apparatus, and device and storage medium
By determining the target filtering order in the neural network filter and performing filtering based on the filtering cost, the problem of poor generalization of chroma component filtering is solved, the filtering effect and generalization are improved, and the reconstructed image quality of video data is improved.
Patent Information
- Application Number
- PCT/CN2024/080175
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-14
- Filing Date
- 2024-03-05
- Publication Date
- 2024-10-17
AI Technical Summary
Existing neural network filters have poor generalization and poor filtering effect when filtering chroma components, resulting in a decrease in the quality of reconstructed images during video compression.
By determining the target filtering order of the first chroma component and the second chroma component of the current image block, filtering is performed based on the filtering costs of N filtering orders, thereby improving the filtering effect and improving the generalization of the neural network filter.
The filtering effect is improved, the generalization of the neural network filter and the image encoding and decoding performance are improved, and the reconstructed image quality of the video data is enhanced.
Smart Images

Figure CN2024080175_17102024_PF_FP_ABST
Abstract
Description
Image filtering method, device, equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on April 14, 2023, with application number 202310430930.X and invention name “Image filtering method, device, equipment and storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of image coding and decoding technology, and in particular to an image filtering method, apparatus, device, and storage medium. Background Art
[0003] With the development of video technology, video data has become increasingly complex. To facilitate the transmission of video data, video devices now implement video compression techniques for more efficient transmission or storage. In video compression, both the encoder and decoder must perform operations such as inverse quantization and inverse transformation to reconstruct the image. Because video compression introduces loss, filtering is performed on the reconstructed image to reduce compression losses.
[0004] With the rapid development of neural network technology, neural network filters have been widely used in video processing. However, when filtering chrominance components, current neural network filters have problems with poor generalization and poor filtering effect.
[0005] Summary of the Invention
[0006] The present application provides an image filtering method, apparatus, device and storage medium to improve the filtering effect of images and enhance the generalization of neural network filters.
[0007] In a first aspect, the present application provides an image filtering method, applied to a decoding device, the method comprising:
[0008] Decoding a code stream of a current image to obtain a residual value of the current image, and determining a reconstructed image of the current image based on the residual value;
[0009] determining, for a current image block to be filtered in the reconstructed image, a target filtering order for a first chrominance component and a second chrominance component of the current image block, wherein the target filtering order is determined by decoding the bitstream or based on filtering costs of N filtering orders, where N is a positive integer greater than 1;
[0010] Based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into a neural network filter for filtering to obtain a chroma filter block of the current image block.
[0011] In a second aspect, the present application provides an image filtering method, applied to an encoding device, the method comprising:
[0012] Encoding a current image to obtain a reconstructed image of the current image;
[0013] determining, for a current image block to be filtered in the reconstructed image, a target filtering order for a first chrominance component and a second chrominance component of the current image block, wherein the target filtering order is determined based on filtering costs of N filtering orders, where N is a positive integer greater than 1;
[0014] Based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into a neural network filter for filtering to obtain a filtered image block of the current image block.
[0015] In a third aspect, the present application provides an image filtering device, applied to a decoding device, the device comprising:
[0016] a decoding unit, configured to decode a code stream of a current image to obtain a residual value of the current image, and determine a reconstructed image of the current image based on the residual value;
[0017] an order determining unit, configured to determine, for a current image block to be filtered in the reconstructed image, a target filtering order for a first chroma component and a second chroma component of the current image block, wherein the target filtering order is determined by a decoded bitstream or based on filtering costs of N filtering orders, where N is a positive integer greater than 1;
[0018] A filtering unit is configured to input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering based on the target filtering order to obtain a chroma filter block of the current image block.
[0019] In a fourth aspect, the present application provides an image filtering device, applied to an encoding device, the device comprising:
[0020] an encoding unit, configured to encode a current image to obtain a reconstructed image of the current image;
[0021] an order determining unit, configured to determine, for a current image block to be filtered in the reconstructed image, a target filtering order for a first chroma component and a second chroma component of the current image block, wherein the target filtering order is determined based on filtering costs of N filtering orders, where N is a positive integer greater than 1;
[0022] A filtering unit is configured to input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering based on the target filtering order to obtain a filtered image block of the current image block.
[0023] In a fifth aspect, a decoder is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program, and the processor is configured to call and execute the computer program stored in the memory to execute the method of the first aspect or its implementations.
[0024] In a sixth aspect, an encoder is provided, comprising a processor and a memory, wherein the memory is configured to store a computer program, and the processor is configured to call and execute the computer program stored in the memory to execute the method of the second aspect or its respective implementations.
[0025] In a seventh aspect, a chip is provided for implementing the method described in any one of the first and second aspects above, or their respective implementations. Specifically, the chip includes a processor configured to load and execute a computer program from a memory, causing a device equipped with the chip to perform the method described in any one of the first and second aspects above, or their respective implementations.
[0026] In an eighth aspect, a computer-readable storage medium is provided for storing a computer program, wherein the computer program enables a computer to execute the method of any one of the first to second aspects or their respective implementations.
[0027] In a ninth aspect, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions enable a computer to execute the method of any one of the first to second aspects or their respective implementations.
[0028] In a tenth aspect, a computer program is provided, which, when executed on a computer, enables the computer to execute the method of any one of the first to second aspects or their respective implementations.
[0029] In summary, the present application determines the reconstructed image of the current image; for the current image block to be filtered in the reconstructed image, determines the target filtering order of the first chroma component and the second chroma component of the current image block, the target filtering order is determined by decoding the code stream or based on the filtering cost of N kinds of filtering orders, N is a positive integer greater than 1; based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the chroma filter block of the current image block. In other words, the embodiment of the present application determines the target filtering order based on the filtering cost of N kinds of filtering orders, thereby improving the accuracy of selecting the target filtering order. When the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering based on the accurately determined target filtering order, the filtering effect can be improved, thereby improving the generalization of the neural network filter and improving the image encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] FIG1 is a schematic block diagram of a video encoding and decoding system according to an embodiment of the present application;
[0031] FIG2 is a schematic diagram of a coding framework provided in an embodiment of the present application;
[0032] FIG3 is a schematic diagram of a decoding framework provided in an embodiment of the present application;
[0033] FIG4 is a schematic diagram of an encoding unit;
[0034] FIG5 is a schematic diagram of a filtering process of a neural network filter;
[0035] FIG6A is a schematic diagram of a chroma training sequence for a neural network filter;
[0036] FIG6B is a schematic diagram of a filtering sequence of a neural network filter;
[0037] FIG7 is a schematic diagram of a flow chart of an image filtering method provided in one embodiment of the present application;
[0038] 8A to 8C are schematic diagrams of current image blocks;
[0039] FIG9 is a schematic diagram of the filtered area around the current image block;
[0040] FIG10 is a schematic diagram of determining a target filtering order;
[0041] 11A to 12B are schematic diagrams of determining a target filtering order;
[0042] FIG13 is a schematic diagram of a flow chart of an image filtering method provided in one embodiment of the present application;
[0043] FIG14 is a schematic diagram of determining a target filtering order;
[0044] 15A and 15B are schematic diagrams showing determination of a target filtering order;
[0045] FIG16 is a schematic block diagram of an image filtering device provided in an embodiment of the present application;
[0046] FIG17 is a schematic block diagram of an image filtering device provided in an embodiment of the present application;
[0047] FIG18 is a schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0049] It should be noted that the terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In an embodiment of the present invention, "B corresponding to A" means that B is associated with A. In one implementation, B can be determined based on A. However, it should also be understood that determining B based on A does not mean determining B solely based on A; B can also be determined based on A and / or other information. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or server that includes a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to these processes, methods, products, or devices. In the description of this application, unless otherwise specified, "plurality" means two or more than two.
[0050] The present application can be applied to the field of image coding and decoding, the field of video coding and decoding, the field of hardware video coding and decoding, the field of dedicated circuit video coding and decoding, the field of real-time video coding and decoding, and the like. For example, the solution of the present application can be incorporated into a standard for end-to-end image coding based on deep learning, such as JPEG AI. Alternatively, the solution of the present application can be incorporated into other proprietary or industry standards and operated, including ITU-TH.261, ISO / IECMPEG-1Visual, ITU-TH.262 or ISO / IECMPEG-2Visual, ITU-TH.263, ISO / IECMPEG-4Visual, ITU-TH.264 (also known as ISO / IECMPEG-4AVC), including scalable video coding (SVC) and multi-view video coding (MVC) extensions. It should be understood that the technology of the present application is not limited to any specific coding standard or technology.
[0051] For ease of understanding, the video encoding and decoding system involved in the embodiment of the present application is first introduced with reference to FIG1 .
[0052] FIG1 is a schematic block diagram of a video encoding and decoding system involved in an embodiment of the present application. It should be noted that FIG1 is only an example, and the video encoding and decoding system of the embodiment of the present application includes but is not limited to that shown in FIG1. As shown in FIG1, the video encoding and decoding system 100 includes an encoding device 110 and a decoding device 120. The encoding device is used to encode (which can be understood as compressing) the video data to generate a code stream, and transmit the code stream to the decoding device. The decoding device decodes the code stream generated by the encoding device to obtain decoded video data.
[0053] The encoding device 110 of the embodiment of the present application can be understood as a device with a video encoding function, and the decoding device 120 can be understood as a device with a video decoding function, that is, the embodiment of the present application includes a wider range of devices for the encoding device 110 and the decoding device 120, such as smartphones, desktop computers, mobile computing devices, notebook (e.g., laptop) computers, tablet computers, set-top boxes, televisions, cameras, display devices, digital media players, video game consoles, car computers, etc.
[0054] In some embodiments, the encoding device 110 may transmit the encoded video data (eg, a code stream) to the decoding device 120 via a channel 130. The channel 130 may include one or more media and / or devices capable of transmitting the encoded video data from the encoding device 110 to the decoding device 120.
[0055] In one example, the channel 130 includes one or more communication media that enable the encoding device 110 to transmit the encoded video data directly to the decoding device 120 in real time. In this example, the encoding device 110 can modulate the encoded video data according to a communication standard and transmit the modulated video data to the decoding device 120. The communication media includes wireless communication media, such as radio frequency spectrum. Optionally, the communication media may also include wired communication media, such as one or more physical transmission lines.
[0056] In another example, channel 130 includes a storage medium that can store the video data encoded by encoding device 110. The storage medium includes various locally accessible data storage media, such as optical disks, DVDs, and flash memories. In this example, decoding device 120 can retrieve the encoded video data from the storage medium.
[0057] In another example, the channel 130 may include a storage server that can store the video data encoded by the encoding device 110. In this example, the decoding device 120 can download the stored encoded video data from the storage server. Alternatively, the storage server can store the encoded video data and transmit the encoded video data to the decoding device 120, such as a web server (e.g., for a website), a file transfer protocol (FTP) server, etc.
[0058] In some embodiments, the encoding device 110 includes a video encoder 112 and an output interface 113. The output interface 113 may include a modulator / demodulator (modem) and / or a transmitter.
[0059] In some embodiments, the encoding device 110 may further include a video source 111 in addition to the video encoder 112 and the input interface 113 .
[0060] The video source 111 may include at least one of a video acquisition device (eg, a video camera), a video archive, a video input interface, and a computer graphics system, wherein the video input interface is used to receive video data from a video content provider, and the computer graphics system is used to generate video data.
[0061] The video encoder 112 encodes the video data from the video source 111 to generate a bitstream. The video data may include one or more pictures or a sequence of pictures. The bitstream contains the coding information of the picture or picture sequence in the form of a bitstream. The coding information may include the coded picture data and associated data. The associated data may include a sequence parameter set (SPS), a picture parameter set (PPS), and other syntax structures. The SPS may contain parameters that apply to one or more sequences. The PPS may contain parameters that apply to one or more pictures. The syntax structure refers to a set of zero or more syntax elements arranged in a specified order in the bitstream.
[0062] The video encoder 112 transmits the encoded video data directly to the decoding device 120 via the output interface 113. The encoded video data may also be stored in a storage medium or a storage server for subsequent reading by the decoding device 120.
[0063] In some embodiments, the decoding device 120 includes an input interface 121 and a video decoder 122 .
[0064] In some embodiments, the decoding device 120 may further include a display device 123 in addition to the input interface 121 and the video decoder 122 .
[0065] The input interface 121 includes a receiver and / or a modem and can receive the encoded video data via the channel 130 .
[0066] The video decoder 122 is configured to decode the encoded video data to obtain decoded video data, and transmit the decoded video data to the display device 123 .
[0067] The decoded video data is displayed on the display device 123. The display device 123 may be integrated with the decoding device 120 or external to the decoding device 120. The display device 123 may include various display devices, such as a liquid crystal display (LCD), a plasma display, an organic light emitting diode (OLED) display, or other types of display devices.
[0068] In addition, Figure 1 is only an example, and the technical solution of the embodiment of the present application is not limited to Figure 1. For example, the technology of the present application can also be applied to unilateral video encoding or unilateral video decoding.
[0069] The following is an introduction to the video encoding framework involved in the embodiments of the present application.
[0070] FIG2 is a schematic block diagram of a video encoder according to an embodiment of the present application. It should be understood that the video encoder 200 can be used to perform lossy compression or lossless compression on an image. The lossless compression can be visually lossless or mathematically lossless.
[0071] The video encoder 200 can be applied to image data in a luminance and chrominance (YCbCr, YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2, or 4:4:4, where Y represents brightness (Luma), Cb (U) represents blue chrominance, Cr (V) represents red chrominance, and U and V represent chrominance (Chroma) for describing color and saturation. For example, in terms of color format, 4:2:0 means that every 4 pixels have 4 luminance components and 2 chrominance components (YYYYCbCr), 4:2:2 means that every 4 pixels have 4 luminance components and 4 chrominance components (YYYYCbCrCbCr), and 4:4:4 represents full pixel display (YYYYCbCrCbCrCbCrCbCr).
[0072] For example, the video encoder 200 reads video data, and for each frame of the video data, divides the frame into a number of coding tree units (CTUs). In some examples, CTUs may be referred to as "tree blocks", "largest coding units" (LCUs) or "coding tree blocks" (CTBs). Each CTU may be associated with a pixel block of equal size within the image. Each pixel may correspond to one luminance (luminance or luma) sample and two chrominance (chroma) samples. Therefore, each CTU may be associated with one luminance sample block and two chrominance sample blocks. The size of a CTU is, for example, 128×128, 64×64, 32×32, etc. A CTU may be further divided into a number of coding units (CUs) for encoding. A CU may be a rectangular block or a square block. A CU can be further divided into prediction units (PUs) and transform units (TUs), allowing for separation of coding, prediction, and transform, and greater flexibility in processing. In one example, a CTU is divided into CUs using a quadtree, and a CU is divided into TUs and PUs using a quadtree.
[0073] The video encoder and video decoder can support various PU sizes. Assuming that the size of a particular CU is 2N×2N, the video encoder and video decoder can support PU sizes of 2N×2N or N×N for intra-frame prediction, and support symmetric PUs of 2N×2N, 2N×N, N×2N, N×N, or similar sizes for inter-frame prediction. The video encoder and video decoder can also support asymmetric PUs of 2N×nU, 2N×nD, nL×2N, and nR×2N for inter-frame prediction.
[0074] In some embodiments, as shown in FIG2 , the video encoder 200 may include a prediction unit 210, a residual unit 220, a transform / quantization unit 230, an inverse transform / quantization unit 240, a reconstruction unit 250, a loop filter unit 260, a decoded image buffer 270, and an entropy coding unit 280. It should be noted that the video encoder 200 may include more, fewer, or different functional components.
[0075] Optionally, in this application, the current block may be referred to as the current coding unit (CU) or the current prediction unit (PU), etc. The prediction block may also be referred to as a predicted image block or an image prediction block, and the reconstructed image block may also be referred to as a reconstructed block or an image reconstructed image block.
[0076] In some embodiments, the prediction unit 210 includes an inter-frame prediction unit 211 and an intra-frame prediction unit 212. Because there is a strong correlation between adjacent pixels in a video frame, intra-frame prediction is used in video coding and decoding technologies to eliminate spatial redundancy between adjacent pixels. Because there is a strong similarity between adjacent frames in a video, inter-frame prediction is used in video coding and decoding technologies to eliminate temporal redundancy between adjacent frames, thereby improving coding efficiency.
[0077] The inter-frame prediction unit 211 can be used for inter-frame prediction, which can include motion estimation and motion compensation. Motion estimation searches a reference picture list for a reference block of the image block to be encoded. Motion estimation generates an index indicating the reference block and a motion vector indicating the spatial displacement between the image block to be encoded and the reference block. Motion estimation outputs the reference block index and the motion vector as motion information for the image block to be encoded. Motion compensation obtains prediction information for the image block to be encoded based on the motion information of the image block to be encoded. Inter-frame prediction can refer to image information from different frames. Inter-frame prediction uses motion information to find a reference block from a reference frame and generates a prediction block based on the reference block to eliminate temporal redundancy. The frames used for inter-frame prediction can be P frames and / or B frames. P frames refer to forward-predicted frames, and B frames refer to bidirectionally predicted frames. Inter-frame prediction uses motion information to find a reference block from a reference frame and generates a prediction block based on the reference block. Motion information includes the reference frame list in which the reference frame is located, the reference frame index, and the motion vector. Motion vectors can be integer or sub-pixel. If the motion vector is sub-pixel, interpolation filtering is required in the reference frame to create the required sub-pixel block. The integer or sub-pixel block in the reference frame found based on the motion vector is called a reference block. Some technologies directly use the reference block as the prediction block, while others further process the reference block to generate a prediction block. Generating a prediction block based on the reference block can also be understood as using the reference block as the prediction block and then processing it to generate a new prediction block.
[0078] The intra-frame prediction unit 212 only refers to the information of the same frame image to predict the pixel information in the current coded image block to eliminate spatial redundancy. The frame used for intra-frame prediction can be an I frame.
[0079] Intra-frame prediction has multiple prediction modes. For example, the H-series international digital video coding standard H.264 / AVC has eight angular prediction modes and one non-angular prediction mode. H.265 / HEVC expands this to 33 angular prediction modes and two non-angular prediction modes. HEVC uses planar, DC, and 33 angular modes for a total of 35 intra-frame prediction modes. VVC uses planar, DC, and 65 angular modes for a total of 67 intra-frame prediction modes.
[0080] It should be noted that with the increase of angle modes, intra-frame prediction will be more accurate and more in line with the needs of high-definition and ultra-high-definition digital video development.
[0081] The residual unit 220 may generate a residual block for the CU based on the pixel blocks of the CU and the prediction blocks of the PUs of the CU. For example, the residual unit 220 may generate the residual block for the CU such that each sample in the residual block has a value equal to the difference between the sample in the pixel blocks of the CU and the corresponding sample in the prediction blocks of the PUs of the CU.
[0082] The transform / quantization unit 230 can quantize the transform coefficients. The transform / quantization unit 230 can quantize the transform coefficients associated with the TU of the CU based on the quantization parameter (QP) value associated with the CU. The video encoder 200 can adjust the degree of quantization applied to the transform coefficients associated with the CU by adjusting the QP value associated with the CU. Exemplarily, the residual video signal is converted into a transform domain through transform operations such as DFT and DCT, which are called transform coefficients. The signal in the transform domain is further subjected to a lossy quantization operation, which loses a certain amount of information, making the quantized signal conducive to compression expression. In some video coding standards, there may be more than one transform method to choose from. Therefore, the encoding end also needs to select one of the transforms for the currently encoded CU and inform the decoding end. The degree of quantization fineness is usually determined by the quantization parameter (QP). A larger QP value means that coefficients with a larger value range will be quantized into the same output, which usually results in greater distortion and a lower bit rate. Conversely, a smaller QP value means that coefficients with a smaller value range will be quantized into the same output, which usually results in less distortion and corresponds to a higher bit rate.
[0083] The inverse transform / quantization unit 240 may apply inverse quantization and inverse transform, respectively, to the quantized transform coefficients to reconstruct a residual block from the quantized transform coefficients.
[0084] Reconstruction unit 250 may add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by prediction unit 210 to generate a reconstructed image block associated with the TU. By reconstructing the sample blocks of each TU of a CU in this manner, video encoder 200 can reconstruct the pixel blocks of the CU.
[0085] The loop filter unit 260 is used to process the pixels after inverse transformation and inverse quantization, compensate for the distortion information, and provide a better reference for the subsequent encoded pixels. For example, a deblocking filter operation can be performed to reduce the blocking effect of the pixel blocks associated with the CU. As can be seen from the above, the encoded image can obtain a reconstructed decoded image after inverse quantization, inverse transformation and prediction compensation operations. Compared with the original image, the reconstructed image has some information different from the original image due to the influence of quantization, resulting in distortion. Filtering operations such as deblocking filter DBF (deblocking filter), SAO (sample adaptive offset) or ALF (adaptive loop filter) on the reconstructed image can effectively reduce the degree of distortion caused by quantization. Since these filtered reconstructed images will be used as a reference for subsequent encoded images and used to predict future signals, the above filtering operation is also called loop filtering, and filtering operations within the encoding loop.
[0086] The decoded image buffer 270 may store the reconstructed pixel blocks. The inter-prediction unit 211 may use a reference image containing the reconstructed pixel blocks to perform inter-prediction on PUs of other images. In addition, the intra-prediction unit 212 may use the reconstructed pixel blocks in the decoded image buffer 270 to perform intra-prediction on other PUs in the same image as the CU.
[0087] The entropy coding unit 280 can receive the quantized transform coefficients from the transform / quantization unit 230. The entropy coding unit 280 can perform one or more entropy coding operations on the quantized transform coefficients to generate entropy-coded data. For example, the quantized transform domain signal will be statistically compressed and encoded according to the frequency of occurrence of each value, and finally a binary (0 or 1) compressed code stream will be output. At the same time, other information generated by the encoding, such as the selected mode, motion vector, etc., also needs to be entropy coded to reduce the bit rate. In one example, statistical coding can be used as a lossless coding method that can effectively reduce the bit rate required to express the same signal. Common statistical coding methods include variable length coding (VLC) or context-based binary arithmetic coding (CABAC).
[0088] FIG3 is a schematic block diagram of a video decoder according to an embodiment of the present application.
[0089] 3 , the video decoder 300 includes an entropy decoding unit 310, a prediction unit 320, an inverse quantization / transformation unit 330, a reconstruction unit 340, a loop filter unit 350, and a decoded picture buffer 360. It should be noted that the video decoder 300 may include more, fewer, or different functional components.
[0090] The video decoder 300 may receive a bitstream. The entropy decoding unit 310 may parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, the entropy decoding unit 310 may parse the entropy-encoded syntax elements in the bitstream. The prediction unit 320, the inverse quantization / transform unit 330, the reconstruction unit 340, and the loop filter unit 350 may decode the video data based on the syntax elements extracted from the bitstream, thereby generating decoded video data.
[0091] In some embodiments, the prediction unit 320 includes an intra-frame prediction unit 322 and an inter-frame prediction unit 321 .
[0092] The intra-prediction unit 322 may perform intra-prediction to generate a prediction block for the PU. The intra-prediction unit 322 may use an intra-prediction mode to generate a prediction block for the PU based on pixel blocks of spatially neighboring PUs. The intra-prediction unit 322 may also determine the intra-prediction mode for the PU based on one or more syntax elements parsed from the codestream.
[0093] The inter-frame prediction unit 321 may construct a first reference picture list (List 0) and a second reference picture list (List 1) based on syntax elements parsed from the codestream. In addition, if a PU is encoded using inter-frame prediction, the entropy decoding unit 310 may parse the motion information of the PU. The inter-frame prediction unit 321 may determine one or more reference blocks for the PU based on the motion information of the PU. The inter-frame prediction unit 321 may generate a prediction block for the PU based on the one or more reference blocks of the PU.
[0094] The inverse quantization / transform unit 330 may inversely quantize (ie, dequantize) the transform coefficients associated with the TU. The inverse quantization / transform unit 330 may use the QP value associated with the CU of the TU to determine the degree of quantization.
[0095] After inverse quantizing the transform coefficients, the inverse quantization / transform unit 330 may apply one or more inverse transforms to the inverse quantized transform coefficients in order to generate a residual block associated with the TU.
[0096] The reconstruction unit 340 uses the residual block associated with the TU of the CU and the prediction block of the PU of the CU to reconstruct the pixel block of the CU. For example, the reconstruction unit 340 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the pixel block of the CU to obtain a reconstructed image block.
[0097] Loop filtering unit 350 may perform a deblocking filtering operation to reduce blocking artifacts of pixel blocks associated with a CU.
[0098] The video decoder 300 may store the reconstructed image of the CU in the decoded image buffer 360. The video decoder 300 may use the reconstructed image in the decoded image buffer 360 as a reference image for subsequent prediction, or transmit the reconstructed image to a display device for presentation.
[0099] The basic process of video encoding and decoding is as follows: At the encoder end, a frame of image is divided into blocks. For the current block, the prediction unit 210 uses intra-frame prediction or inter-frame prediction to generate a prediction block for the current block. The residual unit 220 calculates a residual block based on the predicted block and the original block of the current block. This residual block is the difference between the predicted block and the original block of the current block. This residual block is also called residual information. This residual block undergoes transformation and quantization by the transform / quantization unit 230, removing information that is insensitive to the human eye and eliminating visual redundancy. Optionally, the residual block before transformation and quantization by the transform / quantization unit 230 is called a time-domain residual block, and the time-domain residual block after transformation and quantization by the transform / quantization unit 230 is called a frequency residual block or a frequency-domain residual block. The entropy coding unit 280 receives the quantized change coefficients output by the change quantization unit 230 and performs entropy coding on these quantized change coefficients to output a bitstream. For example, the entropy coding unit 280 can eliminate character redundancy based on the target context model and probability information of the binary bitstream.
[0100] At the decoding end, the entropy decoding unit 310 can parse the code stream to obtain the prediction information, quantization coefficient matrix, etc. of the current block. The prediction unit 320 uses intra-frame prediction or inter-frame prediction for the current block based on the prediction information to generate a prediction block for the current block. The inverse quantization / transformation unit 330 uses the quantization coefficient matrix obtained from the code stream to inverse quantize and inverse transform the quantization coefficient matrix to obtain a residual block. The reconstruction unit 340 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed blocks constitute a reconstructed image, and the loop filtering unit 350 performs loop filtering on the reconstructed image based on the image or block to obtain a decoded image. The encoding end also requires similar operations as the decoding end to obtain a decoded image. The decoded image can also be called a reconstructed image, and the reconstructed image can be used as a reference frame for inter-frame prediction for subsequent frames.
[0101] It should be noted that the block division information determined by the encoder, as well as mode information or parameter information such as prediction, transform, quantization, entropy coding, and loop filtering, etc., are carried in the bitstream when necessary. The decoder parses the bitstream and analyzes the existing information to determine the same block division information, prediction, transform, quantization, entropy coding, loop filtering, etc. mode information or parameter information as the encoder, thereby ensuring that the decoded image obtained by the encoder and the decoder are identical.
[0102] The above is the basic process of the video codec under the block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process may be optimized. This application is applicable to the basic process of the video codec under the block-based hybrid coding framework, but is not limited to the framework and process.
[0103] In existing hybrid coding frameworks, each video frame is typically divided into units of a certain size before the subsequent encoding and decoding process. As shown in Figure 4, the largest coding unit (CTU) is the basic coding unit in the hybrid coding framework and typically consists of two components: luma (Y) and chroma (UV). Because the U and V components of chroma have similar characteristics, they are typically processed sequentially using the same encoding parameters, first U and then V, resulting in corresponding U and V encoding results.
[0104] Existing hybrid coding frameworks use traditional loop filters to suppress distortion in reconstructed images, improve their quality, and hopefully restore the encoded reconstructed image to its original state. However, traditional loop filters are manually designed, making it difficult to effectively reduce distortion in reconstructed images and leaving significant room for optimization. Due to the impressive performance of deep learning tools in image processing, loop filters based on deep learning have been adopted in the loop filter module.
[0105] The main technology involved in this application is a neural network loop filter (NNLF). As shown in Figure 5, the image to be filtered before filtering is input into the trained filter to obtain the enhanced image after filtering.
[0106] During training, neural networks typically use a loss function to constrain the filtered image, aiming to restore it as closely as possible to the original image. The loss function measures the difference between the filtered value and the true value. A larger loss value indicates a greater discrepancy, and the goal of training is to minimize this loss. For deep learning-based encoding tools, some commonly used loss functions include the L1-norm loss function, the L2-norm loss function, and the smooth L1 loss function.
[0107] During the training process of the neural network filter, the UV component of the chroma is often input in units of the largest coding unit (LCU), and the corresponding filtering results of the U and V components are output. Then, a loss function is used to constrain the filtering results of the U and V components, respectively, to restore them to the original image. After the training process is completed, the parameters of the neural network filter are fixed. To maintain consistency between training and testing, the testing process of the neural network filter generally uses the same chroma filtering sequence as the training process. For example, as shown in FIG6A , during the training process of the neural network filter, the U component of the LCU is first input into the neural network filter, followed by the V component of the LCU, to obtain the filtered value of the U component of the LCU and the filtered value of the V component of the LCU. Next, the loss of the U component is determined based on the filtered value of the U component of the LCU and the original value of the U component of the LCU, and the loss of the V component is determined based on the filtered value of the V component of the LCU and the original value of the V component of the LCU. Finally, based on the loss of the U component and the loss of the V component, the parameters of the neural network filter are adjusted to achieve training of the neural network filter. Correspondingly, as shown in FIG6B , during the neural network filter test, the U component of the maximum coding unit is first input into the neural network filter, and then the V component of the maximum coding unit is input into the neural network filter for filtering to obtain the filtered value of the U component of the maximum coding unit and the filtered value of the V component of the maximum coding unit.
[0108] However, due to the similar characteristics of the U and V components of chrominance, the neural network filter learns similarities in chrominance filtering. Strictly requiring the chrominance filtering order during testing to be consistent with the training process may limit the generalization of the neural network filter, leaving room for optimization.
[0109] In order to solve the above technical problems, when decoding the current image, the embodiment of the present application first determines the reconstructed image of the current image, and for the current image block to be filtered in the reconstructed image, determines the target filtering order of the first chroma component and the second chroma component of the current image block, wherein the target filtering order is determined based on the filtering costs of N filtering orders, where N is a positive integer greater than 1; then, based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the filtered image block of the current image block. That is, in the embodiment of the present application, the target filtering order of the first chroma component and the second chroma component of the current image block being input into the neural network filter is determined based on the filtering costs of N filtering orders, rather than using the training order by default. This can improve the accuracy of selecting the target filtering order. When the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering based on the accurately determined target filtering order, the filtering effect can be improved, thereby improving the generalization of the neural network filter and improving the decoding performance.
[0110] The following describes the technical solutions of the embodiments of the present application in detail through some embodiments. The following embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0111] First, taking the decoding end as an example, the image filtering method provided in the embodiment of the present application is introduced.
[0112] FIG7 is a flow chart of an image filtering method provided by an embodiment of the present application, which is applied to the decoder or decoding device shown in FIG1 or FIG3. As shown in FIG7, the method of the embodiment of the present application includes:
[0113] S101 . Decode a code stream of a current image to obtain a residual value of the current image, and determine a reconstructed image of the current image based on the residual value.
[0114] In an embodiment of the present application, when encoding the current image, the encoding end divides the current image into coding blocks, and performs block-by-block encoding using the coding blocks as encoding units. For example, for the current block to be encoded in the current image, the prediction value of the current block is first obtained through inter-frame and / or intra-frame prediction. Then, based on the prediction value of the current block and the current block, the residual value of the current block is obtained. The encoding end transforms the residual value of the current block to obtain a transformation coefficient. In one example, the encoding end does not quantize the transformation coefficient of the current block, but directly encodes the transformation coefficient to obtain a code stream. In another example, the encoding end quantizes the transformation coefficient of the current block to obtain a quantization coefficient, and then encodes the quantization coefficient to obtain a code stream.
[0115] During the encoding process, as shown in Figure 2, the encoder also performs an inverse transform on the transform coefficients to obtain a residual value. This residual value is then added to the predicted value to obtain the reconstructed value for the current block. Based on these steps, a reconstructed value for each coded block in the current image is obtained, and these reconstructed values constitute the reconstructed image of the current image. Next, to further improve the quality of the reconstructed image, this reconstructed image is filtered to obtain a decoded image of the current image. In one example, this decoded image can be stored in a decoding buffer for use in predicting subsequent images.
[0116] As shown in Figure 3, for each block to be decoded in the current image, such as the current block, the decoder obtains a bitstream and decodes the bitstream to obtain the transform coefficients for the current block. In one example, if the encoder quantizes the transform coefficients before encoding them to form the bitstream, the decoder obtains the bitstream and then decodes it to obtain the quantized coefficients for the current block. These coefficients are then inverse-quantized to obtain the transform coefficients for the current image. The decoder then inverse-transforms the transform coefficients for the current block to obtain the residual values for the current block. Simultaneously, the decoder uses inter-frame and / or intra-frame prediction to obtain a predicted value for the current block. The predicted value and the residual value for the current block are then added together to obtain a reconstructed value for the current block. Based on the above steps, the decoder can decode and determine the reconstructed value for each block to be decoded in the current image. These reconstructed values constitute the reconstructed image of the current image. To further improve the quality of the reconstructed image, the decoder then filters the reconstructed image to obtain a decoded image of the current image. In one example, the decoder can store this decoded image in a decoding buffer for use in predicting subsequent images. In one example, the decoding end may output the decoded image to a display device for display.
[0117] In some embodiments, the image filtering method proposed in the embodiments of the present application can be used to filter at least one frame of an image in a video. That is, the current image is an image in the video.
[0118] In some embodiments, the image filtering method proposed in the embodiments of the present application can be used to decode a single image, that is, the current image is a single image, such as an image generated by an electronic device.
[0119] After the decoding end obtains the reconstructed image of the current image based on the above steps, it executes the following step S102.
[0120] S102 : For a current image block to be filtered in the reconstructed image, determine a target filtering order for a first chroma component and a second chroma component of the current image block.
[0121] The target filtering order is determined by decoding the code stream, or is determined based on filtering costs of N filtering orders, where N is a positive integer greater than 1.
[0122] In an embodiment of the present application, to improve the quality of the reconstructed image, the reconstructed image is filtered. Specifically, a neural network filter is used to filter the reconstructed image. When filtering the reconstructed image, the reconstructed image is divided into at least one image block, and each image block is filtered separately. The decoding end uses the neural network filter to filter each image block in the reconstructed image in a substantially consistent manner. For ease of description, filtering the current image block in the reconstructed image is used as an example.
[0123] It should be noted that the embodiment of the present application does not limit the size and shape of the above-mentioned current image block.
[0124] In a possible implementation, the current image block to be filtered is at least one CTU of the reconstructed image. That is, the at least one CTU of the reconstructed image is divided into an image block and input into a neural network filter for filtering.
[0125] In some examples, as shown in FIG8A , the current image block is a CTU of the reconstructed image, that is, a CTU of the reconstructed image is used as an input image block of a neural network filter.
[0126] In another example, as shown in FIG8B , the current image block is 4 CTUs of the reconstructed image, that is, the 4 CTUs of the reconstructed image are used as the input image block of a neural network filter.
[0127] In one example, multiple CTUs, such as two or three CTUs, of the reconstructed image can be used as input image blocks for a neural network filter. These multiple CTUs can be multiple CTUs in the horizontal direction or multiple CTUs in the vertical direction. Optionally, these multiple CTUs can be adjacent, non-adjacent, or partially adjacent and partially non-adjacent.
[0128] In another possible implementation, the current image block to be filtered is a preset image region of the reconstructed image, that is, a preset image region of the reconstructed image is used as an input image block of a neural network filter.
[0129] The embodiment of the present application does not limit the specific shape and size of the preset image area.
[0130] In one example, as shown in FIG8C , the preset image area includes at least one incomplete number of CTUs of the reconstructed image, that is, at least one incomplete number of CTUs of the reconstructed image is used as an input image block of the neural network filter.
[0131] In some embodiments, the preset image region is a fixed region. For example, during each filtering operation, the image block to be filtered in the reconstructed image is obtained according to the preset image region, and this image block is used as the input image block for the neural network filter. In this case, the image block input to the neural network filter each time has the same size and shape and is the same as the preset image region.
[0132] In some embodiments, the above-mentioned preset image area is a variable value. For example, during the first filtering, an image block to be filtered in the reconstructed image is obtained according to the first preset image area, and is input into the neural network filter as an input image block for filtering. During the second filtering, an image block to be filtered in the reconstructed image is obtained according to the second preset image area, and is input into the neural network filter as an input image block for filtering, and so on. In an example of this embodiment, the decoding end can divide the reconstructed image into several image blocks to be filtered, and the shapes and sizes of these several image blocks to be filtered can be the same, different, or partially the same and partially different.
[0133] Based on the above steps, the decoding end determines the current image block to be filtered in the reconstructed image and then uses a neural network filter to filter the current image block.
[0134] The current image block includes luminance and chrominance components, and the chrominance components include U and V. Since the U and V components in chrominance have similar characteristics, they are usually filtered using the same neural network filter.
[0135] As can be seen from the above, when filtering chroma components, the filtering order of the chroma components is currently fixed, typically consistent with the order in which the chroma components are input during neural network filter training. For example, during training, the U and V components are input into the neural network filter in the order U first, V last, to train the neural network filter. Similarly, during the actual filtering process, the U and V components are also input into the neural network filter in the same order for filtering. However, maintaining the same filtering order for the chroma components during filtering as the training order can lead to poor filtering results and reduce the generalization of the neural network filter.
[0136] In order to solve this technical problem, the embodiment of the present application first determines the target filtering order of the first chroma component and the second chroma component of the current image block when filtering the chroma component of the current image block. The target filtering order is determined based on the filtering costs of N types of filtering orders, which can improve the accuracy of determining the target filtering order. In this way, based on the accurately determined target filtering order, when filtering the chroma component of the current image block, the filtering effect of the chroma component can be effectively improved, thereby improving the generalization of the neural network filter.
[0137] The filtering cost of the embodiment of the present application includes at least one of the computational cost and the distortion cost. That is, in some embodiments, the filtering cost of the filtering order of the embodiment of the present application includes the computational cost of the filtering order, for example, the higher the computational time and / or computational complexity, the greater the computational cost. In some embodiments, the filtering cost of the filtering order of the embodiment of the present application includes the distortion cost of the filtering order, for example, the higher the distortion degree, the greater the distortion cost. In some embodiments, the filtering cost of the filtering order of the embodiment of the present application includes the computational cost and the distortion cost of the filtering order, for example, the higher the sum of the distortion cost and the computational cost, the greater the filtering cost.
[0138] The following describes a specific process of determining the target filtering order of the first chrominance component and the second chrominance component of the current image block at the decoding end.
[0139] In the embodiment of the present application, the specific manners in which the decoding end determines the target filtering order include but are not limited to the following:
[0140] Method 1: The decoding end obtains the target filtering order by decoding the bitstream. In this case, determining the target filtering order of the first chroma component and the second chroma component of the current image block in the above S102 includes the following steps S102-A1 and S102-A2:
[0141] S102-A1, decoding the bitstream to obtain first information, where the first information is used to indicate a target filtering order;
[0142] S102-A2: Obtain a target filtering order based on the first information.
[0143] In this first approach, the encoder determines the target filtering order for the first and second chroma components of the current image block and then writes first information into the bitstream, indicating the target filtering order. The decoder then decodes the bitstream to obtain the first information and, based on this information, determines the target filtering order.
[0144] The embodiment of the present application does not limit the specific form of expression of the first information, as long as it is any syntax field that can indicate the target filtering order.
[0145] In some embodiments, the first information includes a first flag, and the target filtering order is indicated by different values of the first flag.
[0146] Exemplarily, the correspondence between the value of the first flag and the filtering order of the chrominance component is shown in Table 1:
[0147] Table 1
[0148] The embodiment of the present application does not limit the specific values of A1 and A2, for example, A1 is equal to 0, A2 is equal to 1, or A1 is equal to 1, A2 is equal to 0, etc.
[0149] The embodiment of the present application does not limit the specific type of filtering order of the chrominance component. For example, in addition to the two filtering orders of U first, V last and V first, U last shown in Table 1 above, at least the following types can also be included:
[0150] Example 1: The filtering order of the chrominance component includes: dividing the U component into multiple sub-U components, and the multiple sub-U components and the V component form multiple filtering orders.
[0151] For example, the U component is divided into a first sub-U component and a second sub-U component. In this way, the filtering order of the first sub-U component, the second sub-U component and the V component includes: first the first sub-U component, then the V component, then the second sub-U component; first the second sub-U component, then the V component, then the first sub-U component; first the second sub-U component, then the first sub-U component, then the V component; first the V component, then the second sub-U component, then the first sub-U component, and so on.
[0152] Example 2: The filtering order of the chrominance component includes: dividing the V component into multiple sub-V components, and the multiple sub-V components and the U component form multiple filtering orders.
[0153] For example, the V component is divided into a first sub-V component and a second sub-V component. In this way, the filtering order of the first sub-V component, the second sub-V component and the U component includes: first the first sub-V component, then the U component, then the second sub-V component; first the second sub-V component, then the U component, then the first sub-V component; first the second sub-V component, then the first sub-V component, then the U component; first the U component, then the second sub-V component, then the first sub-V component, and so on.
[0154] Example 3: The filtering order of the chrominance component includes: dividing the U component into multiple sub-U components, and dividing the V component into multiple sub-V components, and the multiple sub-U components and the multiple sub-V components constitute multiple filtering orders.
[0155] For example, the U component is divided into a first sub-U component and a second sub-U component, and the V component is divided into a first sub-V component and a second sub-V component. In this way, the filtering order of the first sub-U component and the second sub-U component, and the first sub-V component and the second sub-V component includes: first sub-U component, then first sub-V component, then second sub-U component, and then second sub-V component; first sub-V component, then first sub-U component, then second sub-V component, and then second sub-U component; first sub-V component, then first sub-U component, then first sub-V component, and then second sub-U component;
[0156] In this first approach, the encoder can determine the value of the first flag corresponding to the target filtering order based on Table 1, then set the first flag to that value and write it into the bitstream. The decoder then decodes the bitstream to obtain the first flag, and then, based on the value of the first flag, obtains the target filtering order for the first and second chroma components of the current image block by consulting Table 1.
[0157] In one example, assuming the first chroma component is the U component and the second chroma component is the V component, if the encoder determines that the target filtering order for the first and second chroma components of the current image block is first chroma component first, then second chroma component last, based on Table 1, the value of the first flag can be determined to be A1, and then the first flag is set to A1 and written into the bitstream. In this way, the decoder decodes the bitstream to obtain the first flag, and then, based on the value of the first flag, determines, by consulting Table 1, that the target filtering order for the first and second chroma components of the current image block is first chroma component first, then second chroma component last.
[0158] In another example, assuming that the first chroma component is the U component and the second chroma component is the V component, if the encoder determines that the target filtering order for the first chroma component and the second chroma component of the current image block to be input into the neural network filter is the second chroma component first and the first chroma component last, based on Table 1 above, the value of the first flag can be determined to be A2, and then the first flag is set to A2 and written into the bitstream. In this way, the decoder decodes the bitstream to obtain the first flag, and then, based on the value of the first flag, determines, by consulting Table 1 above, that the target filtering order for the first chroma component and the second chroma component of the current image block is the second chroma component first and the first chroma component last.
[0159] In some embodiments, the above-mentioned filtering cost includes a first filtering cost, and the above-mentioned target filtering order is determined based on the first filtering cost of each filtering order in N filtering orders, wherein the first filtering cost of the filtering order is the filtering cost determined when the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering according to the filtering order.
[0160] That is, in this embodiment, for each of the N filtering orders, the encoder inputs the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the filtering order, and determines a filtering cost corresponding to the filtering order, which is recorded as the first filtering cost. This embodiment of the present application does not limit the specific types of the N filtering orders. For example, the N filtering orders include some or all of the various filtering orders shown in Table 1 above.
[0161] Exemplarily, for the jth filtering order among N filtering orders, the encoder inputs the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the jth filtering order, thereby obtaining a filtered value of the first chroma component and a filtered value of the second chroma component of the current image block. For ease of description, the filtered value of the chroma component of the current image block is recorded as the jth filtered value. In this case, the jth filtered value includes the filtered value of the first chroma component and the filtered value of the second chroma component of the current image block under the jth filtering order.
[0162] Next, the encoder determines a first filtering cost corresponding to the jth filtering order based on the jth filtered value of the current image block and the original image block of the current image block. For example, the first filtering cost corresponding to the jth filtering order is determined based on the filtered value of the first chrominance component of the current image block and the first chrominance component of the original image block of the current image block, as well as the filtered value of the second chrominance component of the current image block and the second chrominance component of the original image block of the current image block under the jth filtering order.
[0163] The embodiment of the present application does not limit the specific calculation method of the above-mentioned first filtering cost. For example, the above-mentioned first filtering cost can be a rate-distortion cost (RDO) or an approximate cost, such as SSD, STAD or SAD.
[0164] Based on the above steps, the encoding end can determine the first filtering cost corresponding to each of the N filtering orders, and then determine the target filtering order from the N filtering orders based on the first filtering cost corresponding to each filtering order.
[0165] In some embodiments, the target filtering order is a filtering order with the lowest first filtering cost among N filtering orders. In other words, the encoder determines the filtering order with the lowest first filtering cost among the N filtering orders as the target filtering order for the chrominance components of the current image block, and then indicates the target filtering order to the decoder.
[0166] As can be seen from the above, in this first approach, the decoding end can quickly obtain the target filtering order of the first chroma component and the second chroma component of the current image block by decoding the bitstream, thereby improving the image filtering speed.
[0167] In addition to using the method described in the above-mentioned method 1 to determine the target filtering order, the decoding end can also use the following method 2 to determine the target filtering order.
[0168] In the second method, the decoding end determines the target filtering order by itself. In this case, determining the target filtering order of the first chroma component and the second chroma component of the current image block in S102 includes the following steps S102-B1 to S102-B3:
[0169] S102-B1, determining a filtered area around the current image block;
[0170] S102-B2, for an i-th filtering order among N filtering orders, inputting the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter according to the i-th filtering order for filtering, and determining an i-th second filtering cost of the surrounding filtered area under the i-th filtering order, where i is a positive integer less than or equal to N;
[0171] S102-B3: Determine a target filtering order from the N filtering orders based on the second filtering costs corresponding to the N filtering orders.
[0172] In the second approach, the decoding end determines a target filtering order from N filtering orders based on the filtered area surrounding the current image block.
[0173] The embodiment of the present application does not limit the size and shape of the filtered area around the current image block.
[0174] In some embodiments, the filtered area around the current image block is a filtered area around the current image block that is adjacent to the current image block.
[0175] In some embodiments, as shown in FIG9 , the filtered area around the current image block includes an upper filtered area and a left filtered area of the current image block.
[0176] In some embodiments, the filtered area surrounding the current image block includes a template area of the current image.
[0177] After the decoding end determines the filtered area surrounding the current image block in the current image, it executes the above-mentioned steps S102-B2, inputs the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to each of the N filtering orders, determines the filtering cost corresponding to each of the N filtering orders, and records the filtering cost as the second filtering cost. In this embodiment, the specific process of the decoding end determining the second filtering cost corresponding to each of the N filtering orders is basically the same, and the i-th filtering order among the N filtering orders is used as an example for explanation. That is, according to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering, and the i-th second filtering cost of the surrounding filtered area under the i-th filtering order is determined.
[0178] The embodiment of the present application does not limit the specific method of determining the i-th second filtering cost of the surrounding filtered area under the i-th filtering order.
[0179] In one possible implementation, the decoding end inputs the first chroma component and the second chroma component of the surrounding filtered area into a neural network filter for filtering according to the i-th filtering order, and obtains the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order, and the filtered value of the second chroma component under the i-th filtering order. Then, based on the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order, and the filtered value of the second chroma component under the i-th filtering order, the second filtering cost corresponding to the i-th filtering order is determined. For example, the second filtering cost includes a computational cost, and the decoding end determines the computational cost when filtering the first chroma component and the second chroma component of the surrounding filtered area through the neural network filter in the i-th filtering order, and then determines the second filtering cost corresponding to the i-th filtering order based on the computational cost.
[0180] In a possible implementation, the above S102-B2 includes the following steps S102-B21 and S102-B22:
[0181] S102-B21, according to the i-th filtering order, input the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering, to obtain the i-th filtered value of the surrounding filtered area;
[0182] S102-B22, determine the i-th second filtering cost based on the i-th filtered value and the surrounding filtered area
[0183] In this implementation, the decoding end inputs the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the i-th filtering order, and obtains the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order, and the filtered value of the second chroma component under the i-th filtering order. For the sake of convenience of description, the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order and the filtered value of the second chroma component under the i-th filtering order are recorded as the i-th filtered value of the surrounding filtered area.
[0184] Next, based on the i-th filtered value and the surrounding filtered area, a second filtering cost corresponding to the i-th filtering order is determined.
[0185] For example, if the second filtering cost includes a distortion cost, the decoding end determines the second filtering cost corresponding to the i-th filtering order based on the filtered value of the first chrominance component of the surrounding filtered area and the first chrominance component of the surrounding filtered area, as well as the filtered value of the second chrominance component of the surrounding filtered area and the second chrominance component of the surrounding filtered area under the i-th filtering order.
[0186] The embodiment of the present application does not limit the specific calculation method of the above-mentioned second filtering cost. For example, the above-mentioned second filtering cost can be a rate-distortion cost (RDO) or an approximate cost, such as SSD, STAD or SAD.
[0187] For another example, the second filtering cost includes a computational cost and a distortion cost. The decoding end determines the distortion cost corresponding to the i-th filtering order based on the filtered value of the first chroma component of the surrounding filtered area and the first chroma component of the surrounding filtered area, as well as the filtered value of the second chroma component of the surrounding filtered area and the second chroma component of the surrounding filtered area under the i-th filtering order. At the same time, the computational cost of filtering the first chroma component and the second chroma component of the surrounding filtered area by the neural network filter in the i-th filtering order is determined. In this way, the second filtering cost corresponding to the i-th filtering order is determined based on the distortion cost and computational cost corresponding to the i-th filtering order. For example, the sum or weighted sum of the distortion cost and computational cost corresponding to the i-th filtering order is determined as the second filtering cost corresponding to the i-th filtering order.
[0188] Based on the above steps, the decoder can determine the second filter cost of each of the N filtering orders for the filtered area surrounding the current image block. Furthermore, based on the second filter costs corresponding to the N filtering orders, the target filtering order is determined from among the N filtering orders.
[0189] The embodiment of the present application does not limit the specific method of determining the target filtering order from the N filtering orders based on the second filtering costs corresponding to the N filtering orders at the decoding end.
[0190] For example, a filtering order with the smallest second filtering cost among N filtering orders is determined as the target filtering order.
[0191] For another example, any filtering order among the N filtering orders whose second filtering cost is less than a preset value is determined as the target filtering order.
[0192] The embodiment of the present application does not limit the specific types of the above N filtering orders.
[0193] In one example, the N filtering orders are shown in Table 2:
[0194] Table 2
[0195] In some embodiments, the N filtering orders include a first filtering order and a second filtering order, wherein the first filtering order is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, that is, when the first chroma component and the second chroma component are input into the neural network filter, the first chroma component is located before the second chroma component. The second filtering order is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter, that is, when the first chroma component and the second chroma component are input into the neural network filter, the second chroma component is located before the first chroma component.
[0196] At this time, as shown in Figure 10, the decoding end inputs the first chroma component (e.g., U component) and the second chroma component (e.g., V component) of the surrounding filtered area into the neural network filter for filtering according to the first filtering order, and determines the second filtering cost 1 corresponding to the first filtering order. At the same time, the decoding end inputs the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the second filtering order, and determines the second filtering cost 2 corresponding to the first filtering order. Finally, based on the second filtering cost 1 corresponding to the first filtering order and the second filtering cost 2 corresponding to the second filtering order, the target filtering order is selected from the first filtering order and the second filtering order. For example, the filtering order with the smallest second filtering cost among the first filtering order and the second filtering order is determined as the target filtering order.
[0197] As can be seen from the above, this embodiment of the present application does not consider the training order of the chroma components of the neural network filter when determining the target filtering order of the chroma components of the current image block. In other words, regardless of the training order of the chroma components of the neural network filter, the decoder determines the target filtering order of the chroma components of the current chroma block according to the above steps.
[0198] The embodiments of the present application do not limit the training method and related training parameters of the neural network filter.
[0199] In some embodiments, the neural network filter is trained using at least one CTU as a training unit. That is, at least one CTU of a training image is divided into a training unit and input into the neural network filter to train the neural network filter.
[0200] In some embodiments, the neural network filter is trained using a preset image region as a training unit. That is, the preset image region of the training image is divided into a training unit and input into the neural network filter to train the neural network filter. The description of the preset image region can be found in the description of the preset image region above and is not repeated here.
[0201] In some embodiments, the training order of the chrominance components of the neural network filter is any one of N training orders. Optionally, the N training orders and the N filtering orders may be the same or different, or partially the same and partially different.
[0202] In some embodiments, the above-mentioned N training sequences include a first training sequence and a second training sequence, wherein the first training sequence is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, and the second training sequence is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter.
[0203] In one example, during the training process, the chrominance training order of the neural network filter is the first training order, for example, the U component and the V component are input in sequence, and the filtering results of the U component and the V component are constrained by the corresponding loss function to achieve the training of the neural network filter. When the trained neural network filter is used to filter the first chrominance component and the second chrominance component of the current image block, the target filtering order of the first chrominance component and the second chrominance component is determined. Specifically, as shown in Figure 11A, the decoding end inputs the U component and the V component of the surrounding filtered area of the current image block into the neural network filter NNLF for filtering according to the first filtering order, for example, the filtering order of the U component first and the V component last, and outputs the filtered value of the U component of the surrounding filtered area and the filtered value of the V component. Then, based on the filtered value of the U component and the filtered value of the V component of the surrounding filtered area under the first filtering order, as well as the surrounding filtered area, the second filtering cost 1 corresponding to the first filtering order is determined. Similarly, as shown in Figure 11A, the decoder inputs the U and V components of the filtered area surrounding the current image block into the neural network filter NNLF for filtering according to the second filtering order, for example, the filtering order in which the V component comes first and the U component comes last. The decoder then outputs the filtered values of the U and V components of the filtered area. Next, based on the filtered values of the U and V components of the filtered area in the second filtering order, as well as the filtered area, a second filtering cost 2 corresponding to the second filtering order is determined. Finally, based on the second filtering costs corresponding to the first and second filtering orders, respectively, a target filtering order for the chrominance components of the current image block is determined from the first and second filtering orders.
[0204] In another example, during the training process, the chrominance training order of the neural network filter is the first training order, for example, the V component and the U component are input in sequence, and the filtering results of the V component and the U component are constrained by the corresponding loss function to realize the training of the neural network filter. When the first chrominance component and the second chrominance component of the current image block are filtered using the trained neural network filter, the target filtering order of the first chrominance component and the second chrominance component is determined. Specifically, as shown in Figure 11B, the decoding end inputs the U component and the V component of the surrounding filtered area of the current image block into the neural network filter NNLF for filtering according to the first filtering order, for example, the filtering order of the U component first and the V component last, and outputs the filtered value of the U component of the surrounding filtered area and the filtered value of the V component. Then, based on the filtered value of the U component and the filtered value of the V component of the surrounding filtered area under the first filtering order, and the surrounding filtered area, the second filtering cost 1 corresponding to the first filtering order is determined. Similarly, as shown in FIG11B , the decoder inputs the U and V components of the filtered area surrounding the current image block into the neural network filter NNLF for filtering according to the second filtering order, for example, a filtering order in which the V component comes first and the U component comes last. The decoder then outputs the filtered values of the U and V components of the filtered area. Next, based on the filtered values of the U and V components of the filtered area surrounding the second filtering order, as well as the filtered area surrounding the filtered area, a second filtering cost 2 corresponding to the second filtering order is determined. Finally, based on the second filtering costs corresponding to the first and second filtering orders, respectively, a target filtering order for the chrominance components of the current image block is determined from the first and second filtering orders.
[0205] From the above, it can be seen that the target filtering order determination process of the embodiment of the present application is independent of the chrominance training order of the neural network filter, thereby improving the selection flexibility and accuracy of the target filtering training.
[0206] It should be noted that the above description uses the example of N filtering orders including a first filtering order and a second filtering order to describe the process of determining a target filtering order. If the N filtering orders also include other filtering orders, such as those shown in Table 2 above, the same method as for the first and second filtering orders is used to determine the second filtering costs of the surrounding decoded area under the other filtering orders. This allows the second filtering costs corresponding to each of the N filtering orders to be determined, and then, based on the second filtering costs corresponding to each filtering order, the target filtering order is determined from the N filtering orders. For example, the filtering order with the lowest second filtering cost among the N filtering orders is determined as the target filtering order.
[0207] After the decoding end determines the target filtering order of the first chroma component and the second chroma component of the current image block based on the above steps, it performs the following step S103.
[0208] S103 : Based on the target filtering order, input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering to obtain a chroma filter block of the current image block.
[0209] Based on the above steps, the decoding end determines the target filtering order of the first chroma component and the second chroma component of the current image block, and then inputs the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the target filtering order to obtain a filtered image block of the current image block.
[0210] In one example, as shown in FIG12A , if the target filtering order is such that the first chroma component precedes the second chroma component, the first chroma component and the second chroma component of the current image block are concatenated, with the first chroma component being positioned before the second chroma component during the concatenation. Subsequently, the concatenated first and second chroma components are input into a neural network filter for filtering, thereby obtaining filtered values of the first and second chroma components of the current image block. The filtered values of the first and second chroma components of the current image block constitute the chroma filter block of the current image block.
[0211] In one example, as shown in FIG12B , if the target filtering order is such that the second chroma component precedes the first chroma component, the first chroma component and the second chroma component of the current image block are concatenated, with the first chroma component being positioned after the second chroma component during the concatenation. Subsequently, the concatenated first and second chroma components are input into a neural network filter for filtering, thereby obtaining filtered values of the first and second chroma components of the current image block. The filtered values of the first and second chroma components of the current image block constitute the chroma filter block of the current image block.
[0212] The above describes the filtering process of the current image block in the reconstructed image. The filtering process of other image blocks to be filtered in the reconstructed image can refer to the filtering process of the current image block, and finally a filtered reconstructed image is obtained.
[0213] In some embodiments, the neural network filter described above is used as a loop filter, where the output of the neural network filter affects video decoding. For example, the decoding end uses the neural network filter to filter the reconstructed image of the current image using the method described above, obtaining a filtered reconstructed image. This filtered reconstructed image is then stored in the decoding cache as the decoded image for subsequent image filtering. Because the embodiments of the present application provide for accurate determination of the filtering order, thereby improving the filtering quality of the reconstructed image, subsequent decoding based on the higher-quality reconstructed image can improve the video decoding effect.
[0214] In some embodiments, the above-mentioned neural network filter is used for post-processing, that is, filtering and optimizing the decoded video, and the output of the neural network filter does not affect the video decoding. For example, the decoding end decodes the video stream to obtain the decoded video, and then uses the neural network filter to filter at least one image in the decoded video. At this time, each of the at least one image can be recorded as a reconstructed image. Then, the decoding end uses the neural network filter to filter the reconstructed image using the above-mentioned method to obtain a filtered reconstructed image, and the filtered reconstructed image is not cached in the decoding cache for subsequent decoding, but is directly stored elsewhere, or directly output for display. At this time, the image filtering method of the embodiment of the present application is used for post-processing of the decoded video.
[0215] In some embodiments, the image filtering method proposed in the embodiments of the present application, in addition to being applied in the field of video or image decoding, can also be used in conventional image filtering. For example, for the current image block in the image to be filtered, the target filtering order of the first chroma component and the second chroma component of the current image block is determined, and the target filtering order is determined based on the filtering costs of N filtering orders, where N is a positive integer greater than 1; based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the chroma filter block of the current image block.
[0216] The image filtering method provided by the embodiment of the present application is as follows: when decoding the current image, the decoding end first decodes the code stream of the current image to obtain the residual value of the current image, and determines the reconstructed image of the current image based on the residual value; for the current image block to be filtered in the reconstructed image, the target filtering order of the first chroma component and the second chroma component of the current image block is determined, and the target filtering order is determined by decoding the code stream or based on the filtering cost of N kinds of filtering orders, where N is a positive integer greater than 1; based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the chroma filter block of the current image block. In other words, the embodiment of the present application determines the target filtering order based on the filtering cost of N kinds of filtering orders, thereby improving the accuracy of selecting the target filtering order. When the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering based on the accurately determined target filtering order, the filtering effect can be improved, thereby improving the generalization of the neural network filter and improving the decoding performance.
[0217] The above describes the image filtering method according to the embodiment of the present application by taking the decoding end as an example. The following describes the image filtering method according to the embodiment of the present application by taking the encoding end as an example.
[0218] FIG13 is a flow chart of an image filtering method provided by an embodiment of the present application, which is applied to the encoder shown in FIG1 or FIG2. As shown in FIG13, the method of the embodiment of the present application includes:
[0219] S201: Encode the current image to obtain a reconstructed image of the current image.
[0220] In an embodiment of the present application, when encoding the current image, the encoding end divides the current image into coding blocks, and performs block-by-block encoding using the coding blocks as encoding units. For example, for the current block to be encoded in the current image, the prediction value of the current block is first obtained through inter-frame and / or intra-frame prediction. Then, based on the prediction value of the current block and the current block, the residual value of the current block is obtained. The encoding end transforms the residual value of the current block to obtain a transformation coefficient. In one example, the encoding end does not quantize the transformation coefficient of the current block, but directly encodes the transformation coefficient to obtain a code stream. In another example, the encoding end quantizes the transformation coefficient of the current block to obtain a quantization coefficient, and then encodes the quantization coefficient to obtain a code stream.
[0221] During the encoding process, as shown in Figure 2, the encoder also performs an inverse transform on the transform coefficients to obtain a residual value. This residual value is then added to the predicted value to obtain the reconstructed value for the current block. Based on these steps, a reconstructed value for each coded block in the current image is obtained, and these reconstructed values constitute the reconstructed image of the current image. Next, to further improve the quality of the reconstructed image, this reconstructed image is filtered to obtain a decoded image of the current image. In one example, this decoded image can be stored in a decoding buffer for use in predicting subsequent images.
[0222] In some embodiments, the image filtering method proposed in the embodiments of the present application can be used to filter at least one frame of an image in a video. That is, the current image is an image in the video.
[0223] In some embodiments, the image filtering method proposed in the embodiments of the present application can be used to decode a single image, that is, the current image is a single image, such as an image generated by an electronic device.
[0224] After obtaining the reconstructed image of the current image based on the above steps, the encoder performs the following step S202.
[0225] S202 : For a current image block to be filtered in the reconstructed image, determine a target filtering order for a first chroma component and a second chroma component of the current image block.
[0226] The target filtering order is determined based on the filtering costs of N filtering orders, where N is a positive integer greater than 1.
[0227] In an embodiment of the present application, to improve the quality of the reconstructed image, the reconstructed image is filtered. Specifically, a neural network filter is used to filter the reconstructed image. When filtering the reconstructed image, the reconstructed image is divided into at least one image block, and each image block is filtered separately. The encoding end uses a substantially consistent process for filtering each image block in the reconstructed image using the neural network filter. For ease of description, filtering the current image block in the reconstructed image is used as an example.
[0228] It should be noted that the embodiment of the present application does not limit the size and shape of the above-mentioned current image block.
[0229] In a possible implementation, the current image block to be filtered is at least one CTU of the reconstructed image. That is, the at least one CTU of the reconstructed image is divided into an image block and input into a neural network filter for filtering.
[0230] In some examples, as shown in FIG8A , the current image block is a CTU of the reconstructed image, that is, a CTU of the reconstructed image is used as an input image block of a neural network filter.
[0231] In another example, as shown in FIG8B , the current image block is 4 CTUs of the reconstructed image, that is, the 4 CTUs of the reconstructed image are used as the input image block of a neural network filter.
[0232] In one example, multiple CTUs, such as two or three CTUs, of the reconstructed image can be used as input image blocks for a neural network filter. These multiple CTUs can be multiple CTUs in the horizontal direction or multiple CTUs in the vertical direction. Optionally, these multiple CTUs can be adjacent, non-adjacent, or partially adjacent and partially non-adjacent.
[0233] In another possible implementation, the current image block to be filtered is a preset image region of the reconstructed image. That is, the encoder uses a preset image region of the reconstructed image as an input image block of a neural network filter.
[0234] The embodiment of the present application does not limit the specific shape and size of the preset image area.
[0235] In one example, as shown in FIG8C , the preset image area includes at least one incomplete number of CTUs of the reconstructed image, that is, at least one incomplete number of CTUs of the reconstructed image is used as an input image block of the neural network filter.
[0236] In some embodiments, the preset image region is a fixed region. For example, during each filtering operation, the image block to be filtered in the reconstructed image is obtained according to the preset image region, and this image block is used as the input image block for the neural network filter. In this case, the image block input to the neural network filter each time has the same size and shape and is the same as the preset image region.
[0237] In some embodiments, the above-mentioned preset image area is a variable value. For example, during the first filtering, an image block to be filtered in the reconstructed image is obtained according to the first preset image area, and is input into the neural network filter as an input image block for filtering. During the second filtering, an image block to be filtered in the reconstructed image is obtained according to the second preset image area, and is input into the neural network filter as an input image block for filtering, and so on. In an example of this embodiment, the encoding end can divide the reconstructed image into several image blocks to be filtered, and the shapes and sizes of these several image blocks to be filtered can be the same, different, or partially the same and partially different.
[0238] Based on the above steps, the encoder determines the current image block to be filtered in the reconstructed image and then uses a neural network filter to filter the current image block.
[0239] The current image block includes luminance and chrominance components, and the chrominance components include U and V. Since the U and V components in chrominance have similar characteristics, they are usually filtered using the same neural network filter.
[0240] As can be seen from the above, when filtering chroma components, the filtering order of the chroma components is currently fixed, typically consistent with the order in which the chroma components are input during neural network filter training. For example, during training, the U and V components are input into the neural network filter in the order U first, V last, to train the neural network filter. Similarly, during the actual filtering process, the U and V components are also input into the neural network filter in the same order for filtering. However, maintaining the same filtering order for the chroma components during filtering as the training order can lead to poor filtering results and reduce the generalization of the neural network filter.
[0241] In order to solve this technical problem, the embodiment of the present application first determines the target filtering order of the first chroma component and the second chroma component of the current image block when filtering the chroma component of the current image block. The target filtering order is determined based on the filtering costs of N types of filtering orders, which can improve the accuracy of determining the target filtering order. In this way, based on the accurately determined target filtering order, when filtering the chroma component of the current image block, the filtering effect of the chroma component can be effectively improved, thereby improving the generalization of the neural network filter.
[0242] The filtering cost of the embodiment of the present application includes at least one of the computational cost and the distortion cost. That is, in some embodiments, the filtering cost of the filtering order of the embodiment of the present application includes the computational cost of the filtering order, for example, the higher the computational time and / or computational complexity, the greater the computational cost. In some embodiments, the filtering cost of the filtering order of the embodiment of the present application includes the distortion cost of the filtering order, for example, the higher the distortion degree, the greater the distortion cost. In some embodiments, the filtering cost of the filtering order of the embodiment of the present application includes the computational cost and the distortion cost of the filtering order, for example, the greater the sum of the distortion cost and the computational cost, the greater the filtering cost.
[0243] The following describes a specific process in which the encoder determines the target filtering order of the first chrominance component and the second chrominance component of the current image block.
[0244] In the embodiment of the present application, the specific manners in which the encoding end determines the target filtering order include but are not limited to the following:
[0245] Method 1: The encoder determines the target filtering order based on the current image block. In this case, determining the target filtering order of the first chroma component and the second chroma component of the current image block in S202 includes the following steps S202-A1 and S202-A2:
[0246] S202-A1. For a j-th filtering order among N filtering orders, input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering according to the j-th filtering order, and determine a j-th first filtering cost of the current image block under the j-th filtering order, where j is a positive integer less than or equal to N.
[0247] S202-A2: Determine a target filtering order from the N filtering orders based on the first filtering costs corresponding to the N filtering orders.
[0248] In this first approach, the encoder inputs the first chroma component and the second chroma component of the current image block into a neural network filter for filtering according to each of N filtering orders, determines the filtering cost corresponding to each of the N filtering orders, and records the filtering cost as the first filtering cost. In this embodiment, the specific process for the encoder to determine the first filtering cost corresponding to each of the N filtering orders is basically the same, and the jth filtering order among the N filtering orders is used as an example for explanation. That is, according to the jth filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering, and the jth first filtering cost of the current image block under the jth filtering order is determined.
[0249] The embodiment of the present application does not limit the specific method of determining the j-th first filtering cost of the current image block in the j-th filtering order.
[0250] In one possible implementation, the encoding end inputs the first chroma component and the second chroma component of the current image block into a neural network filter for filtering according to the j-th filtering order, and obtains the filtered value of the first chroma component of the current image block under the j-th filtering order, and the filtered value of the second chroma component under the j-th filtering order. Then, based on the filtered value of the first chroma component of the current image block under the j-th filtering order, and the filtered value of the second chroma component under the j-th filtering order, the first filtering cost corresponding to the j-th filtering order is determined. For example, the first filtering cost includes a computational cost, and the encoding end determines the computational cost when filtering the first chroma component and the second chroma component of the current image block through the neural network filter in the j-th filtering order, and then determines the first filtering cost corresponding to the j-th filtering order based on the computational cost.
[0251] In a possible implementation, the above S202-B2 includes the following steps S202-B21 and S202-B22:
[0252] S202-B21, according to the j-th filtering order, input the first chroma component and the second chroma component of the current image block into the neural network filter for filtering to obtain the j-th filtered image block of the current image block;
[0253] S202-B22, determining the jth first filtering cost based on the jth filtered image block and the original image block of the current image block
[0254] In this implementation, the encoding end inputs the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the j-th filtering order, and obtains the filtered value of the first chroma component of the current image block under the j-th filtering order, and the filtered value of the second chroma component under the j-th filtering order. For the sake of convenience of description, the filtered value of the first chroma component of the current image block under the j-th filtering order and the filtered value of the second chroma component under the j-th filtering order are recorded as the j-th filtered image block of the current image block.
[0255] Next, based on the j-th filtered image block and the original image block of the current image block, a first filtering cost corresponding to the j-th filtering order is determined.
[0256] For example, the first filtering cost includes a distortion cost, and the encoding end determines the first filtering cost corresponding to the jth filtering order based on the filtered value of the first chrominance component of the current image block and the first chrominance component of the original image block of the current image block, as well as the filtered value of the second chrominance component of the current image block and the second chrominance component of the original image block of the current image block under the jth filtering order.
[0257] The embodiment of the present application does not limit the specific calculation method of the above-mentioned first filtering cost. For example, the above-mentioned first filtering cost can be a rate-distortion cost (RDO) or an approximate cost, such as SSD, STAD or SAD.
[0258] For another example, the first filtering cost includes a computational cost and a distortion cost. The encoding end determines the distortion cost corresponding to the j-th filtering order based on the filtered value of the first chroma component of the current image block and the first chroma component of the original image block of the current image block, as well as the filtered value of the second chroma component of the current image block and the second chroma component of the original image block of the current image block under the j-th filtering order. At the same time, the computational cost of filtering the first chroma component and the second chroma component of the original image block of the current image block by the neural network filter in the j-th filtering order is determined. In this way, the first filtering cost corresponding to the j-th filtering order is determined based on the distortion cost and computational cost corresponding to the j-th filtering order. For example, the sum or weighted sum of the distortion cost and computational cost corresponding to the j-th filtering order is determined as the first filtering cost corresponding to the j-th filtering order.
[0259] Based on the above steps, the encoder can determine the first filter cost of the current image block in each of the N filtering orders, and then determine the target filtering order from the N filtering orders based on the first filter costs corresponding to the N filtering orders.
[0260] The embodiment of the present application does not limit the specific method for the encoding end to determine the target filtering order from the N filtering orders based on the first filtering costs corresponding to the N filtering orders.
[0261] For example, a filtering order with the smallest first filtering cost among N filtering orders is determined as the target filtering order.
[0262] For another example, any filtering order among the N filtering orders whose first filtering cost is less than a preset value is determined as the target filtering order.
[0263] The embodiment of the present application does not limit the specific types of the above N filtering orders.
[0264] In one example, the N filtering orders are shown in Table 2.
[0265] In some embodiments, the N filtering orders include a first filtering order and a second filtering order, wherein the first filtering order is that the first chroma component is first and the second chroma component is last in the input of the neural network filter, and the second filtering order is that the second chroma component is first and the first chroma component is last in the input of the neural network filter.
[0266] At this time, as shown in Figure 14, the encoding end inputs the first chroma component (e.g., U component) and the second chroma component (e.g., V component) of the current image block into the neural network filter for filtering in accordance with the first filtering order, and determines the first filtering cost 1 corresponding to the first filtering order. At the same time, the encoding end inputs the first chroma component and the second chroma component of the current image block into the neural network filter for filtering in accordance with the second filtering order, and determines the first filtering cost 2 corresponding to the first filtering order. Finally, based on the first filtering cost 1 corresponding to the first filtering order and the first filtering cost 2 corresponding to the second filtering order, the target filtering order is selected from the first filtering order and the second filtering order. For example, the filtering order with the smallest first filtering cost between the first filtering order and the second filtering order is determined as the target filtering order.
[0267] As can be seen from the above, this embodiment of the present application does not consider the training order of the chroma components of the neural network filter when determining the target filtering order of the chroma components of the current image block. In other words, regardless of the training order of the chroma components of the neural network filter, the encoder determines the target filtering order of the chroma components of the current chroma block according to the above steps.
[0268] The embodiments of the present application do not limit the training method and related training parameters of the neural network filter.
[0269] In some embodiments, the neural network filter is trained using at least one CTU as a training unit. That is, at least one CTU of a training image is divided into a training unit and input into the neural network filter to train the neural network filter.
[0270] In some embodiments, the neural network filter is trained using a preset image region as a training unit. That is, the preset image region of the training image is divided into a training unit and input into the neural network filter to train the neural network filter. The description of the preset image region can be found in the description of the preset image region above and is not repeated here.
[0271] In some embodiments, the training order of the chrominance components of the neural network filter is any one of N training orders. Optionally, the N training orders and the N filtering orders may be the same or different, or partially the same and partially different.
[0272] In some embodiments, the above-mentioned N training sequences include a first training sequence and a second training sequence, wherein the first training sequence is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, and the second training sequence is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter.
[0273] In one example, during the training process, the chrominance training order of the neural network filter is the first training order, for example, the U component and the V component are input in sequence, and the filtering results of the U component and the V component are constrained by the corresponding loss function to achieve the training of the neural network filter. When the trained neural network filter is used to filter the first chrominance component and the second chrominance component of the current image block, the target filtering order of the first chrominance component and the second chrominance component is determined. Specifically, as shown in Figure 15A, the encoding end inputs the U component and the V component of the current image block into the neural network filter NNLF for filtering according to the first filtering order, for example, the filtering order of the U component first and the V component last, and outputs the filtered value of the U component of the current image block and the filtered value of the V component. Then, based on the filtered value of the U component and the filtered value of the V component of the current image block under the first filtering order, and the original image block of the current image block, the first filtering cost 1 corresponding to the first filtering order is determined. Similarly, as shown in FIG15A , the encoder inputs the U and V components of the current image block into the neural network filter NNLF for filtering according to the second filtering order, for example, the filtering order in which the V component comes first and the U component comes last, and outputs the filtered value of the U component and the filtered value of the V component of the current image block. Next, based on the filtered value of the U component and the filtered value of the V component of the current image block under the second filtering order, as well as the original image block of the current image block, the first filtering cost 2 corresponding to the second filtering order is determined. Finally, based on the first filtering costs corresponding to the first filtering order and the second filtering order, respectively, the target filtering order of the chrominance components of the current image block is determined from the first filtering order and the second filtering order.
[0274] In another example, during the training process, the chrominance training order of the neural network filter is the first training order, for example, the V component and the U component are input in sequence, and the filtering results of the V component and the U component are constrained by the corresponding loss function to achieve the training of the neural network filter. When the trained neural network filter is used to filter the first chrominance component and the second chrominance component of the current image block, the target filtering order of the first chrominance component and the second chrominance component is determined. Specifically, as shown in Figure 15B, the encoding end inputs the U component and the V component of the current image block into the neural network filter NNLF for filtering according to the first filtering order, for example, the filtering order of the U component first and the V component last, and outputs the filtered value of the U component of the current image block and the filtered value of the V component. Then, based on the filtered value of the U component and the filtered value of the V component of the current image block under the first filtering order, and the original image block of the current image block, the first filtering cost 1 corresponding to the first filtering order is determined. Similarly, as shown in FIG15B , the encoding end inputs the U and V components of the current image block into the neural network filter NNLF for filtering according to the second filtering order, for example, the filtering order in which the V component comes first and the U component comes last, and outputs the filtered value of the U component and the filtered value of the V component of the current image block. Next, based on the filtered value of the U component and the filtered value of the V component of the current image block under the second filtering order, as well as the original image block of the current image block, the first filtering cost 2 corresponding to the second filtering order is determined. Finally, based on the first filtering costs corresponding to the first filtering order and the second filtering order, respectively, the target filtering order of the chrominance components of the current image block is determined from the first filtering order and the second filtering order.
[0275] From the above, it can be seen that the target filtering order determination process of the embodiment of the present application is independent of the chrominance training order of the neural network filter, thereby improving the selection flexibility and accuracy of the target filtering training.
[0276] It should be noted that the above description of the process for determining a target filtering order uses the example of N filtering orders including a first filtering order and a second filtering order. If the N filtering orders also include other filtering orders, such as those shown in Table 2 above, the same method as for the first and second filtering orders is used to determine the first filter costs of the surrounding coded regions under these other filtering orders. In this way, the first filter cost corresponding to each of the N filtering orders can be determined, and then, based on the first filter cost corresponding to each filtering order, the target filtering order can be determined from the N filtering orders.
[0277] In some embodiments, after determining the target filtering order based on the above steps, the encoder writes first information into the bitstream, where the first information indicates the target filtering order. In this way, the decoder obtains the first information by decoding the bitstream and further obtains the target filtering order based on the first information.
[0278] The embodiment of the present application does not limit the specific form of expression of the first information, as long as it is any syntax field that can indicate the target filtering order.
[0279] In some embodiments, the first information includes a first flag, and the target filtering order is indicated by different values of the first flag.
[0280] Exemplarily, the correspondence between the value of the first flag and the filtering order of the chrominance component is shown in Table 1.
[0281] In this first approach, the encoder can determine the value of the first flag corresponding to the target filtering order based on Table 1, then set the first flag to that value and write it into the bitstream. The decoder then decodes the bitstream to obtain the first flag, and then, based on the value of the first flag, obtains the target filtering order for the first and second chroma components of the current image block by consulting Table 1.
[0282] In addition to using the method described in the above-mentioned method 1 to determine the target filtering order, the encoding end can also use the following method 2 to determine the target filtering order.
[0283] In the second method, the encoder determines the target filtering order by itself. In this case, determining the target filtering order of the first chroma component and the second chroma component of the current image block in S202 includes the following steps S202-B1 to S202-B3:
[0284] S202-B1, determining a filtered area around the current image block;
[0285] S202-B2, for an i-th filtering order among N filtering orders, inputting the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the i-th filtering order, and determining an i-th second filtering cost of the surrounding filtered area under the i-th filtering order, where i is a positive integer less than or equal to N;
[0286] S202-B3: Determine a target filtering order from the N filtering orders based on the second filtering costs corresponding to the N filtering orders.
[0287] In the second approach, the encoder determines a target filtering order from N filtering orders based on the filtered area surrounding the current image block.
[0288] The embodiment of the present application does not limit the size and shape of the filtered area around the current image block.
[0289] In some embodiments, the filtered area around the current image block is a filtered area around the current image block that is adjacent to the current image block.
[0290] In some embodiments, as shown in FIG9 , the filtered area around the current image block includes an upper filtered area and a left filtered area of the current image block.
[0291] In some embodiments, the filtered area surrounding the current image block includes a template area of the current image.
[0292] After the encoder determines the filtered area surrounding the current image block in the current image, it executes the above-mentioned step S202-B2, inputs the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to each of the N filtering orders, determines the filtering cost corresponding to each of the N filtering orders, and records the filtering cost as the second filtering cost. In this embodiment, the specific process of the encoder determining the second filtering cost corresponding to each of the N filtering orders is basically the same, and the i-th filtering order among the N filtering orders is used as an example for explanation. That is, according to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering, and the i-th second filtering cost of the surrounding filtered area under the i-th filtering order is determined.
[0293] The embodiment of the present application does not limit the specific method of determining the i-th second filtering cost of the surrounding filtered area under the i-th filtering order.
[0294] In one possible implementation, the encoding end inputs the first chroma component and the second chroma component of the surrounding filtered area into a neural network filter for filtering according to the i-th filtering order, and obtains the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order, and the filtered value of the second chroma component under the i-th filtering order. Then, based on the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order, and the filtered value of the second chroma component under the i-th filtering order, the second filtering cost corresponding to the i-th filtering order is determined. For example, the second filtering cost includes a computational cost, and the encoding end determines the computational cost when filtering the first chroma component and the second chroma component of the surrounding filtered area through the neural network filter in the i-th filtering order, and then determines the second filtering cost corresponding to the i-th filtering order based on the computational cost.
[0295] In a possible implementation, the above S202-B2 includes the following steps S202-B21 and S202-B22:
[0296] S202-B21, according to the i-th filtering order, input the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering, to obtain the i-th filtered value of the surrounding filtered area;
[0297] S202-B22, determine the i-th second filtering cost based on the i-th filtered value and the surrounding filtered area
[0298] In this implementation, the encoding end inputs the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the i-th filtering order, and obtains the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order, and the filtered value of the second chroma component under the i-th filtering order. For the sake of convenience of description, the filtered value of the first chroma component of the surrounding filtered area under the i-th filtering order and the filtered value of the second chroma component under the i-th filtering order are recorded as the i-th filtered value of the surrounding filtered area.
[0299] Next, based on the i-th filtered value and the surrounding filtered area, a second filtering cost corresponding to the i-th filtering order is determined.
[0300] For example, if the second filtering cost includes a distortion cost, the encoding end determines the second filtering cost corresponding to the i-th filtering order based on the filtered value of the first chrominance component of the surrounding filtered area and the first chrominance component of the surrounding filtered area, as well as the filtered value of the second chrominance component of the surrounding filtered area and the second chrominance component of the surrounding filtered area under the i-th filtering order.
[0301] The embodiment of the present application does not limit the specific calculation method of the above-mentioned second filtering cost. For example, the above-mentioned second filtering cost can be a rate-distortion cost (RDO) or an approximate cost, such as SSD, STAD or SAD.
[0302] For another example, the second filtering cost includes a computational cost and a distortion cost. The encoding end determines the distortion cost corresponding to the i-th filtering order based on the filtered value of the first chroma component of the surrounding filtered area and the first chroma component of the surrounding filtered area, as well as the filtered value of the second chroma component of the surrounding filtered area and the second chroma component of the surrounding filtered area under the i-th filtering order. At the same time, the computational cost of filtering the first chroma component and the second chroma component of the surrounding filtered area by the neural network filter in the i-th filtering order is determined. In this way, the second filtering cost corresponding to the i-th filtering order is determined based on the distortion cost and computational cost corresponding to the i-th filtering order. For example, the sum or weighted sum of the distortion cost and computational cost corresponding to the i-th filtering order is determined as the second filtering cost corresponding to the i-th filtering order.
[0303] Based on the above steps, the encoder can determine the second filter cost of each of the N filtering orders for the filtered area surrounding the current image block. Furthermore, based on the second filter costs corresponding to the N filtering orders, the encoder can determine the target filtering order from among the N filtering orders.
[0304] The embodiment of the present application does not limit the specific method of determining the target filtering order from the N filtering orders based on the second filtering costs corresponding to the N filtering orders at the encoding end.
[0305] For example, a filtering order with the smallest second filtering cost among N filtering orders is determined as the target filtering order.
[0306] For another example, any filtering order among the N filtering orders whose second filtering cost is less than a preset value is determined as the target filtering order.
[0307] After the encoder determines the target filtering order of the first chroma component and the second chroma component of the current image block based on the above steps, it performs the following step S203.
[0308] S203 : Based on the target filtering order, input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering to obtain a chroma filter block of the current image block.
[0309] Based on the above steps, the encoding end determines the target filtering order of the first chroma component and the second chroma component of the current image block, and then inputs the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the target filtering order to obtain a filtered image block of the current image block.
[0310] In one example, as shown in FIG12A , if the target filtering order is such that the first chroma component precedes the second chroma component, the first chroma component and the second chroma component of the current image block are concatenated, with the first chroma component being positioned before the second chroma component during the concatenation. Subsequently, the concatenated first and second chroma components are input into a neural network filter for filtering, thereby obtaining filtered values of the first and second chroma components of the current image block. The filtered values of the first and second chroma components of the current image block constitute the chroma filter block of the current image block.
[0311] In one example, as shown in FIG12B , if the target filtering order is such that the second chroma component precedes the first chroma component, the first chroma component and the second chroma component of the current image block are concatenated, with the first chroma component being positioned after the second chroma component during the concatenation. Subsequently, the concatenated first and second chroma components are input into a neural network filter for filtering, thereby obtaining filtered values of the first and second chroma components of the current image block. The filtered values of the first and second chroma components of the current image block constitute the chroma filter block of the current image block.
[0312] The above describes the filtering process of the current image block in the reconstructed image. The filtering process of other image blocks to be filtered in the reconstructed image can refer to the filtering process of the current image block, and finally a filtered reconstructed image is obtained.
[0313] In some embodiments, the neural network filter described above is used as a loop filter, where the output of the neural network filter affects video encoding. For example, the encoding end uses the neural network filter to filter the reconstructed image of the current image using the method described above, obtaining a filtered reconstructed image. This filtered reconstructed image is then stored in the encoding cache as the encoded image for subsequent image filtering. Because the embodiments of the present application provide for accurate determination of the filtering order, thereby improving the filtering quality of the reconstructed image, subsequent encoding based on the higher-quality reconstructed image can improve the video encoding effect.
[0314] In some embodiments, the above-mentioned neural network filter is used for post-processing, that is, filtering optimization is performed on the decoded video, and the output of the neural network filter does not affect the video encoding.
[0315] In some embodiments, the image filtering method proposed in the embodiments of the present application, in addition to being applied in the field of video or image coding, can also be used in conventional image filtering. For example, for the current image block in the image to be filtered, the target filtering order of the first chroma component and the second chroma component of the current image block is determined, and the target filtering order is determined based on the filtering costs of N filtering orders, where N is a positive integer greater than 1; based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the chroma filter block of the current image block.
[0316] In the image filtering method provided by the embodiment of the present application, when encoding the current image, the encoding end first encodes the current image to obtain a reconstructed image of the current image; for the current image block to be filtered in the reconstructed image, the target filtering order of the first chroma component and the second chroma component of the current image block is determined, and the target filtering order is determined based on the filtering costs of N kinds of filtering orders, where N is a positive integer greater than 1; based on the target filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the chroma filter block of the current image block. In other words, the embodiment of the present application determines the target filtering order based on the filtering costs of N kinds of filtering orders, thereby improving the accuracy of selecting the target filtering order. When the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering based on the accurately determined target filtering order, the filtering effect can be improved, thereby improving the generalization of the neural network filter and improving the encoding performance.
[0317] The preferred embodiments of the present application are described in detail above in conjunction with the accompanying drawings. However, the present application is not limited to the specific details in the above embodiments. Within the technical concept of the present application, a variety of simple modifications can be made to the technical solution of the present application, and these simple modifications all fall within the scope of protection of the present application. For example, the various specific technical features described in the above specific embodiments can be combined in any suitable manner unless there is any contradiction. In order to avoid unnecessary repetition, the present application will not further explain various possible combinations. For another example, the various different embodiments of the present application can also be arbitrarily combined, and as long as they do not violate the ideas of the present application, they should also be regarded as the contents disclosed in the present application.
[0318] It should also be understood that in the various method embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0319] The above describes in detail the method embodiment of the present application in conjunction with Figures 7 to 15B, and the following describes in detail the device embodiment of the present application in conjunction with Figures 16 to 17.
[0320] FIG16 is a schematic block diagram of an image filtering device provided in an embodiment of the present application.
[0321] As shown in FIG10 , the image filtering device 10 may include:
[0322] The decoding unit 11 is configured to decode a code stream of a current image to obtain a residual value of the current image, and determine a reconstructed image of the current image based on the residual value;
[0323] an order determining unit 12, configured to determine, for a current image block to be filtered in the reconstructed image, a target filtering order for a first chroma component and a second chroma component of the current image block, wherein the target filtering order is determined by a decoded bitstream or based on filtering costs of N filtering orders, where N is a positive integer greater than 1;
[0324] The filtering unit 13 is configured to input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering based on the target filtering order to obtain a chroma filter block of the current image block.
[0325] In some embodiments, the order determination unit 12 is specifically configured to decode the code stream to obtain first information, where the first information is used to indicate the target filtering order; and obtain the target filtering order based on the first information.
[0326] In some embodiments, the filtering cost includes a first filtering cost, and the target filtering order is determined based on the first filtering cost of each of the N filtering orders. The first filtering cost of the filtering order is the filtering cost determined when the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering according to the filtering order.
[0327] In some embodiments, the target filtering order is a filtering order having the smallest first filtering cost among the N filtering orders.
[0328] In some embodiments, the filtering cost includes a second filtering cost, and the order determination unit 12 is specifically used to determine the surrounding filtered area of the current image block; for the i-th filtering order among the N filtering orders, according to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering, and the i-th second filtering cost of the surrounding filtered area under the i-th filtering order is determined, where i is a positive integer less than or equal to N; based on the second filtering costs corresponding to the N filtering orders, the target filtering order is determined from the N filtering orders.
[0329] In some embodiments, the sequence determination unit 12 is specifically used to input the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the i-th filtering order to obtain the i-th filtered value of the surrounding filtered area; based on the i-th filtered value and the surrounding filtered area, determine the i-th second filtering cost.
[0330] In some embodiments, the order determination unit 12 is specifically configured to determine a filtering order with the smallest second filtering cost among the N filtering orders as the target filtering order.
[0331] In some embodiments, the N filtering orders include a first filtering order and a second filtering order, wherein the first filtering order is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, and the second filtering order is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter.
[0332] In some embodiments, the current image block is at least one CTU of the reconstructed image, or the current image block is a preset image area of the reconstructed image.
[0333] In some embodiments, the neural network filter is trained using at least one CTU as a training unit, or the neural network filter is trained using a preset image area as a training unit.
[0334] In some embodiments, the training order of the chrominance components of the neural network filter is any one of N training orders.
[0335] In some embodiments, the N training sequences include a first training sequence and a second training sequence, wherein the first training sequence is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, and the second training sequence is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter.
[0336] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions can refer to the method embodiment. To avoid repetition, they are not described here in detail. Specifically, the device shown in Figure 16 can execute the method embodiment shown in Figure 7 above, and the aforementioned and other operations and / or functions of each module in the device are respectively for implementing the corresponding method embodiment of the decoder. For the sake of brevity, they are not described here in detail.
[0337] FIG17 is a schematic block diagram of an image filtering device provided in an embodiment of the present application.
[0338] As shown in FIG17 , the image filtering device 20 may include:
[0339] The encoding unit 21 is configured to encode the current image to obtain a reconstructed image of the current image;
[0340] an order determining unit 22, configured to determine, for a current image block to be filtered in the reconstructed image, a target filtering order for a first chroma component and a second chroma component of the current image block, wherein the target filtering order is determined based on filtering costs of N filtering orders, where N is a positive integer greater than 1;
[0341] The filtering unit 23 is configured to input the first chroma component and the second chroma component of the current image block into a neural network filter for filtering based on the target filtering order to obtain a filtered image block of the current image block.
[0342] In some embodiments, the order determination unit 22 is specifically used to input the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the j-th filtering order among the N filtering orders, and determine the j-th first filtering cost of the current image block under the j-th filtering order, where j is a positive integer less than or equal to N; based on the first filtering costs corresponding to the N filtering orders, the target filtering order is determined from the N filtering orders.
[0343] In some embodiments, the order determination unit 22 is specifically used to input the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the j-th filtering order to obtain the j-th filtered image block of the current image block; and determine the j-th first filtering cost based on the j-th filtered image block and the original image block of the current image block.
[0344] In some embodiments, the order determination unit 22 is specifically configured to determine a filtering order with the smallest first filtering cost among the N filtering orders as the target filtering order.
[0345] In some embodiments, the encoding unit 21 is further configured to write first information into the bitstream, where the first information is used to indicate the target filtering order.
[0346] In some embodiments, the order determination unit 22 is specifically used to determine the surrounding filtered area of the current image block; for the i-th filtering order among the N filtering orders, according to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering, and the i-th second filtering cost of the surrounding filtered area under the i-th filtering order is determined, where i is a positive integer less than or equal to N; based on the second filtering costs corresponding to the N filtering orders, the target filtering order is determined from the N filtering orders.
[0347] In some embodiments, the sequence determination unit 22 is specifically used to input the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the i-th filtering order to obtain the i-th filtered value of the surrounding filtered area; based on the i-th filtered value and the surrounding filtered area, determine the i-th second filtering cost.
[0348] In some embodiments, the order determination unit 22 is specifically configured to determine a filtering order with the smallest second filtering cost among the N filtering orders as the target filtering order.
[0349] In some embodiments, the N filtering orders include a first filtering order and a second filtering order, wherein the first filtering order is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, and the second filtering order is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter.
[0350] In some embodiments, the current image block is at least one CTU of the reconstructed image, or the current image block is a preset image area of the reconstructed image.
[0351] In some embodiments, the neural network filter is trained using at least one CTU as a training unit, or the neural network filter is trained using a preset image area as a training unit.
[0352] In some embodiments, the training order of the chrominance components of the neural network filter is any one of N training orders.
[0353] In some embodiments, the N training sequences include a first training sequence and a second training sequence, wherein the first training sequence is that the first chroma component is in front and the second chroma component is in the back of the input of the neural network filter, and the second training sequence is that the second chroma component is in front and the first chroma component is in the back of the input of the neural network filter.
[0354] It should be understood that the device embodiment and the method embodiment may correspond to each other, and similar descriptions can refer to the method embodiment. To avoid repetition, they are not described here. Specifically, the device shown in Figure 17 can perform the above-mentioned method embodiment, and the aforementioned and other operations and / or functions of each module in the device are respectively for implementing the method embodiment corresponding to the encoder. For the sake of brevity, they are not described here.
[0355] The apparatus of the embodiment of the present application is described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that the functional module can be implemented in hardware form, can be implemented by instructions in software form, or can be implemented by a combination of hardware and software modules. Specifically, the steps of the method embodiment in the embodiment of the present application can be completed by the hardware integrated logic circuit and / or software form instructions in the processor, and the steps of the method disclosed in the embodiment of the present application can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps in the above method embodiment in conjunction with its hardware.
[0356] FIG18 is a schematic block diagram of an electronic device provided in an embodiment of the present application. The electronic device in FIG18 may be the encoder or the decoder described above.
[0357] As shown in FIG18 , the electronic device 30 may include:
[0358] The memory 31 and the processor 32 are configured to store a computer program 33 and transmit the program code 33 to the processor 32. In other words, the processor 32 can call and run the computer program 33 from the memory 31 to implement the method in the embodiment of the present application.
[0359] For example, the processor 32 may be configured to execute the steps of the method 200 according to the instructions in the computer program 33 .
[0360] In some embodiments of the present application, the processor 32 may include but is not limited to:
[0361] General-purpose processor, Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, etc.
[0362] In some embodiments of the present application, the memory 31 includes but is not limited to:
[0363] Volatile memory and / or non-volatile memory. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct RAM bus random access memory (DR RAM).
[0364] In some embodiments of the present application, the computer program 33 may be divided into one or more modules, which are stored in the memory 31 and executed by the processor 32 to implement the method for recording a page provided by the present application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program 33 in the electronic device 900.
[0365] As shown in FIG18 , the electronic device 30 may further include:
[0366] The transceiver 34 may be connected to the processor 32 or the memory 31 .
[0367] The processor 32 may control the transceiver 34 to communicate with other devices. Specifically, the processor 32 may send information or data to other devices or receive information or data sent by other devices. The transceiver 34 may include a transmitter and a receiver. The transceiver 34 may further include one or more antennas.
[0368] It should be understood that the various components in the electronic device 30 are connected via a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus and a status signal bus.
[0369] According to one aspect of the present application, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a computer, the computer is enabled to perform the method of the above-mentioned method embodiment. Alternatively, the present application also provides a computer program product containing instructions. When the computer is executed by the instructions, the computer is enabled to perform the method of the above-mentioned method embodiment.
[0370] According to another aspect of the present application, a computer program product or computer program is provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method of the above-described method embodiment.
[0371] In other words, when implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0372] Those skilled in the art will appreciate that the modules and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0373] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0374] Modules described as separate components may or may not be physically separate, and components displayed as modules may or may not be physical modules, i.e., they may be located in one place or distributed across multiple network elements. Some or all of the modules may be selected to implement the present embodiment according to actual needs. For example, the functional modules in the various embodiments of the present application may be integrated into a single processing module, each module may exist physically separately, or two or more modules may be integrated into a single module.
[0375] The above content is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of the present application. Therefore, the scope of protection of the present application should be based on the scope of protection of the claims.
Claims
1. An image filtering method, characterized in that: Applied to a decoding device, the method comprises: Decoding a code stream of a current image to obtain a residual value of the current image, and determining a reconstructed image of the current image based on the residual value; For a current image block to be filtered in the reconstructed image, determining a target filtering order of a first chrominance component and a second chrominance component of the current image block, wherein the target filtering order is determined by decoding the bitstream or based on filtering costs of N filtering orders, where N is a positive integer greater than 1; Based on the target filtering order, the first chrominance component and the second chrominance component of the current image block are input into a neural network filter for filtering to obtain a chrominance filter block of the current image block.
2. The method according to claim 1, characterized in that: Determining a target filtering order of the first chrominance component and the second chrominance component of the current image block comprises: Decoding the bitstream to obtain first information, where the first information is used to indicate the target filtering order; Based on the first information, the target filtering order is obtained.
3. The method according to claim 1 or 2, characterized in that: The filtering cost includes a first filtering cost, the target filtering order is determined based on the first filtering cost of each filtering order in the N filtering orders, and the first filtering cost of the filtering order is a filtering cost determined when the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering according to the filtering order; The target filtering order is a filtering order having the smallest first filtering cost among the N filtering orders.
4. The method according to claim 1, characterized in that: The filtering cost includes a second filtering cost, and determining a target filtering order of the first chrominance component and the second chrominance component of the current image block includes: Determining a filtered area around the current image block; For an i-th filtering order among the N filtering orders, according to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering, and an i-th second filtering cost of the surrounding filtered area under the i-th filtering order is determined, where i is a positive integer less than or equal to N; The target filtering order is determined from the N filtering orders based on the second filtering costs respectively corresponding to the N filtering orders.
5. The method according to claim 4, characterized in that The step of inputting the first chroma component and the second chroma component of the surrounding filtered area into the neural network filter for filtering according to the i-th filtering order, and determining the i-th second filtering cost of the surrounding filtered area under the i-th filtering order comprises: According to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering to obtain the i-th filtered value of the surrounding filtered area; The i-th second filtering cost is determined based on the i-th filtered value and the surrounding filtered area.
6. The method according to claim 4 or 5, characterized in that: The determining the target filtering order from the N filtering orders based on the second filtering costs respectively corresponding to the N filtering orders includes: A filtering order with the smallest second filtering cost among the N filtering orders is determined as the target filtering order.
7. The method according to any one of claims 1 to 6, characterized in that: The N filtering orders include a first filtering order and a second filtering order, wherein the first filtering order is that the first chroma component is in front and the second chroma component is in the back in the input of the neural network filter, and the second filtering order is that the second chroma component is in front and the first chroma component is in the back in the input of the neural network filter.
8. The method according to any one of claims 1 to 7, characterized in that: The current image block is at least one CTU of the reconstructed image, or the current image block is a preset image area of the reconstructed image.
9. The method according to any one of claims 1 to 8, characterized in that: The neural network filter is trained using at least one CTU as a training unit, or the neural network filter is trained using a preset image area as a training unit.
10. The method according to any one of claims 1 to 9, characterized in that: The training order of the chrominance components of the neural network filter is any one of N training orders.
11. The method according to claim 10, characterized in that The N training sequences include a first training sequence and a second training sequence, wherein the first training sequence is that the first chrominance component is in front and the second chrominance component is in the back of the input of the neural network filter, and the second training sequence is that the second chrominance component is in front and the first chrominance component is in the back of the input of the neural network filter.
12. An image filtering method, characterized in that: Applicable to encoding equipment, including: Encoding a current image to obtain a reconstructed image of the current image; For a current image block to be filtered in the reconstructed image, determining a target filtering order of a first chrominance component and a second chrominance component of the current image block, wherein the target filtering order is determined based on filtering costs of N filtering orders, where N is a positive integer greater than 1; Based on the target filtering order, the first chrominance component and the second chrominance component of the current image block are input into a neural network filter for filtering to obtain a filtered image block of the current image block.
13. The method according to claim 12, characterized in that Determining a target filtering order of the first chrominance component and the second chrominance component of the current image block comprises: For a j-th filtering order among the N filtering orders, according to the j-th filtering order, input the first chroma component and the second chroma component of the current image block into the neural network filter for filtering, and determine a j-th first filtering cost of the current image block under the j-th filtering order, where j is a positive integer less than or equal to N; The target filtering order is determined from the N filtering orders based on the first filtering costs respectively corresponding to the N filtering orders.
14. The method according to claim 13, characterized in that The step of inputting the first chroma component and the second chroma component of the current image block into the neural network filter for filtering according to the j-th filtering order, and determining the j-th first filtering cost of the current image block under the j-th filtering order comprises: According to the j-th filtering order, the first chroma component and the second chroma component of the current image block are input into the neural network filter for filtering to obtain the j-th filtered image block of the current image block; Determining the j-th first filtering cost based on the j-th filtered image block and the original image block of the current image block; The determining the target filtering order from the N filtering orders based on the first filtering costs respectively corresponding to the N filtering orders includes: A filtering order with the smallest first filtering cost among the N filtering orders is determined as the target filtering order.
15. The method according to claim 13 or 14, characterized in that The method further comprises: The first information is written into the bitstream, where the first information is used to indicate the target filtering order.
16. The method according to claim 12, characterized in that Determining a target filtering order of the first chrominance component and the second chrominance component of the current image block comprises: Determining a filtered area around the current image block; For an i-th filtering order among the N filtering orders, according to the i-th filtering order, the first chroma component and the second chroma component of the surrounding filtered area are input into the neural network filter for filtering, and an i-th second filtering cost of the surrounding filtered area under the i-th filtering order is determined, where i is a positive integer less than or equal to N; The target filtering order is determined from the N filtering orders based on the second filtering costs respectively corresponding to the N filtering orders.
17. An image filtering device, characterized in that: Applicable to decoding equipment, including: A decoding unit, configured to decode a code stream of a current image to obtain a residual value of the current image, and determine a reconstructed image of the current image based on the residual value; an order determining unit, configured to determine, for a current image block to be filtered in the reconstructed image, a target filtering order of a first chrominance component and a second chrominance component of the current image block, wherein the target filtering order is determined by decoding the bitstream or based on filtering costs of N filtering orders, where N is a positive integer greater than 1; The filtering unit is used to input the first chrominance component and the second chrominance component of the current image block into a neural network filter for filtering based on the target filtering order to obtain a chrominance filter block of the current image block.
18. An image filtering device, characterized in that: Applicable to encoding equipment, including: An encoding unit, used for encoding a current image to obtain a reconstructed image of the current image; an order determining unit, configured to determine, for a current image block to be filtered in the reconstructed image, a target filtering order of a first chrominance component and a second chrominance component of the current image block, wherein the target filtering order is determined based on filtering costs of N filtering orders, where N is a positive integer greater than 1; The filtering unit is used to input the first chrominance component and the second chrominance component of the current image block into a neural network filter for filtering based on the target filtering order to obtain a filtered image block of the current image block.
19. An electronic device comprising a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the computer program to implement the method according to any one of claims 1 to 11 or 12 to 16.
20. A computer-readable storage medium, characterized in that: For storing computer programs; The computer program causes a processor to execute the method as claimed in any one of claims 1 to 11 or 12 to 16 above.
21. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the method according to any one of claims 1 to 11 or 12 to 16.
Citation Information
Patent Citations
Loop filtering implementation method and device and computer storage medium
CN113747179A
Image coding method, image decoding method, coder and decoder
CN114025164A
Image encoding method, decoding method and device
CN114125446A
Image filtering method and device, equipment and storage medium
CN116405701A
Method and apparatus for filtering with multi-branch deep learning
US20200244997A1
Cited By
Image filtering method and device, equipment and storage medium
CN116405701A
