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

By selecting or skipping the second filter in the adaptive loop filter and determining the filter using fixed values ​​and the adaptive parameter set APS, the problem of poor output image quality of the adaptive loop filter is solved, and the encoding and decoding performance is improved.

WO2026007114A1PCT designated stage Publication Date: 2026-01-08GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/103956
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2024-07-05
Publication Date
2026-01-08

AI Technical Summary

Technical Problem

In existing technologies, when the adaptive loop filter filters the reconstructed image, it cannot guarantee that the output image of the first filter is not better than the output image of the second filter in certain scenarios, resulting in insufficient encoding and decoding performance.

Method used

An encoding and decoding method is provided that allows the selection or skipping of a second filter in an adaptive loop filter, thereby improving the filtering effect by using a first filter determined by a fixed value and a second filter determined based on an adaptive parameter set APS.

Benefits of technology

By selecting an appropriate filtering mode, the filtering effect of the adaptive loop filter is improved, thereby enhancing the encoding and decoding performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024103956_08012026_PF_FP_ABST
    Figure CN2024103956_08012026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are an encoding method, a decoding method, an encoder, a decoder, and a storage medium. The decoding method comprises: determining a filtering mode for a first reconstructed image from among a plurality of filtering modes, wherein the plurality of filtering modes at least comprise a first filtering mode and a second filtering mode, the first filtering mode involves the first reconstructed image skipping a second filter after being filtered by a first filter, and the second filtering mode involves the first reconstructed image being filtered on the basis of the second filter after being filtered by the first filter; and on the basis of the filtering mode for the first reconstructed image, performing adaptive loop filtering on the first reconstructed image to determine a second reconstructed image, wherein a filtering coefficient of the first filter is determined on the basis of a fixed value, and a filtering coefficient of the second filter is determined on the basis of an adaptation parameter set (APS).
Need to check novelty before this filing date? Find Prior Art

Description

Coding method, coder and storage medium TECHNICAL FIELD

[0001] The present application relates to the technical field of video coding, and particularly relates to a coding method, a coder and a storage medium. BACKGROUND

[0002] In a video coding framework, an adaptive loop filter (ALF) is a filter designed to minimize the mean square error between a reconstructed image and an original image. How to improve the filtering effect of the adaptive loop filter to improve the coding performance is a problem to be solved.

[0003] SUMMARY

[0004] The present application provides a coding method, a coder and a storage medium. Each aspect involved in the present application is introduced below.

[0005] In a first aspect, a decoding method is provided, which is applied to a decoder, and the decoding method comprises: determining a filtering mode of a first reconstructed image from a plurality of filtering modes, the plurality of filtering modes at least comprising a first filtering mode and a second filtering mode, the first filtering mode being that the first reconstructed image is filtered by a first filter and then skips a second filter, and the second filtering mode being that the first reconstructed image is filtered by the first filter and then is filtered based on the second filter again; performing adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image to determine a second reconstructed image; wherein filtering coefficients of the first filter are determined based on a fixed value, and filtering coefficients of the second filter are determined based on an adaptation parameter set (APS).

[0006] In a second aspect, a decoding method is provided, which is applied to a decoder, and the decoding method comprises: parsing first identification information, the first identification information being used to indicate whether a first reconstructed image uses a second filter for filtering; if the first identification information indicates that the first reconstructed image does not use the second filter for filtering, filtering the first reconstructed image according to a first filter to determine a second reconstructed image; wherein filtering coefficients of the first filter are determined based on a fixed value, and filtering coefficients of the second filter are determined based on an adaptation parameter set (APS).

[0007] In a third aspect, an encoding method is provided, which is applied to an encoder, and the encoding method comprises: determining a filter mode of a first reconstructed image from a plurality of filter modes, the plurality of filter modes at least comprising a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image is filtered by a first filter and then skips a second filter, and the second filter mode being that the first reconstructed image is filtered by the first filter and then is filtered again based on the second filter; and performing adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0008] In a fourth aspect, an encoding method is provided, which is applied to an encoder, and the encoding method comprises: determining a filter used by a first reconstructed image according to a first filter and a second filter; and performing filtering on the first reconstructed image according to the first filter to determine a second reconstructed image if the first reconstructed image does not use the second filter for filtering; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0009] In a fifth aspect, a decoder is provided, which comprises: a first determining unit configured to determine a filter mode of a first reconstructed image from a plurality of filter modes, the plurality of filter modes at least comprising a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image is filtered by a first filter and then skips a second filter, and the second filter mode being that the first reconstructed image is filtered by the first filter and then is filtered again based on the second filter; and a second determining unit configured to perform adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0010] In a sixth aspect, a decoder is provided, which comprises: a parsing unit configured to parse first identification information, the first identification information being used to indicate whether a first reconstructed image uses a second filter for filtering; and a determining unit configured to perform filtering on the first reconstructed image according to a first filter to determine a second reconstructed image if the first identification information indicates that the first reconstructed image does not use the second filter for filtering; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0011] In a seventh aspect, a decoder is provided, which comprises: a memory configured to store a computer program; and a processor configured to execute the method of the first aspect or the second aspect when the computer program is run.

[0012] In an eighth aspect, an encoder is provided, comprising: a first determining unit configured to determine a filter mode for a first reconstructed image from a plurality of filter modes, the plurality of filter modes comprising at least a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image is filtered by a first filter and then a second filter is skipped, the second filter mode being that the first reconstructed image is filtered by the first filter and then filtered by the second filter based on a current image or a previous image of the current image; a second determining unit configured to perform an adaptive loop filter on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on the current image or the previous image of the current image.

[0013] In a ninth aspect, an encoder is provided, comprising: a first determining unit configured to determine a filter used by a first reconstructed image according to a first filter and a second filter; a second determining unit configured to filter the first reconstructed image according to the first filter to determine a second reconstructed image if the first reconstructed image is not filtered by the second filter; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0014] In a tenth aspect, an encoder is provided, comprising: a memory configured to store a computer program; and a processor configured to execute the computer program to perform the method of the third aspect or the fourth aspect.

[0015] In an eleventh aspect, a computer readable storage medium is provided, wherein the computer readable storage medium stores a computer program, and the computer program is executed to implement the method of the first aspect, the second aspect, the third aspect, or the fourth aspect.

[0016] In a twelfth aspect, a computer program product is provided, comprising a computer program, and the computer program is executed to implement the method of the first aspect, the second aspect, the third aspect, or the fourth aspect.

[0017] In a thirteenth aspect, a non-volatile computer readable storage medium storing a bitstream is provided, the bitstream is generated by using an encoding method of an encoder, or the bitstream is decoded by using a decoding method of a decoder, wherein the decoding method is the method of the first aspect or the second aspect, and the encoding method is the method of the third aspect or the fourth aspect.

[0018] In a fourteenth aspect, a computer readable storage medium is provided, and the computer readable storage medium stores a bitstream generated according to the method of the third aspect or the fourth aspect.

[0019] In the related art, when filtering a reconstructed image, the adaptive loop filter filters based on two filters (i.e., the first filter and the second filter mentioned above), and the output image of the adaptive loop filter can only be the output image of the second filter. However, in some scenarios, the output image of the first filter can be better than the output image of the second filter.

[0020] In the embodiments of the present application, the image output by the first filter can be used as the output image of the adaptive loop filter, or the image output by the second filter can be used as the output image of the adaptive loop filter, thereby helping to improve the filtering effect of the adaptive loop filter and further improving the coding performance. BRIEF DESCRIPTION OF DRAWINGS

[0021] FIG. 1 is a schematic diagram of a structure of a video encoder to which embodiments of the present application can be applied.

[0022] FIG. 2 is a schematic diagram of a structure of a video decoder to which embodiments of the present application can be applied.

[0023] FIG. 3 is a schematic diagram of a loop filter module to which embodiments of the present application can be applied.

[0024] FIG. 4 is a schematic diagram of a chroma filter.

[0025] FIG. 5 is a flowchart of a decoding method provided by an embodiment of the present application.

[0026] FIG. 6 is a flowchart of a decoding method provided by another embodiment of the present application.

[0027] FIG. 7 is a flowchart of an encoding method provided by an embodiment of the present application.

[0028] FIG. 8 is a flowchart of an encoding method provided by another embodiment of the present application.

[0029] FIG. 9 is a schematic diagram of a structure of a decoder provided by an embodiment of the present application.

[0030] FIG. 10 is a schematic diagram of a structure of a decoder provided by another embodiment of the present application.

[0031] FIG. 11 is a schematic diagram of a structure of a decoder provided by another embodiment of the present application.

[0032] FIG. 12 is a schematic diagram of a structure of an encoder provided by an embodiment of the present application.

[0033] FIG. 13 is a schematic diagram of a structure of an encoder provided by another embodiment of the present application.

[0034] FIG. 14 is a schematic diagram of a structure of an encoder provided by another embodiment of the present application. DETAILED DESCRIPTION

[0035] The technical solutions in the present application will be described below with reference to the drawings.

[0036] FIG. 1 is a schematic block diagram of a video encoder according to an embodiment of the present application.

[0037] It should be understood that the video encoder 100 can be used for lossy compression of images, and can also be used for lossless compression of images. The lossless compression can be visually lossless compression or mathematically lossless compression.

[0038] The video encoder 100 can be applied to image data in YCbCr (YUV) format. For example, the YUV ratio can be 4:2:0, 4:2:2 or 4:4:4, Y represents luminance (Luma), Cb (U) represents blue chrominance, and Cr (V) represents red chrominance. U and V are used to describe color and saturation as chrominance (Chroma). For example, in the color format, 4:2:0 means that there are 4 luminance components and 2 chrominance components (YYYYCbCr) for every 4 samples, 4:2:2 means that there are 4 luminance components and 4 chrominance components (YYYYCbCrCbCr) for every 4 samples, and 4:4:4 means full sample display (YYYYCbCrCbCrCbCrCbCr).

[0039] For example, the video encoder 100 reads video data, and divides each image in the video data into a plurality of coding tree units (CTUs). In some examples, a CTU can be referred to as a “tree block”, a “largest coding unit” (LCU) or a “coding tree block” (CTB). Each CTU can be associated with a block of samples of equal size within the image. Each sample can correspond to a luminance (luma) sample and two chrominance (chroma) samples. Thus, each CTU can be associated with a block of luminance samples and two blocks of chrominance samples. A CTU size can be, for example, 128x128, 64x64, 32x32, etc. A CTU can be further divided into coding units (CUs) for encoding. A CU can be a rectangular block or a square block. A CU can correspond to a prediction block and a transform unit (TU).

[0040] A video encoder and a video decoder can support various prediction block sizes. Assuming that the size of a particular CU is 2Nx2N, the video encoder and the video decoder can support a prediction block size of 2Nx2N or NxN for intra prediction, and support symmetric prediction blocks of 2Nx2N, 2NxN, Nx2N, NxN, or similar sizes for inter prediction. The video encoder and the video decoder can also support asymmetric prediction blocks of 2NxnU, 2NxnD, nLx2N, and nRx2N for inter prediction.

[0041] In some embodiments, as shown in FIG. 1, the video encoder 100 can include a prediction module 110, a residual module 120, a transform / quantization module 130, an inverse transform / quantization module 140, a reconstruction module 150, a loop filtering module 160, a decoded picture buffer 170, and an entropy encoding module 180. It is noted that the video encoder 100 can include more, less, or different functional components.

[0042] Optionally, in this application, the current block can be referred to as a current coding unit (CU). The prediction block can also be referred to as a predicted image block or an image predicted block, and the reconstructed image block can also be referred to as a reconstructed block or an image reconstructed block. Due to the need for parallel processing, an image can be divided into slices. Slices in the same image can be processed in parallel, that is, there is no data dependency between them. While "frame" is a commonly used term, it can generally be understood as a frame being an image. In this article, the frame can also be replaced by image or slice, etc.

[0043] In some embodiments, the prediction module 110 includes an inter prediction module 111 and an intra prediction module 112. Due to the strong correlation between adjacent samples in a video, the method of using intra prediction in video coding technology eliminates the spatial redundancy between adjacent samples. Due to the strong similarity between adjacent images in a video, the method of using inter prediction in video coding technology eliminates the temporal redundancy between adjacent images, thereby improving the coding efficiency.

[0044] The inter prediction module 111 can be configured to perform inter prediction, which can include motion estimation and motion compensation, and can refer to image information of different pictures, and find a reference block from a reference picture according to the motion information, and generate a prediction block according to the reference block, for removing temporal redundancy. The inter prediction uses the motion information to find a reference block from a reference picture, and generates a prediction block according to the reference block. The motion information includes a reference picture list in which the reference picture is located, a reference picture index, and a motion vector. The motion vector can be integral sample or sub-sample, if the motion vector is sub-sample, interpolation filtering needs to be used in the reference picture to obtain the required sub-sample block, and the integral sample or sub-sample block in the reference picture found according to the motion vector is called a reference block. Some technologies directly use the reference block as the prediction block, and some technologies generate the prediction block by processing the reference block. Generating the prediction block by processing the reference block can also be understood as using the reference block as the prediction block and then processing the prediction block to generate a new prediction block.

[0045] The intra prediction module 112 only refers to the information of the same picture to predict the sample information in the current coding picture block, for removing spatial redundancy.

[0046] There are multiple intra prediction modes. For example, the H.264 / AVC standard has 8 angular prediction modes and 1 non-angular prediction mode, and the H.265 / HEVC has 33 angular prediction modes and 2 non-angular prediction modes. The intra prediction modes used by the high efficiency video coding (HEVC) include a planar mode, a direct current (DC) mode and 33 angular modes, and a total of 35 prediction modes. The intra prediction modes used by the versatile video coding (VVC) include a planar mode, a DC mode and 65 angular modes, and a total of 67 prediction modes.

[0047] It should be noted that with the increase of the angular modes, the intra prediction will be more accurate, and more in line with the needs of the development of high-definition and ultra-high-definition digital video.

[0048] The residual module 120 can generate a residual block of a CU based on a sample block of the CU and a prediction block of the CU. For example, the residual module 120 can generate a residual block of a CU such that each sample in the residual block has a value equal to a difference between a sample in the sample block of the CU and a corresponding sample in the prediction block of the CU.

[0049] The transform / quantization module 130 can quantize the transform coefficients. The transform / quantization module 130 can quantize the transform coefficients associated with a CU based on a quantization parameter (QP) value associated with the CU. Video encoder 100 can adjust the degree of quantization applied to the transform coefficients associated with a CU by adjusting the QP value associated with the CU.

[0050] The inverse transform / quantization module 140 can apply inverse quantization and inverse transform to the quantized transform coefficients, respectively, to reconstruct the residual block from the quantized transform coefficients.

[0051] The reconstruction module 150 can add samples of the reconstructed residual block to corresponding samples of one or more prediction blocks generated by the prediction module 110 to produce a reconstructed image block associated with the CU. By reconstructing each sample block of the CU in this way, video encoder 100 can reconstruct the sample blocks of the CU.

[0052] The loop filtering module 160 is configured to process the samples after inverse transform and inverse quantization to remove distortion information and provide a better reference for subsequent encoding samples. For example, the loop filtering module 160 can perform a deblocking filtering operation to reduce blocking artifacts associated with the sample blocks of the CU.

[0053] In some embodiments, the loop filtering module 160 includes a deblocking filtering module configured to remove blocking artifacts and a sample adaptive offset / adaptive loop filtering module configured to remove ringing artifacts.

[0054] The decoded picture buffer 170 can store the reconstructed sample blocks. The inter prediction module 111 can use reference pictures containing reconstructed sample blocks to perform inter prediction for prediction blocks of other pictures. In addition, the intra prediction module 112 can use reconstructed sample blocks in the decoded picture buffer 170 to perform intra prediction for other prediction blocks in the same picture as the CU.

[0055] The entropy encoding module 180 can receive the quantized transform coefficients from the transform / quantization module 130. The entropy encoding module 180 can perform one or more entropy encoding operations on the quantized transform coefficients to produce entropy encoded data.

[0056] FIG. 2 is a schematic block diagram of a video decoder according to an embodiment of the present application.

[0057] As shown in FIG. 2, the video decoder 200 includes an entropy decoding module 210, a prediction module 220, an inverse quantization / transform module 230, a reconstruction module 240, a loop filtering module 250, and a decoded picture buffer 260. It is noted that the video decoder 200 can include more, less, or different functional components.

[0058] Video decoder 200 can receive a bitstream. Entropy decoding module 210 can parse the bitstream to extract syntax elements from the bitstream. As part of parsing the bitstream, entropy decoding module 210 can parse entropy encoded syntax elements in the bitstream. Prediction module 220, inverse quantization / transform module 230, reconstruction module 240, and loop filtering module 250 can decode video data according to the syntax elements extracted from the bitstream, i.e., produce decoded video data.

[0059] In some embodiments, prediction module 220 includes an intra prediction module 222 and an inter prediction module 221.

[0060] Intra prediction module 222 can perform intra prediction to generate a prediction block. Intra prediction module 222 can use an intra prediction mode to generate the prediction block based on spatially neighboring sample blocks. Intra prediction module 222 can also determine the intra prediction mode according to one or more syntax elements parsed from the bitstream.

[0061] Inter prediction module 221 can construct a first reference picture list (List 0) and a second reference picture list (List 1) according to syntax elements parsed from the bitstream. In addition, if the prediction block is coded using inter prediction, entropy decoding module 210 can parse motion information for the prediction block. Inter prediction module 221 can determine one or more reference blocks for the prediction block according to the motion information for the prediction block. Inter prediction module 221 can generate the prediction block according to the one or more reference blocks for the prediction block.

[0062] Inverse quantization / transform module 230 can inverse quantize (i.e., de-quantize) transform coefficients associated with a TU. Inverse quantization / transform module 230 can determine a degree of quantization using a QP value associated with a CU of the TU.

[0063] After inverse quantizing the transform coefficients, inverse quantization / transform module 230 can apply one or more inverse transforms to the inverse quantized transform coefficients in order to produce a residual block associated with the TU.

[0064] Reconstruction module 240 uses the residual block associated with a TU of a CU and the prediction block for the prediction block of the CU to reconstruct a sample block of the CU. For example, reconstruction module 240 can add samples of the residual block to corresponding samples of the prediction block to reconstruct the sample block of the CU, resulting in a reconstructed image block.

[0065] Loop filtering module 250 can perform a deblocking filtering operation to reduce blocking artifacts of the sample block associated with the CU.

[0066] Video decoder 200 can store the reconstructed image of the CU in decoded picture buffer 260. Video decoder 200 can use the reconstructed image in decoded picture buffer 260 as reference pictures for subsequent predictions, or transmit the reconstructed image to a display device for presentation.

[0067] The basic process of video coding is as follows: at the encoding end, an image is divided into blocks, and for a current block, the prediction module 110 uses intra prediction or inter prediction to generate a prediction block of the current block. The residual module 120 can calculate a residual block based on the prediction block and the original block of the current block, i.e., the difference between the prediction block and the original block of the current block, which can also be referred to as residual information. The residual block can be processed by the transform / quantization module 130 to remove information that is not sensitive to the human eye, such as visual redundancy, through processes such as transformation and quantization. Optionally, the residual block before being processed by the transform / quantization module 130 can be referred to as a time-domain residual block, and the residual block after being processed by the transform / quantization module 130 can be referred to as a frequency-domain residual block or a frequency-domain residual block. The entropy encoding module 180 receives the quantized transform coefficients output by the transform / quantization module 130 and entropy encodes the quantized transform coefficients to output a bitstream. For example, the entropy encoding module 180 can eliminate character redundancy based on a target context model and probability information of a binary code stream.

[0068] At the decoding end, the entropy decoding module 210 can parse the bitstream to obtain the prediction information, the quantized coefficient matrix, etc. of the current block, and the prediction module 220 uses intra prediction or inter prediction based on the prediction information to generate a prediction block of the current block. The inverse quantization / transformation module 230 uses the quantized coefficient matrix obtained from the bitstream to perform inverse quantization and inverse transformation on the quantized coefficient matrix to obtain a residual block. The reconstruction module 240 adds the prediction block and the residual block to obtain a reconstructed block. The reconstructed block constitutes a reconstructed image, and the loop filtering module 250 performs loop filtering on the reconstructed image based on the image or based on the block to obtain a decoded image. The encoding end also needs to perform similar operations to obtain a decoded image. The decoded image can also be referred to as a reconstructed image, and the reconstructed image can be used as a reference image for subsequent image inter prediction.

[0069] It should be noted that the block division information determined by the encoding end, as well as the prediction, transformation, quantization, entropy encoding, loop filtering, and other mode information or parameter information, etc. are carried in the bitstream when necessary. The decoding end determines the same block division information, prediction, transformation, quantization, entropy encoding, loop filtering, and other mode information or parameter information by analyzing the bitstream and based on the existing information, so as to ensure that the decoded image obtained by the encoding end is the same as the decoded image obtained by the decoding end.

[0070] The above is the basic process of a video encoder and decoder under a block-based hybrid coding framework. With the development of technology, some modules or steps of the framework or process can be optimized. The present application is applicable to the basic process of a video encoder and decoder under the block-based hybrid coding framework, but is not limited to the framework and process.

[0071] In the foregoing introduction, the loop filter module performs loop filtering on the reconstructed image based on an image or based on a block to obtain a filtered reconstructed image. As shown in FIG. 3, the loop filter module 300 can include a luma mapping with chroma scaling (LMCS) 310, a deblocking filter (DBF) 320, a sample adaptive offset (SAO) 330, an adaptive loop filter (ALF) 340, and a cross component adaptive loop filter (CCALF) 350, and the like. The adaptive loop filter will be described in detail below.

[0072] The ALF includes a luma ALF and a chroma ALF. The luma ALF is designed to minimize the mean square error (MSE) between a luma reconstructed image and an original image using luma information, and the chroma ALF is designed to minimize the mean square error between a chroma reconstructed image and an original image using chroma information. For the chroma component, the related art filters the reconstructed image based on a first filter (e.g., a fixed filter) first, and then filters the reconstructed image based on a second filter (e.g., a filter in the APS). Note that the filter coefficients of the fixed filter are fixed values. The filtering process will be described below.

[0073] First, the variance information and the gradient information are calculated for a 2x2 chroma block. Then, the directionality, the activity, and the scaled variance of each block are calculated based on the gradient information and the variance information. Next, the category of the 2x2 chroma block is calculated based on the calculated directionality, the activity, and the scaled variance. The corresponding first filter is selected based on the category to filter the chroma samples, and the filtered results are sent to the second filter as the filtering input. The second filter can use 8 filters, each corresponding to one of the 8 categories.

[0074] The filter coefficient set of ALF contains a fixed subset and an APS subset. The fixed subset is a filter coefficient subset obtained by pre-training, and the fixed subset does not need to be transmitted; the APS subset is a filter coefficient subset generated by using the Wiener filtering principle according to the current reconstructed image at the encoding end. The APS subset needs to be transmitted from the encoding end to the decoding end through APS. At the encoding end, ALF classifies each coding tree unit (CTU) (all samples in a CTU belong to the same category), and respectively accumulates the covariance matrix and the error vector of the samples in the same category; then, a Wiener-Hopf equation is constructed, and the filter coefficient of ALF is calculated by solving the equation. Each CTU selects the filter corresponding to the category for filtering, and writes the filtered result into the reconstructed image. The second filter is described in more detail below.

[0075] The shape of the second filter is shown in FIG. 4. In FIG. 4, x in the left figure represents the sample position corresponding to the chroma sample to be filtered, and the numbers represent adjacent chroma samples. The numbers in the right figure also represent adjacent chroma samples. The difference between the left figure and the right figure is that the left figure inputs the reconstructed information of the chroma sample, and the right figure inputs the output of the first filter. As can be seen from FIG. 4, the second filter needs to input 25 values, which correspond to 25 filter coefficients according to their positions in the filter. In FIG. 4, 0, 1, 2, …, 25, x represent the indices of the filter coefficients. It should be noted that the coefficient at x is generally not calculated and is set to 0 by default.

[0076] In the encoder, the second filter classifies the CTU, and the classification process uses rate-distortion optimization (RDO) to make a decision. When the cost calculated by using a filter of a certain category for the CTU is the minimum, the category of the CTU is the category of the filter. Each sample in the CTU belongs to the same category. Of course, if the cost of not filtering a CTU is less than the cost of using a filter, the CTU is not filtered, and the CTU has no category. Whether a CTU is filtered and the corresponding category information are both written into the code stream and transmitted to the decoding end.

[0077] After the category of each CTU is determined, the covariance matrix and the error vector of all samples in the same category are respectively accumulated. For each sample, its covariance matrix A is a 25x25 square matrix. Let each element of matrix A be a i,j , i, j ∈ [0, 1, 2, …, 24], and for a i,j , the value is: i,j = R(i) x R(j) (1-1)

[0078] R(i) = R(i) + R(i) * E(i) (1-2) ′ = R(i) + R(i) * E(i) (1-2)

[0079] where recC(*) denotes the reconstructed value of the chroma sample output by the previous stage (SAO), fixedFilterC(*) denotes the sample value output by the corresponding chroma fixed filter. x corresponds to the position of x in the filter shape, and i is the sample at the non-x position. K(*) denotes the clipping function, and cv(i) is the corresponding clipping value. It should be noted here that since the filter is symmetrically designed, there are two positions i, and the R(i) ′ sum is R(i).

[0080] For the error vector B, it is a 25x1 vector. Let each element in the vector B be b i , where i ∈ [0, 1, 2, …, 24], and for b i , the value is: b i = R(i) * E (1-3)

[0081] For E, there is: E = orgC - recC (1-4)

[0082] where recC is the reconstructed sample value of the sample to be filtered, and orgC represents the original sample value of the sample to be filtered.

[0083] After obtaining the covariance matrix A and the error vector B of each sample, the covariance matrix and the error vector of the same category of samples in a frame of image are summed up respectively to construct the Wiener-Hopf equation Ac = B. Where A is the sum of the covariance matrices of the same category of samples, and B is the sum of the error vectors of the same category of samples. The coefficient c of this category needs to be solved, where c is a 25x1 vector.

[0084] It should be noted that the filter coefficients solved by the equation are all floating point types. Since the value range of floating point type is almost not limited, a lot of bits are needed to encode the coefficients. In order to solve this problem, the encoder performs integerization on the filter coefficients. First, the filter coefficients are scaled: c i = int(scale * c i ) (1-5)

[0085] where c i is the filter coefficient solved by the Wiener-Hopf equation, scale is the scale factor, which is set to a fixed value of 7 in ECM, and c i is the scaled integerized value.

[0086] After obtaining the integerized filter coefficient c iAfter that, the samples need to be filtered next. The filtering process is as follows:

[0087] where recC ′ is the filtered coefficient. recC,c i , recC(i), recC(x), fixedFilterC(i), scale are explained above and will not be repeated here. It should be noted that, since the filter is symmetrically designed, there are two positions i, and their calculation results will also be added. After filtering the samples that need to be filtered, they are written into the reconstructed image. For samples that do not need to be filtered, they are directly written into the reconstructed image.

[0088] In the related art, when the adaptive loop filter filters the reconstructed image, it filters based on two filters (i.e., the first filter and the second filter mentioned above), and the output image of the adaptive loop filter can only be the output image of the second filter. However, in some scenarios, the output image of the first filter can be better than the output image of the second filter. The filtering manner in the related art cannot guarantee the filtering effect of the reconstructed image. Therefore, how to improve the filtering effect of the adaptive loop filter to improve the coding performance is a problem to be solved.

[0089] To solve the above problem, the embodiments of the present application provide two encoding methods. One of the encoding methods comprises: determining a filtering mode of a first reconstructed image from a plurality of filtering modes, the plurality of filtering modes at least comprising a first filtering mode and a second filtering mode, the first filtering mode being that the first reconstructed image skips a second filter after being filtered by a first filter, and the second filtering mode being that the first reconstructed image is filtered based on the second filter again after being filtered by the first filter; and performing adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image to determine a second reconstructed image; wherein filtering coefficients of the first filter are determined based on a fixed value, and filtering coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0090] The other encoding method comprises: determining a filter used by a first reconstructed image according to a first filter and a second filter; and if the first reconstructed image does not use the second filter for filtering, filtering the first reconstructed image according to the first filter to determine a second reconstructed image; wherein filtering coefficients of the first filter are determined based on a fixed value, and filtering coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0091] Further, the embodiments of the present application also provide two decoding methods. One of the decoding methods comprises: determining a filter mode of a first reconstructed image from a plurality of filter modes, wherein the plurality of filter modes at least comprise a first filter mode and a second filter mode, the first filter mode is that the first reconstructed image is filtered by a first filter and then skips a second filter, and the second filter mode is that the first reconstructed image is filtered by the first filter and then is filtered based on the second filter again; and performing adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0092] The other decoding method comprises: parsing first identification information, wherein the first identification information is used to indicate whether a first reconstructed image is filtered by a second filter; and if the first identification information indicates that the first reconstructed image is not filtered by the second filter, filtering the first reconstructed image according to a first filter to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0093] In the embodiments of the present application, the image output by the first filter can be used as the output image of the adaptive loop filter, or the image output by the second filter can be used as the output image of the adaptive loop filter, thereby helping to improve the filtering effect of the adaptive loop filter and further improving the coding and decoding performance.

[0094] The decoding method of the embodiments of the present application will be described in detail below in combination with FIG. 5.

[0095] FIG. 5 is a flowchart of a decoding method provided by the embodiments of the present application. The method of FIG. 5 can be applied to a decoder.

[0096] Referring to FIG. 5, in step S510, a filter mode of a first reconstructed image is determined from a plurality of filter modes. The first reconstructed image can be a reconstructed image that is filtered by a deblocking filter and / or a sample adaptive offset filter.

[0097] The first reconstructed image herein can be a chroma reconstructed image of a U component, a chroma reconstructed image of a V component, or a luma reconstructed image.

[0098] The plurality of filter modes mentioned above can include a first filter mode and a second filter mode. In the first filter mode, the first reconstructed image is filtered by the first filter and then skips the second filter, or in other words, in the first filter mode, the first reconstructed image is filtered based on the first filter only; in the second filter mode, the first reconstructed image is filtered by the first filter and then filtered based on the second filter.

[0099] The first filter and the second filter in the above are two different types of filters. The filter coefficients of the first filter here are determined based on fixed values. Exemplarily, the first filter is a fixed filter, and the filter coefficients of the second filter can be filter coefficients in an APS.

[0100] The manner of determining the filter mode of the first reconstructed image from the plurality of filter modes can be various. For example, the coding side can determine the filter mode of the first reconstructed image according to the same predefined rule. In some implementations, the filter mode of the first reconstructed image can be determined based on information in a bitstream.

[0101] In some implementations, the manner of determining the filter mode of the first reconstructed image from the plurality of filter modes can include parsing a bitstream to determine a first parameter. The first parameter is used to indicate the filter mode of the first reconstructed image from the plurality of filter modes.

[0102] The first parameter here can have various representations. For example, the first parameter can be identification information used only to represent the filter mode. For another example, the first parameter can also multiplex parameter information in a bitstream to represent the filter mode.

[0103] Exemplarily, the value of the first parameter can include a first value and a second value, where the first value is used to indicate that the filter mode of the first reconstructed image is the first filter mode, and the second value is used to indicate that the filter mode of the first reconstructed image is the second filter mode.

[0104] If the value of the first parameter is the first value, it is determined that the filter mode of the first reconstructed image is the first filter mode; if the value of the first parameter is the second value, it is determined that the filter mode of the first reconstructed image is the second filter mode.

[0105] The first parameter can be any combination of numbers and / or letters. The first parameter can have multiple values, each of which represents a different filter mode. For example, the first parameter can be represented as sh alf cb fixed filter only flag (with values of 0 or 1), which represents the filter mode of the chroma reconstructed image of the U component. If the first parameter has a value of 0, the chroma reconstructed image of the U component is filtered based on the second filter mode; if the first parameter has a value of 1, the chroma reconstructed image of the U component is filtered based on the first filter mode. For another example, the first parameter can be represented as sh alf cr fixed filter only flag (with values of 0 or 1), which represents the filter mode of the chroma reconstructed image of the V component. If the first parameter has a value of 0, the chroma reconstructed image of the V component is filtered based on the second filter mode; if the first parameter has a value of 1, the chroma reconstructed image of the V component is filtered based on the first filter mode.

[0106] Exemplarily, the first parameter can be identification information of an adaptive parameter set (APS), or the first parameter can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information herein is multiplexed parameter information. For example, the first parameter can have a first preset value. If the first parameter has the first preset value, the filter mode of the first reconstructed image is the first filter mode; or if the first parameter does not have the first preset value, the filter mode of the first reconstructed image is the second filter mode. The first preset value can also be used to indicate other information, such as type information or serial number information, in addition to the multiple filter modes.

[0107] Exemplarily, if the first parameter is an APS ID (identifier), the first preset value can also be used to indicate the filter coefficients used by the first reconstructed image. Assuming that the first preset value has a value of 8, if the APS ID has a value of 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficients in the APS, and indicating that the filter mode of the reconstructed image is the first filter mode; if the APS ID has a value of 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficients in the second APS, and indicating that the filter mode of the reconstructed image is the second filter mode.

[0108] Exemplarily, the first parameter is CTU-level filter index information such as syntax element alf_ctb_filter_alt_idx, assuming that the first preset value includes values 0 to 7, if the value of alf_ctb_filter_alt_idx is 1, it indicates that the index value of the filter of the CTU level is 1, and indicates that the filter mode of the reconstructed image of the CTU level is the first filter mode; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the filter of the CTU level is 8, and the filter mode of the reconstructed image of the CTU level is the second filter mode.

[0109] The number of times of filtering of the first filter is not specifically limited in the embodiments of the present application, and the first reconstructed image can be filtered once or multiple times based on the first filter.

[0110] In the case where the first reconstructed image is filtered multiple times based on the first filter, a specific number of times of filtering can be set for the first filter. For example, the number of times of filtering of the first filter is 2. Alternatively, multiple numbers of times of filtering can also be set for the first filter. For example, the number of times of filtering of the first filter can have 3 choices, which are 2, 3 and 4. In the case where the first filter includes multiple numbers of times of filtering, when filtering the first reconstructed image, a suitable number of times of filtering can be selected from the multiple numbers of times of filtering for filtering, which helps to improve the filtering effect of the first filter, and further helps to improve the decoding performance.

[0111] In some implementations, a threshold value can be set for the number of times of filtering of the first filter. The same threshold value of the number of times of filtering can be shared by different chroma components when being filtered based on the first filter, or different threshold values of the number of times of filtering can be respectively set. For example, when the first reconstructed image is a chroma reconstructed image of a U component, the maximum number of times of filtering based on the first filter is a first threshold value; when the first reconstructed image is a chroma reconstructed image of a V component, the maximum number of times of filtering based on the first filter is a second threshold value.

[0112] The number of times of filtering of the first filter can be determined based on information in a code stream. In some implementations, the second parameter can be determined by parsing the code stream. The second parameter is used to indicate the first number of times of filtering from multiple numbers of times of filtering, or the second parameter is used to indicate the first number of times of filtering. The first number of times of filtering can also be understood as a suitable number of times of filtering.

[0113] The second parameter can be any combination of numbers and / or letters. The second parameter can have multiple values, each of which represents a filtering time. For example, the second parameter can be represented as sh_alf_cb_fixed_filter_time_idx (with values of 0 or 1), which represents the filtering time when the first filter is used to filter the chroma reconstructed image of the U component. If the second parameter has a value of 0, it means that the filtering time is 1; if the second parameter has a value of 1, it means that the filtering time is 2. For another example, the second parameter can be represented as sh_alf_cr_fixed_filter_time_idx (with values of 0 or 1), which represents the filtering time when the first filter is used to filter the chroma reconstructed image of the V component. If the second parameter has a value of 0, it means that the filtering time is 1; if the second parameter has a value of 1, it means that the filtering time is 2.

[0114] In addition to determining the appropriate filtering time in the above, it is also necessary to determine the filter set corresponding to the appropriate filtering time in the multiple filter sets. The filter set is used to determine the first filter. For example, the first filter class corresponding to the first reconstructed image can be determined first, and then the first filter is determined according to the first filter class and the first filter set.

[0115] In some implementations, the third parameter can be determined by parsing the code stream. The third parameter is used to indicate the first filter set, which includes the first filter, or the third parameter is used to indicate at least one filter, which includes the first filter.

[0116] The third parameter here can have multiple representations. For example, the third parameter can be identification information only used to represent the filter set. For another example, the third parameter can also be used to represent the filter set by multiplexing the parameter information in the code stream.

[0117] Exemplarily, the third parameter can be a combination of any number and / or letter. The third parameter can have multiple values, each of which represents a different filter set. For example, the third parameter can be represented as sh_alf_cb_fixed_filter_type_idx (with values of 0 or 1), indicating the filter set used when the chroma reconstructed image of the U component is filtered based on the first filter. If the third parameter has a value of 0, it indicates that the filter set 0 is used for filtering; if the third parameter has a value of 1, it indicates that the filter set 1 is used for filtering. For another example, the third parameter can be represented as sh_alf_cr_fixed_filter_type_idx (with values of 0 or 1), indicating the filter set used when the chroma reconstructed image of the V component is filtered based on the first filter. If the third parameter has a value of 0, it indicates that the filter set 0 is used for filtering; if the third parameter has a value of 1, it indicates that the filter set 1 is used for filtering.

[0118] Exemplarily, the third parameter can be identification information of an adaptive parameter set (APS), or the third parameter can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information is multiplexed parameter information. For example, the third parameter can have a second preset value. If the third parameter has the second preset value, the filter set of the first reconstructed image is the first filter set. The second preset value can also be used to indicate other information in addition to the multiple filter modes, such as type information or serial number information.

[0119] Exemplarily, the third parameter is an APS ID (identifier), and it is assumed that the second preset value has a value of 8. If the APS ID has a value of 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficients in the APS, and indicating that the filter set used by the reconstructed image is the first filter set. If the APS ID has a value of 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficients in the second APS, and indicating that the filter set used by the reconstructed image is the second filter set.

[0120] Exemplarily, the third parameter is CTU-level filter index information, such as the syntax element alf_ctb_filter_alt_idx. It is assumed that the second preset value has a value of 3. If the alf_ctb_filter_alt_idx has a value of 3, it indicates that the index value of the CTU-level filter is 3, and indicates that the filter set used by the reconstructed image is the first filter set. If the alf_ctb_filter_alt_idx has a value of 8, it indicates that the index value of the CTU-level filter is 8, and indicates that the filter set used by the reconstructed image is the second filter set.

[0121] It should be understood that the chroma reconstructed image of the U component and the chroma reconstructed image of the V component can share the above three parameters, or two different parameter combinations can be set for the two chroma components respectively.

[0122] The information used by the first reconstructed image when filtered based on the first filter is described above. Next, information that can be used by the first reconstructed image when filtered based on the second filter is introduced.

[0123] In some implementations, if the filtering mode of the first reconstructed image is the second filtering mode, the fourth parameter can be determined by parsing the code stream. The fourth parameter can include one or more of the following information: the number of groups of the second filter, the ordering information of the second filter, and the filter coefficients of the second filter.

[0124] The first filter and the second filter are two different types of filters. The first filter can be determined based on a first filter category and / or a quantization parameter. The first filter category can be used to determine the first filter from one or more filter sets. For example, the first filter can be determined according to the first filter category and a first filter set.

[0125] The first filter category can be determined based on variance information and / or gradient information of the first reconstructed image. For example, the variance information and the gradient information can be calculated based on a 2x2 chroma block in the first reconstructed image; then, the directionality, activity, and scaled variance of each block are calculated according to the gradient and variance information; and then, the first filter category of the 2x2 chroma block is calculated according to the directionality, activity, and scaled variance.

[0126] Exemplarily, the first filter can be a fixed filter, and the corresponding filter coefficient is a fixed value, which can be a filter coefficient in a fixed subset.

[0127] The second filter can be determined based on a second filter category. The second filter category is used to determine the second filter from a second filter set. The second filter set here can include, for example, 8 filters corresponding to 8 filter categories.

[0128] Exemplarily, the filter coefficients of the second filter can be filter coefficients in an APS subset.

[0129] In step S520, the first reconstructed image is adaptively loop filtered according to the filtering mode of the first reconstructed image to determine a second reconstructed image.

[0130] In some implementations, before step S520 is performed, the decoding method shown in FIG. 5 can further include: parsing the code stream to determine a fifth parameter. The fifth parameter can be used to indicate whether to perform adaptive loop filtering. If the fifth parameter indicates to perform adaptive loop filtering, the first reconstructed image is adaptively loop filtered according to the filtering mode of the first reconstructed image; if the fifth parameter indicates not to perform adaptive loop filtering, the first reconstructed image skips adaptive loop filtering.

[0131] In the embodiments of the present application, the image output by the first filter can be used as the output image of the adaptive loop filter, or the image output by the second filter can be used as the output image of the adaptive loop filter, thereby helping to improve the filtering effect of the adaptive loop filter and further improving the coding and decoding performance. It should be noted that, compared with the luminance reconstructed image, the embodiments of the present application are more suitable for the chrominance reconstructed image in the adaptive loop filtering process.

[0132] The first reconstructed image is not specifically limited in the embodiments of the present application. The first reconstructed image includes one of the following: the first reconstructed image is a current image; or, the first reconstructed image is a slice of the current image; or, the first reconstructed image is a CTU of the current image; or, the first reconstructed image is all CTUs belonging to the second filter category in the current image.

[0133] In the foregoing, the information that can be used by the first reconstructed image in the filtering process (such as the first parameter, the second parameter, and the third parameter) is mentioned. If the image level of the first reconstructed image changes, the indication range of the above information will also change.

[0134] For example, assuming that the first reconstructed image is all CTUs corresponding to the same filter category in the current image, the indication range of the first parameter, the second parameter, and the third parameter is: the first parameter is used to indicate the filtering mode of all CTUs corresponding to the same filter category in the current image; the second parameter is used to indicate the filtering times of all CTUs corresponding to the same filter category in the current image based on the first filter; and the third parameter is used to indicate the filter set used when all CTUs corresponding to the same filter category in the current image are filtered based on the first filter.

[0135] The above three parameters can be set as a Mx1 vector, indicating the indication information of all CTUs corresponding to M filter categories. For example, M can be 8, indicating all CTUs corresponding to 8 filter categories.

[0136] For example, if the first reconstructed picture is a CTU of the current picture, the first parameter, the second parameter, and the third parameter are used to indicate the following: the first parameter is used to indicate the filter mode of the CTU of the current picture; the second parameter is used to indicate the number of times of filtering the CTU of the current picture based on the first filter; and the third parameter is used to indicate the filter set used when filtering the CTU of the current picture based on the first filter.

[0137] The three parameters can be set as a N*1 vector, which indicates the indication information of N CTUs.

[0138] FIG. 6 is a flow diagram of a decoding method according to an embodiment of the present disclosure. The method of FIG. 6 can be applied to a decoder.

[0139] In step S610, the first identification information is parsed. The first identification information is used to indicate whether the first reconstructed picture is filtered by the second filter. The filters available to the first reconstructed picture also include the first filter, and the first filter and / or the second filter herein can be filters in an adaptive loop filter.

[0140] The first reconstructed picture can be a reconstructed picture after deblocking filtering and / or sample adaptive offset filtering. The first reconstructed picture can be a chroma reconstructed picture of a U component, a chroma reconstructed picture of a V component, or a luma reconstructed picture.

[0141] The first filter and the second filter are two different types of filters. The filter coefficients of the first filter are determined based on fixed values. For example, the first filter is a fixed filter, and the filter coefficients of the second filter can be filter coefficients in an APS.

[0142] The filters used by the first reconstructed picture can include only the first filter, or can include the first filter and the second filter.

[0143] The first identification information herein can have multiple representations. For example, the first identification information can be identification information used only to indicate whether the second filter is used for filtering. For another example, the first identification information can also multiplex parameter information in a bitstream to indicate whether the second filter is used for filtering.

[0144] For example, the first identification information can have a first value and a second value, where the first value is used to indicate that the first reconstructed picture is not filtered by the second filter, and the second value is used to indicate that the first reconstructed picture is filtered by the second filter.

[0145] The first identification information can be any combination of numbers and / or letters. For example, the first identification information can be represented as sh alf cb fixed filter only flag (with a value of 0 or 1), indicating whether the chroma reconstructed image of the U component is filtered using the second filter. If the value of the first identification information is 0, it indicates that the chroma reconstructed image of the U component is filtered using the second filter; if the value of the first identification information is 1, it indicates that the chroma reconstructed image of the U component is not filtered using the second filter. For another example, the first identification information can be represented as sh alf cr fixed filter only flag (with a value of 0 or 1), indicating whether the chroma reconstructed image of the V component is filtered using the second filter. If the value of the first identification information is 0, it indicates that the chroma reconstructed image of the V component is filtered using the second filter; if the value of the first identification information is 1, it indicates that the chroma reconstructed image of the V component is not filtered using the second filter.

[0146] Exemplarily, the first identification information can be identification information of an adaptive parameter set (APS), or the first identification information can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information herein is multiplexed parameter information. For example, the value of the first identification information can include a first preset value. If the value of the first identification information is the first preset value, the first reconstructed image is not filtered using the second filter; or if the value of the first identification information is not the first preset value, the first reconstructed image is filtered using the second filter. The first preset value can also be used to indicate other information in addition to the plurality of filter modes, such as type information or serial number information.

[0147] Exemplarily, if the first identification information is an APS ID (identifier), the first preset value can also be used to indicate the filter coefficient used by the first reconstructed image. Assuming that the value of the first preset value is 8, if the value of the APS ID is 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficient in the APS, and indicating that the reconstructed image is not filtered using the second filter; if the value of the APS ID is 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficient in the 2nd APS, and indicating that the reconstructed image is filtered using the second filter.

[0148] Exemplarily, the first identification information is CTU-level filter index information, such as syntax element alf_ctb_filter_alt_idx, assuming that the first preset value includes values 0 to 7, if the value of alf_ctb_filter_alt_idx is 1, it indicates that the index value of the CTU-level filter is 1, and indicates that the reconstructed image of the CTU level does not use the second filter for filtering; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the CTU-level filter is 8, and the reconstructed image of the CTU level uses the second filter for filtering.

[0149] In step S620, if the first identification information indicates that the first reconstructed image does not use the second filter for filtering, the first reconstructed image is filtered according to the first filter to determine the second reconstructed image.

[0150] In some implementations, if the first identification information indicates that the first reconstructed image uses the second filter for filtering, the first reconstructed image is filtered according to the first filter and the second filter to determine the third reconstructed image.

[0151] For example, the first reconstructed image is first filtered based on the first filter, and then filtered based on the second filter to determine the third reconstructed image.

[0152] In the embodiments of the present application, the image output by the first filter can be used as the output image of the adaptive loop filter, or the image output by the second filter can be used as the output image of the adaptive loop filter, which helps to improve the filtering effect of the adaptive loop filter, and further improves the coding performance. However, it should be noted that compared with the luminance reconstructed image, the embodiments of the present application are more suitable for the chrominance reconstructed image in the adaptive loop filtering process.

[0153] The number of times of filtering of the first filter is not specifically limited in the embodiments of the application. The first reconstructed image can be filtered once or multiple times based on the first filter.

[0154] In the case where the first reconstructed image is filtered multiple times based on the first filter, a specific number of times of filtering can be set for the first filter. For example, the number of times of filtering of the first filter is 2. Alternatively, multiple numbers of times of filtering can also be set for the first filter. For example, the number of times of filtering of the first filter can have 3 choices, which are 2, 3 and 4. In the case where the first filter includes multiple numbers of times of filtering, when filtering the first reconstructed image, a suitable number of times of filtering can be selected from the multiple numbers of times of filtering for filtering, which helps to improve the filtering effect of the first filter, and further helps to improve the decoding performance.

[0155] In some embodiments, a threshold of the number of filtering times of the first filter can be set. The threshold of the number of filtering times can be shared by different chroma components when filtering based on the first filter, or different thresholds of the number of filtering times can be respectively set for different chroma components. For example, when the first reconstructed image is a chroma reconstructed image of a U component, the maximum number of filtering times based on the first filter is a first threshold; when the first reconstructed image is a chroma reconstructed image of a V component, the maximum number of filtering times based on the first filter is a second threshold.

[0156] The number of filtering times of the first filter can be determined based on information in the bitstream. In some embodiments, the second identification information can be determined by parsing the bitstream. The second identification information is used to indicate the first number of filtering times from a plurality of numbers of filtering times, or the second identification information is used to indicate the first number of filtering times. The first number of filtering times can also be understood as a suitable number of filtering times.

[0157] The second identification information can be any combination of numbers and / or letters. The value of the second identification information can include a plurality of values, wherein each value respectively represents a number of filtering times. For example, the second identification information can be represented as sh_alf_cb_fixed_filter_time_idx (with a value of 0 or 1), indicating the number of filtering times when the first filter is used to filter the chroma reconstructed image of the U component. If the value of the second identification information is 0, it indicates that the number of filtering times is 1; if the value of the second identification information is 1, it indicates that the number of filtering times is 2. For another example, the second identification information can be represented as sh_alf_cr_fixed_filter_time_idx (with a value of 0 or 1), indicating the number of filtering times when the first filter is used to filter the chroma reconstructed image of the V component. If the value of the second identification information is 0, it indicates that the number of filtering times is 1; if the value of the second identification information is 1, it indicates that the number of filtering times is 2.

[0158] When determining the suitable number of filtering times in the above, it is also necessary to determine the filter set corresponding to the suitable number of filtering times in a plurality of filter sets. The filter set is used to determine the first filter. For example, the first filter class corresponding to the first reconstructed image can be determined first, and then the first filter is determined according to the first filter class and the first filter set.

[0159] In some embodiments, the third identification information can be determined by parsing the bitstream. The third identification information is used to indicate the first filter set including the first filter, or the third identification information is used to indicate at least one filter including the first filter.

[0160] The third identification information can have various forms of representation. For example, the third identification information can be identification information used only to represent the filter set. For another example, the third identification information can also be parameter information in the multiplexed code stream to represent the filter set.

[0161] For example, the third identification information can be sh_alf_cb_fixed_filter_type_idx (with a value of 0 or 1) to represent the filter set used when the chroma reconstructed image of the U component is filtered based on the first filter. If the third identification information has a value of 0, it indicates that the filter set 0 is used for filtering, and if the third identification information has a value of 1, it indicates that the filter set 1 is used for filtering. For another example, the third identification information can be sh_alf_cr_fixed_filter_type_idx (with a value of 0 or 1) to represent the filter set used when the chroma reconstructed image of the V component is filtered based on the first filter. If the third identification information has a value of 0, it indicates that the filter set 0 is used for filtering, and if the third identification information has a value of 1, it indicates that the filter set 1 is used for filtering.

[0162] For example, the third identification information can be identification information of an adaptive parameter set (APS), or the third identification information can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information is parameter information multiplexed. For example, the third identification information can have a second preset value. If the third identification information has the second preset value, the filter set of the first reconstructed image is the first filter set. The second preset value can also be used to indicate other information in addition to the filter set, such as type information or serial number information.

[0163] For example, the third identification information is an APS ID (identifier). Assuming that the second preset value has a value of 8, if the APS ID has a value of 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficients in the APS, and indicating that the filter set used by the reconstructed image is the first filter set. If the APS ID has a value of 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficients in the second APS, and indicating that the filter set used by the reconstructed image is the second filter set.

[0164] Exemplarily, the third identification information is CTU-level filter index information, such as syntax element alf_ctb_filter_alt_idx. Assuming that the second preset value is 3, if the value of alf_ctb_filter_alt_idx is 3, it indicates that the index value of the CTU-level filter is 3, and indicates that the filter set used by the reconstructed image is the first filter set; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the CTU-level filter is 8, and indicates that the filter set used by the reconstructed image is the second filter set.

[0165] It should be understood that the chroma reconstructed image of the U component and the chroma reconstructed image of the V component can share the above three kinds of identification information, or two different sets of identification information combinations can be set for the two chroma components respectively.

[0166] The above describes the information used by the first reconstructed image when filtering based on the first filter. Next, information that can be used by the first reconstructed image when filtering based on the second filter is introduced.

[0167] In some implementations, if the first reconstructed image is filtered using the second filter, the first information can be determined by parsing the code stream. The first information can include one or more of the following information: the number of groups of the second filter, the ordering information of the second filter, and the filter coefficients of the second filter.

[0168] In some implementations, the decoding method shown in FIG. 6 can further include: parsing the code stream to determine fourth identification information. The fourth identification information can be used to indicate whether to perform filtering. If the fourth identification information indicates to perform filtering, the first reconstructed image is filtered according to the filter used by the first reconstructed image; if the fourth identification information indicates not to perform filtering, the first reconstructed image is not filtered.

[0169] The first filter and the second filter are two different types of filters. The first filter can be determined based on a first filter category and / or a quantization parameter. The first filter category can be used to determine the first filter from one or more filter sets. For example, the first filter can be determined according to the first filter category and the first filter set.

[0170] The first filter class can be determined based on variance information and / or gradient information of the first reconstructed image. For example, the variance information and the gradient information can be calculated based on a 2x2 chroma block in the first reconstructed image; then, a directionality, an activity, and a scaled variance of each block are calculated according to the gradient and the variance information; and then, the first filter class of the 2x2 chroma block is calculated according to the directionality, the activity, and the scaled variance.

[0171] Exemplarily, the first filter can be a fixed filter, and the corresponding filter coefficient is a fixed value, which can be a filter coefficient in a fixed subset.

[0172] The second filter can be determined based on the second filter class. The second filter class is used to determine the second filter from a second filter set. The second filter set herein may, for example, include 8 filters, corresponding to 8 filter classes respectively.

[0173] Exemplarily, the filter coefficient of the second filter can be a filter coefficient in an APS subset.

[0174] The embodiments of the present application do not make specific limitation on the first reconstructed image. The first reconstructed image includes one of the following: the first reconstructed image is a current image; or, the first reconstructed image is a slice of the current image; or, the first reconstructed image is a CTU of the current image; or, the first reconstructed image is all CTUs belonging to the second filter class in the current image.

[0175] In the foregoing, information that can be used by the first reconstructed image in the filtering process (for example, the first identification information, the second identification information, and the third identification information) is mentioned. If the image level of the first reconstructed image changes, the indication range of the above information will also change.

[0176] For example, assuming that the first reconstructed image is all CTUs corresponding to the same filter class in the current image, the indication range of the first identification information, the second identification information, and the third identification information is: the first identification information is used to indicate whether all CTUs corresponding to the same filter class in the current image are filtered by the second filter; the second identification information is used to indicate the filtering times of all CTUs corresponding to the same filter class in the current image based on the first filter; and the third identification information is used to indicate the filter set used when all CTUs corresponding to the same filter class in the current image are filtered based on the first filter.

[0177] The three pieces of identification information can be set as a vector of Mx1, indicating the indication information of all CTUs corresponding to M filter categories. For example, M can be 8, indicating all CTUs corresponding to 8 filter categories.

[0178] For another example, assuming that the first reconstructed image is a CTU of the current image, the indication ranges of the first identification information, the second identification information, and the third identification information are as follows: the first identification information is used to indicate whether the CTU of the current image is filtered using the second filter; the second identification information is used to indicate the number of times of filtering the CTU of the current image based on the first filter; and the third identification information is used to indicate the filter set used when the CTU of the current image is filtered based on the first filter.

[0179] The three pieces of identification information can be set as a vector of Nx1, indicating the indication information of N CTUs. The encoding method provided by the embodiments of the present application is described in detail below in combination with FIG. 7.

[0180] FIG. 7 is a flowchart of an encoding method provided by an embodiment of the present application. The method of FIG. 7 can be applied to an encoder.

[0181] Referring to FIG. 7, in step S710, a filter mode of a first reconstructed image is determined from a plurality of filter modes. The first reconstructed image can be a reconstructed image that has been filtered by a deblocking filter and / or a sample adaptive offset filter.

[0182] The first reconstructed image can be a chroma reconstructed image of a U component, a chroma reconstructed image of a V component, or a luma reconstructed image.

[0183] The plurality of filter modes mentioned above can include a first filter mode and a second filter mode. In the first filter mode, the first reconstructed image skips a second filter after being filtered by a first filter, or in other words, in the first filter mode, the first reconstructed image is filtered based on only the first filter; in the second filter mode, the first reconstructed image is filtered based on the second filter after being filtered by the first filter.

[0184] The first filter and the second filter in the above are two different types of filters. The filter coefficients of the first filter here are determined based on a fixed value. For example, the filter coefficients of the first filter are filter coefficients obtained by pre-training. Exemplarily, the first filter is a fixed filter. The filter coefficients of the second filter here can be determined based on the current image or a previous image of the current image. For example, the filter coefficients of the second filter can be generated according to image information of the current image using the Wiener filter principle.

[0185] There can be various ways to determine the filtering mode of the first reconstructed image from the plurality of filtering modes. For example, the encoder and decoder can determine the filtering mode of the first reconstructed image according to the same predefined rule. In some implementations, the filtering mode of the first reconstructed image can be determined based on rate-distortion costs of the plurality of filtering modes.

[0186] In some implementations, the way to determine the filtering mode of the first reconstructed image from the plurality of filtering modes can include: determining a first rate-distortion cost according to the first filtering mode; then, determining a second rate-distortion cost according to the second filtering mode; and finally, determining the filtering mode of the first reconstructed image according to the first rate-distortion cost and the second rate-distortion cost.

[0187] For example, the first rate-distortion cost of the first filtering mode and the second rate-distortion cost of the second filtering mode can be calculated according to rate-distortion optimization (RDO); then, the first rate-distortion cost and the second rate-distortion cost are compared, and the filtering mode corresponding to the smaller rate-distortion cost is taken as the filtering mode of the first reconstructed image. Illustratively, if the first rate-distortion cost is less than or equal to the second rate-distortion cost, the first filtering mode is taken as the filtering mode of the first reconstructed image; if the first rate-distortion cost is greater than the second rate-distortion cost, the second filtering mode is taken as the filtering mode of the first reconstructed image.

[0188] Before filtering based on the filtering mode of the first reconstructed image, it can also be determined whether the first reconstructed image needs to be filtered by comparing the costs of the first reconstructed image and the second reconstructed image.

[0189] In some implementations, before performing the adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image, the encoding method shown in FIG. 7 can further include: determining the size between a third rate-distortion cost and a fourth rate-distortion cost. The third rate-distortion cost is the rate-distortion cost corresponding to the second reconstructed image, and the fourth rate-distortion cost is the rate-distortion cost corresponding to the first reconstructed image.

[0190] For example, the third rate-distortion cost corresponding to the second reconstructed image and the fourth rate-distortion cost corresponding to the first reconstructed image can be calculated according to rate-distortion optimization (RDO); then, the size between the third rate-distortion cost and the fourth rate-distortion cost is compared.

[0191] Further, performing the adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image can include: if the third rate-distortion cost is less than or equal to the fourth rate-distortion cost, performing the adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image

[0192] In some embodiments, the encoding method shown in FIG. 7 can further include: if the third rate-distortion cost is greater than the fourth rate-distortion cost, the first reconstructed image skips the adaptive loop filter.

[0193] In some embodiments, the first parameter can be written into the bitstream. The first parameter is used to indicate the filtering mode of the first reconstructed image from a plurality of filtering modes.

[0194] The first parameter herein can have various representations. For example, the first parameter can be identification information used only to represent the filtering mode. For another example, the first parameter can also represent the filtering mode by multiplexing parameter information in the bitstream.

[0195] For example, the value of the first parameter can include a first value and a second value, where the first value is used to indicate that the filtering mode of the first reconstructed image is the first filtering mode, and the second value is used to indicate that the filtering mode of the first reconstructed image is the second filtering mode.

[0196] If the value of the first parameter is the first value, it is determined that the filtering mode of the first reconstructed image is the first filtering mode; if the value of the first parameter is the second value, it is determined that the filtering mode of the first reconstructed image is the second filtering mode.

[0197] The first parameter can be any combination of numbers and / or letters. The value of the first parameter can include a plurality of values, where each value represents a different filtering mode. For example, the first parameter can be represented as sh_alf_cb_fixed_filter_only_flag (with a value of 0 or 1), indicating the filtering mode of the first reconstructed image used by the chroma reconstructed image of the U component. If the value of the first parameter is 0, it indicates that the chroma reconstructed image of the U component is filtered based on the second filtering mode; if the value of the first parameter is 1, it indicates that the chroma reconstructed image of the U component is filtered based on the first filtering mode. For another example, the first parameter can be represented as sh_alf_cr_fixed_filter_only_flag (with a value of 0 or 1), indicating the filtering mode of the first reconstructed image used by the chroma reconstructed image of the V component. If the value of the first parameter is 0, it indicates that the chroma reconstructed image of the V component is filtered based on the second filtering mode; if the value of the first parameter is 1, it indicates that the chroma reconstructed image of the V component is filtered based on the first filtering mode.

[0198] Exemplarily, the first parameter can be identification information of an adaptive parameter set (APS), or the first parameter can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information herein is multiplexed parameter information. For example, the value of the first parameter can include a first preset value. If the value of the first parameter is the first preset value, the filter mode of the first reconstructed image is a first filter mode; or if the value of the first parameter is not the first preset value, the filter mode of the first reconstructed image is a second filter mode. The first preset value can also be used to indicate other information in addition to the plurality of filter modes, for example, type information or serial number information.

[0199] Exemplarily, if the first parameter is an APS ID (identifier), the first preset value is also used to indicate filter coefficients used by the first reconstructed image. Assuming that the value of the first preset value is 8, if the value of the APS ID is 8, the serial number of the APS is 8, indicating that the reconstructed image does not use filter coefficients in the APS for filtering, and indicating that the filter mode of the reconstructed image is the first filter mode; if the value of the APS ID is 2, the serial number of the APS is 2, indicating that the reconstructed image uses filter coefficients in the second APS for filtering, and indicating that the filter mode of the reconstructed image is the second filter mode.

[0200] Exemplarily, the first parameter is CTU-level filter index information, such as syntax element alf_ctb_filter_alt_idx. Assuming that the first preset value includes 0 to 7, if the value of alf_ctb_filter_alt_idx is 1, it indicates that the index value of the CTU-level filter is 1, and indicates that the filter mode of the reconstructed image at the CTU level is the first filter mode; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the CTU-level filter is 8, and the filter mode of the reconstructed image at the CTU level is the second filter mode.

[0201] Embodiments of the present application do not specifically limit the number of times of filtering of the first filter, and the first reconstructed image can be filtered once or multiple times based on the first filter.

[0202] In the case where the first reconstructed image is filtered multiple times based on the first filter, a specific number of times of filtering can be set for the first filter. For example, the number of times of filtering of the first filter is 2. Or, multiple numbers of times of filtering can also be set for the first filter. For example, the number of times of filtering of the first filter can have 3 choices, which are 2, 3, and 4. In the case where the first filter includes multiple numbers of times of filtering, when filtering the first reconstructed image, a suitable number of times of filtering can be selected from the multiple numbers of times of filtering for filtering, which helps to improve the filtering effect of the first filter, and further helps to improve the coding performance.

[0203] The manner of determining the suitable filter number from the plurality of filter numbers can include: determining a plurality of rate-distortion costs of the filtered first reconstructed image according to the plurality of filter numbers; then, comparing the plurality of rate-distortion costs; and finally, taking the filter number corresponding to the minimum rate-distortion cost as the suitable filter number.

[0204] In some implementations, a threshold value can be set for the filter number of the first filter. The same threshold value of the filter number can be shared by different chroma components when being filtered based on the first filter, or different threshold values of the filter number can be respectively set for different chroma components. For example, when the first reconstructed image is a U-component chroma reconstructed image, the maximum filter number for filtering based on the first filter is a first threshold value; when the first reconstructed image is a V-component chroma reconstructed image, the maximum filter number for filtering based on the first filter is a second threshold value.

[0205] After the filter number of the filter is determined, the filter number can be written into a bitstream in an information manner to provide the decoding end. In some implementations, a second parameter can be written into the bitstream. The second parameter is used to indicate the first filter number from the plurality of filter numbers, or the second parameter is used to indicate the first filter number. The first filter number can also be understood as the suitable filter number.

[0206] The second parameter can be any combination of numbers and / or letters. The second parameter can have a plurality of values, and each value represents a filter number. For example, the second parameter can be represented as sh_alf_cb_fixed_filter_time_idx (with values of 0 or 1), which represents the filter number when the U-component chroma reconstructed image is filtered using the first filter. If the second parameter has a value of 0, it means that the filter number is 1; if the second parameter has a value of 1, it means that the filter number is 2. For another example, the second parameter can be represented as sh_alf_cr_fixed_filter_time_idx (with values of 0 or 1), which represents the filter number when the V-component chroma reconstructed image is filtered using the first filter. If the second parameter has a value of 0, it means that the filter number is 1; if the second parameter has a value of 1, it means that the filter number is 2.

[0207] When the suitable filter number in the above is determined, the filter set corresponding to the suitable filter number also needs to be determined from a plurality of filter sets. The filter set is used to determine the first filter. For example, the first filter class corresponding to the first reconstructed image can be determined first, and then the first filter is determined according to the first filter class and the first filter set.

[0208] In some embodiments, the third parameter can be written into the bitstream. The third parameter is used to indicate a first filter set corresponding to the first filter number, and the first filter set includes the first filter, or the third parameter is used to indicate at least one filter, and the at least one filter includes the first filter.

[0209] The third parameter herein can have various representations. For example, the third parameter can be identification information of the filter set. For another example, the third parameter can also be parameter information multiplexed in the bitstream to represent the filter set.

[0210] For example, the third parameter can be a combination of any number and / or letter. The third parameter can have multiple values, and each value represents a different filter set. For example, the third parameter can be represented as sh_alf_cb_fixed_filter_type_idx (with a value of 0 or 1), indicating the filter set used when the first filter is used to filter the chroma reconstructed image of the U component. If the third parameter has a value of 0, it indicates that the filter set 0 is used for filtering, and if the third parameter has a value of 1, it indicates that the filter set 1 is used for filtering. For another example, the third parameter can be represented as sh_alf_cr_fixed_filter_type_idx (with a value of 0 or 1), indicating the filter set used when the first filter is used to filter the chroma reconstructed image of the V component. If the third parameter has a value of 0, it indicates that the filter set 0 is used for filtering, and if the third parameter has a value of 1, it indicates that the filter set 1 is used for filtering.

[0211] For example, the third parameter can be identification information of an adaptive parameter set (APS), or the third parameter can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information herein is multiplexed parameter information. For example, the third parameter can have a second preset value. If the third parameter has the second preset value, the filter set of the first reconstructed image is the first filter set. The second preset value can also be used to indicate other information in addition to the multiple filter modes, such as type information or serial number information.

[0212] For example, the third parameter is an APS ID (identifier), and it is assumed that the second preset value has a value of 8. If the APS ID has a value of 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficients in the APS, and indicating that the filter set used by the reconstructed image is the first filter set. If the APS ID has a value of 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficients in the second APS, and indicating that the filter set used by the reconstructed image is the second filter set.

[0213] Exemplarily, the third parameter is CTU-level filter index information, such as syntax element alf_ctb_filter_alt_idx. Assuming that the second preset value is 3, if the value of alf_ctb_filter_alt_idx is 3, it indicates that the index value of the CTU-level filter is 3, and indicates that the filter set used by the reconstructed image is the first filter set; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the CTU-level filter is 8, and indicates that the filter set used by the reconstructed image is the second filter set.

[0214] It should be understood that the chroma reconstructed image of the U component and the chroma reconstructed image of the V component can share the above three parameters, or two different parameter combinations can be set for the two chroma components respectively.

[0215] The three parameters written in the bitstream above are information that can be used when the first filter at the decoding end is filtered. Next, information that can be used when the second filter at the decoding end is filtered is introduced.

[0216] In some implementations, if the filtering mode of the first reconstructed image is the second filtering mode, the fourth parameter can be written into the bitstream. The fourth parameter can include one or more of the following information: the number of second filter groups, the ordering information of the second filter, and the filtering coefficients of the second filter.

[0217] The first filter and the second filter are two different types of filters. The first filter can be determined based on a first filter category and / or a quantization parameter. The first filter category can be used to determine the first filter from one or more filter sets. For example, the first filter can be determined according to the first filter category and the first filter set.

[0218] The first filter category can be determined based on variance information and / or gradient information of the first reconstructed image. For example, the variance information and the gradient information can be calculated based on a 2x2 chroma block in the first reconstructed image; then, the directionality, activity, and scaled variance of each block are calculated according to the gradient and variance information; and then, the first filter category of the 2x2 chroma block is calculated according to the directionality, activity, and scaled variance.

[0219] Exemplarily, the first filter can be a fixed filter, and the corresponding filtering coefficient is a filter coefficient obtained by pre-training.

[0220] The second filter can be determined based on a second filter category. The second filter category can be used to determine the second filter from a second filter set. The second filter set herein may, for example, include 8 filters, respectively corresponding to 8 filter categories.

[0221] The second filter category can be determined based on a rate-distortion cost. For example, a plurality of rate-distortion costs can be calculated according to rate-distortion optimization (RDO) for a CTU filtered using a plurality of filters (respectively corresponding to a plurality of filter categories); then, the filter category corresponding to the minimum rate-distortion cost is taken as the second filter category of the CTU.

[0222] Exemplarily, the filter coefficients of the second filter can be determined by respectively accumulating the covariance matrix and the error vector of all CTUs corresponding to the second filter category, and constructing a Wiener-Hopf equation.

[0223] In step S720, the first reconstructed image is adaptively loop filtered according to the filtering mode of the first reconstructed image, to determine a second reconstructed image.

[0224] In some implementations, the encoding method shown in FIG. 7 can further include: writing a fifth parameter into the bitstream. The fifth parameter can be used to indicate whether to perform adaptive loop filtering. If the fifth parameter indicates to perform adaptive loop filtering, the first reconstructed image is adaptively loop filtered according to the filtering mode of the first reconstructed image; if the fifth parameter indicates not to perform adaptive loop filtering, the first reconstructed image skips adaptive loop filtering.

[0225] In the embodiments of the present application, the image output by the first filter can be taken as the output image of the adaptive loop filter, or the image output by the second filter can be taken as the output image of the adaptive loop filter, thereby helping to improve the filtering effect of the adaptive loop filter, and further improving the coding performance. It should be noted that, compared with the luminance reconstructed image, the embodiments of the present application are more suitable for the chrominance reconstructed image in the adaptive loop filtering process.

[0226] The first reconstructed image is not specifically limited in the embodiments of the present application. The first reconstructed image includes one of the following: the first reconstructed image is a current image; or, the first reconstructed image is a slice of the current image; or, the first reconstructed image is a CTU of the current image; or, the first reconstructed image is all CTUs belonging to the second filter category in the current image.

[0227] In the foregoing, the information (such as the first parameter, the second parameter and the third parameter) that can be used by the first reconstructed image in the filtering process is mentioned. If the image level of the first reconstructed image changes, the indication range of the above information will also change.

[0228] For example, assuming that the first reconstructed image is all CTUs corresponding to the same filter category in the current image, the indication range of the first parameter, the second parameter and the third parameter is: the first parameter is used to indicate the filter mode of all CTUs corresponding to the same filter category in the current image; the second parameter is used to indicate the filter times of all CTUs corresponding to the same filter category in the current image based on the first filter; and the third parameter is used to indicate the filter set used when all CTUs corresponding to the same filter category in the current image are filtered based on the first filter.

[0229] The above three parameters can be set as a Mx1 vector, indicating the indication information of all CTUs corresponding to M filter categories. For example, M can be 8, indicating all CTUs corresponding to 8 filter categories.

[0230] For another example, assuming that the first reconstructed image is one CTU in the current image, the indication range of the first parameter, the second parameter and the third parameter is: the first parameter is used to indicate the filter mode of one CTU in the current image; the second parameter is used to indicate the filter times of one CTU in the current image based on the first filter; and the third parameter is used to indicate the filter set used when one CTU in the current image is filtered based on the first filter.

[0231] The above three parameters can be set as a Nx1 vector, indicating the indication information of N CTUs.

[0232] FIG. 8 is a flow diagram of an encoding method provided by an embodiment of the present application. The method of FIG. 8 can be applied to an encoder.

[0233] In step S810, a filter used by the first reconstructed image is determined according to the first filter and the second filter.

[0234] The first reconstructed image can be a reconstructed image after deblocking filtering and / or sample adaptive offset filtering. The first reconstructed image can be a chroma reconstructed image of a U component, a chroma reconstructed image of a V component, or a luma reconstructed image.

[0235] The above first filter and / or second filter can be a filter in an adaptive loop filter. The first filter and the second filter are two different types of filters. The filter coefficients of the first filter herein are determined based on fixed values. For example, the filter coefficients of the first filter are filter coefficients obtained by pre-training. Illustratively, the first filter is a fixed filter. The filter coefficients of the second filter herein can be determined based on the current image or a previous image of the current image. For example, the filter coefficients of the second filter can be generated according to image information of the current image using the Wiener filter principle.

[0236] The filter used by the first reconstructed image can be only the first filter, or can include the first filter and the second filter.

[0237] In step S820, if the first reconstructed image is not filtered using the second filter, the first reconstructed image is filtered according to the first filter to determine the second reconstructed image.

[0238] In some implementations, if the first reconstructed image is filtered using the second filter, the first reconstructed image is filtered according to the first filter and the second filter to determine the third reconstructed image.

[0239] For example, the first reconstructed image is first filtered based on the first filter, and then filtered based on the second filter to determine the third reconstructed image.

[0240] In the embodiments of the present application, the image output by the first filter can be used as the output image of the adaptive loop filter, or the image output by the second filter can be used as the output image of the adaptive loop filter, which helps to improve the filtering effect of the adaptive loop filter, and further improves the coding performance. It should be noted that, compared with the luminance reconstructed image, the embodiments of the present application are more suitable for the chrominance reconstructed image in the adaptive loop filtering process.

[0241] There can be various ways to determine whether the first reconstructed image is filtered using the second filter. For example, the coding end can determine whether the first reconstructed image is filtered using the second filter according to the same predefined rule. In some implementations, whether to filter using the second filter can be determined based on the rate-distortion cost.

[0242] In some implementations, the way to determine the filter used by the first reconstructed image can include: determining a first rate-distortion cost according to the second reconstructed image; then, determining a second rate-distortion cost according to the third reconstructed image; and finally, determining the filter used by the first reconstructed image according to the first rate-distortion cost and the second rate-distortion cost.

[0243] For example, the first rate-distortion cost of the second reconstructed image and the second rate-distortion cost of the third reconstructed image can be calculated according to rate-distortion optimization (RDO); then, the first rate-distortion cost and the second rate-distortion cost are compared, and the filter corresponding to the smaller rate-distortion cost is used as the filter used by the first reconstructed image. For example, if the first rate-distortion cost is less than or equal to the second rate-distortion cost, the first reconstructed image is not filtered using the second filter; if the first rate-distortion cost is greater than the second rate-distortion cost, the first reconstructed image is filtered using the first filter and the second filter.

[0244] Before filtering according to the filter used for the first reconstructed image, it can also be determined whether the first reconstructed image needs to be filtered based on the rate-distortion cost.

[0245] In some implementations, before filtering according to the filter used for the first reconstructed image, the encoding method shown in FIG. 8 can further include determining a size between a third rate-distortion cost and a fourth rate-distortion cost. The third rate-distortion cost is the minimum rate-distortion cost among the rate-distortion costs corresponding to the second reconstructed image and the third reconstructed image, and the fourth rate-distortion cost is the rate-distortion cost corresponding to the first reconstructed image.

[0246] Further, filtering according to the filter used for the first reconstructed image can include filtering according to the filter used for the first reconstructed image if the third rate-distortion cost is less than or equal to the fourth rate-distortion cost.

[0247] In some implementations, the encoding method shown in FIG. 8 can further include that if the third rate-distortion cost is greater than the fourth rate-distortion cost, the first reconstructed image is filtered by skipping.

[0248] In some implementations, the first identification information can be written into the bitstream. The first identification information is used to indicate whether the first reconstructed image is filtered by the second filter.

[0249] The first identification information here can have various forms of representation. For example, the first identification information can be identification information used only to represent whether the second filter is used for filtering. For another example, the first identification information can also multiplex parameter information in the bitstream to represent whether the second filter is used for filtering.

[0250] Exemplarily, the value of the first identification information can include a first value and a second value, where the first value is used to indicate that the first reconstructed image is not filtered by the second filter, and the second value is used to indicate that the first reconstructed image is filtered by the second filter.

[0251] The first identification information can be any combination of numbers and / or letters. For example, the first identification information can be represented as sh alf cb fixed filter only flag (with a value of 0 or 1), indicating whether the chroma reconstructed image of the U component is filtered using the second filter. If the value of the first identification information is 0, it indicates that the chroma reconstructed image of the U component is filtered using the second filter; if the value of the first identification information is 1, it indicates that the chroma reconstructed image of the U component is not filtered using the second filter. For another example, the first identification information can be represented as sh alf cr fixed filter only flag (with a value of 0 or 1), indicating whether the chroma reconstructed image of the V component is filtered using the second filter. If the value of the first identification information is 0, it indicates that the chroma reconstructed image of the V component is filtered using the second filter; if the value of the first identification information is 1, it indicates that the chroma reconstructed image of the V component is not filtered using the second filter.

[0252] Exemplarily, the first identification information can be identification information of an adaptive parameter set (APS), or the first identification information can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information herein is multiplexed parameter information. For example, the value of the first identification information can include a first preset value. If the value of the first identification information is the first preset value, the first reconstructed image is not filtered using the second filter; or if the value of the first identification information is not the first preset value, the first reconstructed image is filtered using the second filter. The first preset value can also be used to indicate other information in addition to the plurality of filter modes, such as type information or serial number information.

[0253] Exemplarily, if the first identification information is an APS ID (identifier), the first preset value can also be used to indicate the filter coefficient used by the first reconstructed image. Assuming that the value of the first preset value is 8, if the value of the APS ID is 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficient in the APS, and indicating that the reconstructed image is not filtered using the second filter; if the value of the APS ID is 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficient in the second APS, and indicating that the reconstructed image is filtered using the second filter.

[0254] Exemplarily, the first identification information is CTU-level filter index information, such as syntax element alf_ctb_filter_alt_idx. Assuming that the first preset value includes values 0 to 7, if the value of alf_ctb_filter_alt_idx is 1, it indicates that the index value of the CTU-level filter is 1, and the reconstructed image is not filtered using the second filter; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the CTU-level filter is 8, and the reconstructed image is filtered using the second filter.

[0255] The number of times of filtering of the first filter is not specifically limited in the embodiments of the present application. The first reconstructed image can be filtered once or multiple times based on the first filter.

[0256] In the case where the first reconstructed image is filtered multiple times based on the first filter, a specific number of times of filtering can be set for the first filter. For example, the number of times of filtering of the first filter is 2. Alternatively, multiple numbers of times of filtering can be set for the first filter. For example, the number of times of filtering of the first filter can have 3 choices, i.e., 2, 3 and 4. In the case where the first filter includes multiple numbers of times of filtering, when filtering the first reconstructed image, a suitable number of times of filtering can be selected from the multiple numbers of times of filtering, which helps to improve the filtering effect of the first filter, and further helps to improve the coding performance.

[0257] The manner of determining the suitable number of times of filtering from the multiple numbers of times of filtering can include: determining multiple rate-distortion costs of the first reconstructed image filtered based on the multiple numbers of times of filtering; then, comparing the sizes of the multiple rate-distortion costs; and finally, taking the number of times of filtering corresponding to the minimum rate-distortion cost as the suitable number of times of filtering.

[0258] In some implementations, a threshold value can be set for the number of times of filtering of the first filter. The same threshold value of the number of times of filtering can be shared by different chroma components when being filtered based on the first filter, or different threshold values of the number of times of filtering can be respectively set for different chroma components. For example, when the first reconstructed image is a U-component chroma reconstructed image, the maximum number of times of filtering based on the first filter is a first threshold value; when the first reconstructed image is a V-component chroma reconstructed image, the maximum number of times of filtering based on the first filter is a second threshold value.

[0259] After the number of times of filtering of the filter is determined, the number of times of filtering can be written into a bitstream in the form of information to provide the decoding end. In some implementations, the second identification information can be written into the bitstream. The second identification information is used to indicate the first number of times of filtering from the multiple numbers of times of filtering, or the second identification information is used to indicate the first number of times of filtering. The first number of times of filtering can also be understood as the suitable number of times of filtering.

[0260] The second identification information can be any combination of numbers and / or letters. The second identification information can include multiple values, each of which represents a filtering time. For example, the second identification information can be represented as sh_alf_cb_fixed_filter_time_idx (with values of 0 or 1), which represents the filtering time when the first filter is used to filter the chroma reconstructed image of the U component. If the second identification information has a value of 0, it means that the filtering time is one time; if the second identification information has a value of 1, it means that the filtering time is two times. For another example, the second identification information can be represented as sh_alf_cr_fixed_filter_time_idx (with values of 0 or 1), which represents the filtering time when the first filter is used to filter the chroma reconstructed image of the V component. If the second identification information has a value of 0, it means that the filtering time is one time; if the second identification information has a value of 1, it means that the filtering time is two times.

[0261] In addition to determining the appropriate filtering time in the above, it is also necessary to determine the filter set corresponding to the appropriate filtering time in the multiple filter sets. The filter set is used to determine the first filter. For example, the first filter corresponding to the first reconstructed image can be determined first, and then the first filter is determined according to the first filter class and the first filter set.

[0262] In some implementations, the third identification information can be written into the bitstream. The third identification information is used to indicate the first filter set corresponding to the first filtering time, and the first filter set includes the first filter, or the third identification information is used to indicate at least one filter, and the at least one filter includes the first filter.

[0263] The third identification information herein can have multiple representations. For example, the third identification information can be identification information used only to represent the filter set. For another example, the third identification information can also be represented by multiplexing the parameter information in the bitstream.

[0264] Exemplarily, the third identification information can be a combination of any number and / or letter. The value of the third identification information can include multiple values, wherein each value respectively represents a different filter set. For example, the third identification information can be represented as sh_alf_cb_fixed_filter_type_idx (with a value of 0 or 1), representing a filter set used when the chroma reconstructed image of the U component is filtered based on the first filter. If the value of the third identification information is 0, it indicates that the filtering is performed based on the filter set 0; if the value of the third identification information is 1, it indicates that the filtering is performed based on the filter set 1. For another example, the third identification information can be represented as sh_alf_cr_fixed_filter_type_idx (with a value of 0 or 1), representing a filter set used when the chroma reconstructed image of the V component is filtered based on the first filter. If the value of the third identification information is 0, it indicates that the filtering is performed based on the filter set 0; if the value of the third identification information is 1, it indicates that the filtering is performed based on the filter set 1.

[0265] Exemplarily, the third identification information can be identification information of an adaptive parameter set (APS), or the third identification information can also be CTU-level filter index information. The identification information of the APS or the CTU-level filter index information herein is multiplexed parameter information. For example, the value of the third identification information can include a second preset value. If the value of the third identification information is the second preset value, the filter set of the first reconstructed image is the first filter set. The second preset value is also used to indicate other information outside the filter set, such as type information or serial number information.

[0266] Exemplarily, the third identification information is an APS ID (identifier), and it is assumed that the value of the second preset value is 8. If the value of the APS ID is 8, the serial number of the APS is 8, indicating that the reconstructed image is not filtered using the filter coefficients in the APS, and indicating that the filter set used by the reconstructed image is the first filter set. If the value of the APS ID is 2, the serial number of the APS is 2, indicating that the reconstructed image is filtered using the filter coefficients in the second APS, and indicating that the filter set used by the reconstructed image is the second filter set.

[0267] Exemplarily, the third identification information is CTU-level filter index information, such as syntax element alf_ctb_filter_alt_idx. Assuming that the second preset value is 3, if the value of alf_ctb_filter_alt_idx is 3, it indicates that the index value of the CTU-level filter is 3, and indicates that the filter set used by the reconstructed image is the first filter set; if the value of alf_ctb_filter_alt_idx is 8, it indicates that the index value of the CTU-level filter is 8, and indicates that the filter set used by the reconstructed image is the second filter set.

[0268] It should be understood that the chroma reconstructed image of the U component and the chroma reconstructed image of the V component can share the above three kinds of identification information, or two different sets of identification information combinations can be set for the two chroma components respectively.

[0269] The three kinds of identification information written into the bitstream above can be information that can be used when the first filter at the decoding end is filtered. Next, information that can be used when the second filter at the decoding end is filtered is introduced.

[0270] In some implementations, if the first reconstructed image is filtered using the second filter, the first information can be written into the bitstream. The first information can include one or more of the following information: the number of groups of the second filter, the ordering information of the second filter, and the filter coefficients of the second filter.

[0271] In some implementations, the encoding method shown in FIG. 8 can further include: writing fourth identification information into the bitstream. The fourth identification information can be used to indicate whether the first reconstructed image performs filtering.

[0272] The first filter and the second filter are two different types of filters. The first filter can be determined based on a first filter category and / or a quantization parameter. The first filter category can be used to determine the first filter from one or more filter sets. For example, the first filter can be determined according to the first filter category and the first filter set.

[0273] The first filter category can be determined based on variance information and / or gradient information of the first reconstructed image. For example, the variance information and the gradient information can be calculated based on a 2x2 chroma block in the first reconstructed image; then, the directionality, activity, and scaled variance of each block are calculated according to the gradient and variance information; and then, the first filter category of the 2x2 chroma block is calculated according to the directionality, activity, and scaled variance.

[0274] Exemplarily, the first filter can be a fixed filter, and the corresponding filter coefficient is a filter coefficient obtained through pre-training.

[0275] The second filter can be determined based on a second filter category. The second filter category can be used to determine the second filter from a second filter set. The second filter set here can include, for example, 8 filters, respectively corresponding to 8 filter categories.

[0276] The second filter category can be determined based on a rate-distortion cost. For example, a plurality of rate-distortion costs of filtering a CTU using a plurality of filters (respectively corresponding to a plurality of filter categories) can be calculated according to rate-distortion optimization (RDO); then, the filter category corresponding to the smallest rate-distortion cost is taken as the second filter category of the CTU.

[0277] Exemplarily, the filter coefficient of the second filter can be determined by respectively accumulating the covariance matrix and the error vector of all CTUs corresponding to the second filter category, and constructing a Wiener-Hopf equation.

[0278] Embodiments of the present application do not make specific limitations on the first reconstructed image. The first reconstructed image includes one of the following: the first reconstructed image is a current image; or, the first reconstructed image is a slice of the current image; or, the first reconstructed image is a CTU of the current image; or, the first reconstructed image is all CTUs belonging to the second filter category in the current image.

[0279] In the foregoing, information that can be used in the filtering process of the first reconstructed image (such as the first identification information, the second identification information, and the third identification information) is mentioned. If the image level of the first reconstructed image changes, the indication range of the above information will also change.

[0280] For example, assuming that the first reconstructed image is all CTUs corresponding to the same filter category in the current image, the indication range of the first identification information, the second identification information, and the third identification information is: the first identification information is used to indicate whether all CTUs corresponding to the same filter category in the current image are filtered using the second filter; the second identification information is used to indicate the filtering times of all CTUs corresponding to the same filter category in the current image based on the first filter; and the third identification information is used to indicate the filter set used when filtering all CTUs corresponding to the same filter category in the current image based on the first filter.

[0281] The above three identification information can be set as a Mx1 vector, indicating the indication information of all CTUs corresponding to M filter categories. For example, M can be 8, indicating all CTUs corresponding to 8 filter categories.

[0282] For example, if the first reconstructed image is a CTU of the current image, the indication range of the first identification information, the second identification information and the third identification information is as follows: the first identification information is used to indicate whether the CTU of the current image is filtered by the second filter; the second identification information is used to indicate the filtering times of the CTU of the current image based on the first filter; and the third identification information is used to indicate the filter set used when the CTU of the current image is filtered based on the first filter.

[0283] The above three identification information can be set as an N×1 vector, indicating the indication information of N CTUs.

[0284] The embodiments of the present application will be described in more detail below with reference to specific examples. It should be noted that the examples below are only intended to help those skilled in the art understand the embodiments of the present application, and are not intended to limit the embodiments of the present application to the specific values or specific scenarios exemplified.

[0285] The present example proposes a scheme of ALF chroma filter optimization, which optimizes the ALF filtering process of chroma samples, and adaptively selects the output result of the fixed filter or the output result of the filter in the APS as the output of the final ALF chroma filter.

[0286] The information filtered by the same-component fixed filter for each chroma component is used as input, for example, when the U component is subjected to ALF chroma filtering, the result filtered by the fixed filter for the U component is used as input; when the V component is subjected to ALF chroma filtering, the result filtered by the fixed filter for the V component is used as input. The filters in the APS of the chroma components (U component and V component) are shared, and only one component is introduced here, and the other component is also the same process. The steps of the present example scheme are described in detail below, taking the first filter as the fixed filter and the second filter as the filter in the APS as an example.

[0287] First, the category information of all samples of the component before ALF chroma filtering is calculated.

[0288] Second, the corresponding fixed filter coefficients are selected according to the category information of each sample and the quantization parameter, and each sample of the component before ALF filtering is filtered.

[0289] Third, the distortion of the output of the ALF chroma fixed filter is calculated, and the corresponding rate-distortion cost is calculated, and the rate-distortion cost of the fixed filter filtering with the minimum cost is recorded as cost1, and the corresponding fixed filter category and fixed filter times are recorded.

[0290] Fourth, the filter coefficients in the APS are calculated. The Wiener-Hopf equation is constructed according to the covariance matrix and the error vector calculated, and the filter coefficients are solved.

[0291] Step 5, calculate the rate-distortion cost cost2 of filtering the component using the filter in the APS.

[0292] Step 6, calculate the filtering cost cost3 of filtering the component using the filter of the same chroma component of the previous picture, if cost2 < cost3, then the component of the current picture is filtered using the filter in the ALF chroma APS; otherwise, the component of the current picture is filtered using the chroma filter of the same chroma component of the previous picture. Let the smaller value of cost2 and cost3 be cost4.

[0293] Step 7, compare costl and cost4, if costl < cost4, then the component of the current picture is filtered using only the ALF chroma fixed filter, and the fixed filter flag is set to 1; otherwise, the component of the current picture is filtered using the filter in the APS, and the fixed filter flag is set to 0. Let the smaller value of costl and cost4 be cost5.

[0294] Step 8, calculate the rate-distortion cost cost6 of filtering the component without using the ALF chroma filter, if cost5 < cost6, then the component of the current picture is filtered using the ALF chroma filter, and the ALF chroma filter flag is set to 1; otherwise, the component of the current picture is not filtered using the ALF chroma filter, and the ALF chroma filter flag is set to 0.

[0295] Step 9, if the chroma component of the current picture needs to be filtered, and the chroma component of the current picture is filtered using only the ALF chroma fixed filter, then the component is filtered using the corresponding fixed filter. If the chroma component of the current picture needs to be filtered using the filter in the APS, then the component of the current picture is filtered using the filter coefficients in the APS. After filtering the samples that need to be filtered, they are written into the filtered output store. For the samples that do not need to be filtered, they are written into the filtered output store directly.

[0296] In the tenth step, if the chroma component of the current picture is filtered by the ALF chroma filter, information such as whether the CTU uses the ALF chroma filter and the filter category used by the CTU is written into the bitstream: if the chroma component of the current picture only uses the ALF chroma fixed filter set, the fixed filter flag, the fixed filter number and the fixed filter category are written into the bitstream. If the chroma component of the current picture is filtered by the filter in the APS, the fixed filter flag, the fixed filter number, the fixed filter category, the filter set number, the filter order, the filter coefficient and other information are written into the bitstream. If the chroma component of the current picture is filtered by the filter of the same chroma component of the previous picture, the fixed filter flag, the fixed filter number and the fixed filter category and other information are written into the bitstream. Finally, the bitstream is transmitted to the decoding end. The fixed filter flag, the fixed filter number and the fixed filter category can be set as separate identification information or can be represented by multiplexing the parameter information in the bitstream. For example, the identification value of the adaptive parameter set APS or the alternative index of the CTU can be used to represent the three parameters.

[0297] For the filter level scheme, the fixed filter flag is an 8x1 vector. Whether only the fixed filter is used for the 8 categories is corresponded respectively; the fixed filter number is an 8x1 vector. The number of times the fixed filter is used for the 8 categories is corresponded respectively; the fixed filter category is an 8x1 vector. The category of the fixed filter used for the 8 categories is corresponded respectively.

[0298] For the CTU level scheme, the fixed filter flag is an Nx1 vector. Whether only the fixed filter is used for the N CTUs is corresponded respectively; the fixed filter number is an Nx1 vector. The number of times the fixed filter is used for the N CTUs is corresponded respectively; the fixed filter category is an Nx1 vector. The category of the fixed filter used for the N CTUs is corresponded respectively. N is the number of CTUs in the current picture.

[0299] It should be understood that in the present example, the number of times of filtering of the fixed filter is not limited. For example, the number of times of filtering of the fixed filter can be 1, can be 2, or can be multiple times.

[0300] The present example does not limit the number of filter categories of the fixed filter. For example, the number of filter categories of the fixed filter can be 1, can be 2, or can be multiple.

[0301] In the present example, the U component and the V component can share the same fixed filter flag, the fixed filter number and the number of fixed filter categories.

[0302] In this example, the U component and the V component use different maximum fixed filter times and different maximum fixed filter category numbers.

[0303] In this example, the use of fixed filters can be at the image level, slice level, filter level, and CTU level.

[0304] The following describes the improvements in syntax and semantics of the scheme of this example in the code stream.

[0305] Take the syntax and semantics of the ECM as an example (take the slice level as an example): here the filter time is assumed to be 2 times, and the filter category is also 2. The slice header (slice header)

[0306] Coding tree unit (coding tree unit)

[0307] sh_alf_cb_fixed_filter_only_flag represents a flag indicating that the chroma U component uses only the ALF chroma fixed filter. A value of 1 indicates that the chroma U component is filtered only using the ALF chroma fixed filter; a value of 0 indicates that the chroma U component is filtered using the filter in the APS.

[0308] sh_alf_cr_fixed_filter_only_flag represents a flag indicating that the chroma V component uses only the ALF chroma fixed filter. A value of 1 indicates that the chroma V component is filtered only using the ALF chroma fixed filter; a value of 0 indicates that the chroma V component is filtered using the filter in the APS.

[0309] sh_alf_cb_fixed_filter_time_idx represents the number of times the chroma U component uses only the ALF chroma fixed filter. A binary variable. A value of 1 indicates that the chroma U component is filtered using two ALF chroma fixed filters; a value of 0 indicates that the chroma U component is filtered using one ALF chroma fixed filter.

[0310] sh_alf_cr_fixed_filter_time_idx represents the number of times the chroma V component uses only the ALF chroma fixed filter. A binary variable. A value of 1 indicates that the chroma V component is filtered using two ALF chroma fixed filters; a value of 0 indicates that the chroma V component is filtered using one ALF chroma fixed filter.

[0311] sh_alf_cb_fixed_filter_type_idx indicates the category of the ALF chroma fixed filter used for the chroma U component only. A binary variable. Value 1 means the chroma U component is filtered using ALF chroma fixed filter 1; value 0 means the chroma U component is filtered using ALF chroma fixed filter 0.

[0312] sh_alf_cr_fixed_filter_type_idx indicates the category of the ALF chroma fixed filter used for the chroma V component only. A binary variable. Value 1 means the chroma V component is filtered using ALF chroma fixed filter 1; value 0 means the chroma V component is filtered using ALF chroma fixed filter 0.

[0313] In the parsing process at the decoding end, when parsing the slice header information, if the chroma component of the current image is filtered using ALF, the flag bit of the ALF chroma fixed filter used by the chroma component of the current image, the number of the ALF chroma fixed filter used by the chroma component of the current image and the category of the ALF chroma fixed filter are parsed.

[0314] In the decoding process, if the chroma component of the current image is filtered using ALF, if the value of the flag bit of the ALF chroma fixed filter is 0, the corresponding APS unit is selected according to the APS ID used by the current image, and the filter coefficients in the current APS unit are obtained. In addition, the corresponding fixed filter is selected according to the category value of the ALF chroma fixed filter used by the chroma component and the number value of the fixed filter, and the CTU to be filtered by the chroma component is filtered for the corresponding number of times, and then the CTU to be filtered is filtered again using the filter in the APS unit. If the value of the flag bit of the ALF chroma fixed filter is 1, the corresponding fixed filter is selected according to the number of the ALF chroma fixed filter and the category of the ALF chroma fixed filter, and the CTU to be filtered is filtered for the corresponding number of times.

[0315] Alternatively, when parsing the slice header information, if the chroma component of the current image is filtered using ALF, the APS ID used by the chroma component of the current image, the number of the ALF chroma fixed filter used by the chroma component of the current image and the category of the ALF chroma fixed filter are parsed. If the APS ID is equal to a certain specified value, the fixed filter is used for filtering. Otherwise, the filter in the APS indicated by the APS ID is used for filtering

[0316] Or, when parsing the slice header information, if the chroma component of the current picture is filtered using ALF, the APS ID used by the chroma component of the current picture, the filter class used by the component of each CTU of the current picture, the fixed filter number and the fixed filter class are parsed. If the filter class is equal to a certain specified value, the fixed filter is used for filtering. Otherwise, the filter in the APS indicated by the APS ID is used for filtering

[0317] The present example allows the current picture to adaptively select a suitable filter for filtering in the ALF chroma filtering process, which can achieve a better trade-off between rate and performance, thereby helping to improve the filtering effect of adaptive loop filtering, and further helping to improve the performance of coding and decoding.

[0318] The method embodiments of the present application are described in detail above in combination with FIGS. 1 to 8, and the device embodiments of the present application are described in detail below in combination with FIGS. 9 to 14. It should be understood that the description of the method embodiments corresponds to the description of the device embodiments, and therefore, the parts not described in detail can be referred to the foregoing method embodiments.

[0319] FIG. 9 is a structural schematic diagram of a decoder provided by an embodiment of the present application. As shown in FIG. 9, the decoder 900 includes a first determining unit 910 and a second determining unit 920.

[0320] The first determining unit 910 is configured to determine a filter mode of a first reconstructed image from a plurality of filter modes, the plurality of filter modes including at least a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image skips a second filter after being filtered by a first filter, and the second filter mode being that the first reconstructed image is filtered based on the second filter again after being filtered by the first filter.

[0321] The second determining unit 920 is configured to perform adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image.

[0322] The filter coefficients of the first filter are determined based on a fixed value, and the filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0323] In some implementations, the first determining unit 910 is further configured to parse a bitstream to determine a first parameter, the first parameter being used to indicate the filter mode of the first reconstructed image from the plurality of filter modes.

[0324] In some embodiments, the first parameter has a first value and a second value, the first value is used to indicate that the filtering mode of the first reconstructed image is the first filtering mode, and the second value is used to indicate that the filtering mode of the first reconstructed image is the second filtering mode; if the first parameter has the first value, it is determined that the filtering mode of the first reconstructed image is the first filtering mode; or if the first parameter has the second value, it is determined that the filtering mode of the first reconstructed image is the second filtering mode.

[0325] In some embodiments, the first determining unit 910 is further configured to determine whether the first parameter has a first preset value.

[0326] If the first parameter has the first preset value, the filtering mode of the first reconstructed image is the first filtering mode; or if the first parameter does not have the first preset value, the filtering mode of the first reconstructed image is the second filtering mode.

[0327] In some embodiments, the first preset value is further used to indicate other information in addition to the plurality of filtering modes.

[0328] In some embodiments, the first parameter is identification information of an APS; or the first parameter is filter index information at a coding tree unit (CTU) level.

[0329] In some embodiments, the first reconstructed image is filtered multiple times based on the first filter.

[0330] In some embodiments, the decoder 900 further includes a third determining unit configured to parse a bitstream to determine a second parameter, the second parameter being used to indicate a first filtering number; or the second parameter being used to indicate a first filtering number from a plurality of filtering numbers.

[0331] In some embodiments, the decoder 900 further includes a fourth determining unit configured to parse a bitstream to determine a third parameter, the third parameter being used to indicate a first filter set, the first filter set being used to determine the first filter; or the third parameter being used to indicate at least one filter, the at least one filter being used to determine the first filter.

[0332] In some embodiments, the decoder 900 further includes a fifth determining unit configured to, if the filtering mode of the first reconstructed image is the second filtering mode, parse a bitstream to determine a fourth parameter, the fourth parameter including at least one of the following information:

[0333] The number of groups of the second filter, the ordering information of the second filter, and the filter coefficients of the second filter.

[0334] In some embodiments, the decoder 900 further includes a sixth determining unit configured to parse a bitstream to determine a fifth parameter, the fifth parameter being used to indicate whether to perform adaptive loop filtering; and the second determining unit 920 is further configured to perform adaptive loop filtering on the first reconstructed image according to a filtering mode of the first reconstructed image if the fifth parameter indicates to perform adaptive loop filtering.

[0335] In some embodiments, if the fifth parameter indicates not to perform adaptive loop filtering, the first reconstructed image skips adaptive loop filtering.

[0336] In some embodiments, the first filter is determined based on a first filter category and / or a quantization parameter, and the first filter category is determined based on variance information and / or gradient information of the first reconstructed image.

[0337] In some embodiments, the first filter is determined based on the first filter category and a first filter set.

[0338] In some embodiments, the second filter is determined based on a second filter category, and the second filter category is used to determine the second filter from a second filter set.

[0339] In some embodiments, filter coefficients of the second filter are determined based on the current image or a previous image of the current image.

[0340] In some embodiments, the first reconstructed image comprises one of:

[0341] The first reconstructed image is the current image; or,

[0342] The first reconstructed image is a slice of the current image; or,

[0343] The first reconstructed image is a CTU of the current image; or,

[0344] The first reconstructed image is all CTUs corresponding to a second filter category in the current image, and the second filter category is used to determine the second filter.

[0345] In some embodiments, the first reconstructed image is a reconstructed image after deblocking filtering and / or sample adaptive offset filtering.

[0346] In some embodiments, the first reconstructed image is a chroma reconstructed image or a luma reconstructed chroma image.

[0347] FIG. 10 is a schematic diagram of a structure of a decoder according to another embodiment of the present application. As shown in FIG. 10, the decoder 1000 includes a parsing unit 1010 and a determining unit 1020.

[0348] The parsing unit 1010 is configured to parse first identification information, the first identification information being used to indicate whether a first reconstructed image is filtered using a second filter.

[0349] The determining unit 1020 is configured to, if the first identification information indicates that the first reconstructed image is not filtered using the second filter, filter the first reconstructed image according to a first filter to determine a second reconstructed image.

[0350] In some embodiments, filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0351] In some embodiments, the determining unit 1020 is further configured to, if the first identification information indicates that the first reconstructed image is filtered using the second filter, filter the first reconstructed image according to the first filter and the second filter to determine a third reconstructed image.

[0352] In some embodiments, the first identification information has a value including a first value and a second value, the first value being used to indicate that the first reconstructed image is not filtered using the second filter, and the second value being used to indicate that the first reconstructed image is filtered using the second filter.

[0353] In some embodiments, the first identification information has a value including a first preset value.

[0354] If the value of the first identification information is the first preset value, the first reconstructed image is not filtered using the second filter; or,

[0355] If the value of the first identification information is not the first preset value, the first reconstructed image is filtered using the second filter.

[0356] In some embodiments, the first preset value is further used to indicate other information in addition to whether the second filter is used.

[0357] In some embodiments, the first identification information is identification information of an APS; or, the first identification information is filter index information at a coding tree unit (CTU) level.

[0358] In some embodiments, the first reconstructed image is filtered multiple times based on the first filter.

[0359] In some embodiments, the decoder 1000 further includes a third determining unit configured to parse the bitstream to determine second identification information, the second identification information being used to indicate the first filtering number; or the second identification information being used to indicate the first filtering number from a plurality of filtering numbers.

[0360] In some embodiments, the decoder 1000 further includes a fourth determining unit configured to parse the bitstream to determine third identification information, the third identification information being used to indicate the first filter set, the first filter set being used to determine the first filter; or the third identification information being used to indicate at least one filter, the at least one filter being used to determine the first filter.

[0361] In some embodiments, the decoder 1000 further includes a fifth determining unit configured to, if the first reconstructed image is filtered using the second filter, parse the bitstream to determine first information, the first information including at least one of the following information:

[0362] a number of groups of the second filter, ordering information of the second filter, and filtering coefficients of the second filter.

[0363] In some embodiments, the decoder 1000 further includes a sixth determining unit configured to parse the bitstream to determine fourth identification information, the fourth identification information being used to indicate whether filtering is performed.

[0364] The determining unit 1020 is further configured to, if the fourth identification information indicates that filtering is performed, filter the first reconstructed image.

[0365] In some embodiments, if the fourth identification information indicates that filtering is not performed, the first reconstructed image skips filtering.

[0366] In some embodiments, the first filter is determined based on a first filter category and / or a quantization parameter, the first filter category being determined based on variance information and / or gradient information of the first reconstructed image.

[0367] In some embodiments, the first filter is determined based on the first filter category and a first filter set.

[0368] In some embodiments, the second filter is determined based on a second filter category, the second filter category being used to determine a second filter from a second filter set.

[0369] In some embodiments, the filter coefficients of the second filter are determined based on a covariance matrix and / or an error vector of all coding tree units (CTUs) corresponding to the second filter category, the all CTUs belonging to the current picture or a previous picture of the current picture.

[0370] In some embodiments, the first reconstructed picture comprises one of:

[0371] The first reconstructed picture is the current picture; or,

[0372] The first reconstructed picture is one slice of the current picture; or,

[0373] The first reconstructed picture is one CTU of the current picture; or,

[0374] The first reconstructed picture is all CTUs of the current picture corresponding to a second filter category, the second filter category being used to determine the second filter.

[0375] In some embodiments, the first reconstructed picture is a de-blocking filtered and / or sample adaptive offset filtered reconstructed picture.

[0376] In some embodiments, the first reconstructed picture is a chroma reconstructed picture or a luma reconstructed chroma picture.

[0377] In some embodiments, the first filter and / or the second filter is a filter in an adaptive loop filter.

[0378] It can be understood that, in the embodiments of the present application, the "unit" can be a part of circuit, a part of processor, a part of program or software, etc., and of course can be a module, and can also be non-modular. Moreover, each component in the embodiments can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware, or in the form of a software functional module.

[0379] The integrated unit, if implemented in the form of a software function module and not sold or used as an independent product, can be stored in a computer readable storage medium based on such understanding. The technical solutions of the embodiments essentially or the part of the prior art that contributes to the technical solutions or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in the embodiments. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0380] Therefore, the embodiments of the present application provide a computer readable storage medium applied to the decoder 900 or the decoder 1000, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the decoding method in the first embodiment.

[0381] Based on the composition of the decoder 900 or the decoder 1000 and the computer readable storage medium, referring to FIG. 11, a specific hardware structure schematic diagram of the decoder 900 or the decoder 1000 is shown. As shown in FIG. 11, the decoder 1100 can include a communication interface 1110, a memory 1120 and a processor 1130; and the various components are coupled together through a bus system 1140. It can be understood that the bus system 1140 is used to realize the connection communication between the components. The bus system 1140 includes a data bus, a power bus, a control bus and a status signal bus. However, for the purpose of clear illustration, all kinds of buses are marked as the bus system 1140 in FIG. 11. Among them,

[0382] The communication interface 1110 is used for receiving and sending signals in the process of transceiving information with other external network elements.

[0383] The memory 1120 is used for storing a computer program.

[0384] The processor 1130 is used for executing the following steps when running the computer program:

[0385] A filter mode of a first reconstructed image is determined from a plurality of filter modes, the plurality of filter modes including at least a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image is filtered by a first filter and skips a second filter, and the second filter mode being that the first reconstructed image is filtered by the first filter and then filtered based on the second filter again; the first reconstructed image is adaptively loop filtered according to the filter mode of the first reconstructed image to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0386] Alternatively, the following is performed: the first identification information is parsed, the first identification information being used to indicate whether the first reconstructed image is filtered using the second filter; if the first identification information indicates that the first reconstructed image is not filtered using the second filter, the first reconstructed image is filtered according to a first filter to determine a second reconstructed image; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

[0387] It is to be appreciated that the memory 1120 in the embodiments of this application can be volatile, nonvolatile, or a combination of both. By way of example, the nonvolatile memory can include read-only memory (ROM), programmable ROM (PROM), erasable PROM (EPROM), electrically EPROM (EEPROM), a flash memory, or a combination of these. The volatile memory can include random access memory (RAM), which acts as external cache. By way of example and not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double-Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), SynchBurst DRAM (SLDRAM), and direct Rambus RAM (DRRAM). The memory 1120 of the subject systems and methods is intended to include, without being limited to, these and any other suitable types of memory.

[0388] The processor 1130 can be an integrated circuit chip powerfully processing signals. In the implementation process, the steps of the foregoing method can be completed by the integrated logic circuit or the instruction in the form of software in the processor 1130. The processor 1130 described above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps and logical block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware code processor to execute, or a combination of hardware and software modules in the code processor to execute. The software module can be located in the random access memory, the flash memory, the read only memory, the programmable read only memory or the electrically erasable programmable memory, the register or other mature storage medium in the art. The storage medium is located in the storage 1120, and the processor 1130 reads the information in the storage 1120 and combines the hardware to complete the steps of the method.

[0389] It can be understood that the embodiments described in the present application can be realized by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general purpose processors, controllers, microcontrollers, microprocessors, other electronic units for executing the functions described in the present application or a combination thereof. For software implementation, the technologies described in the present application can be implemented by modules (such as processes, functions, etc.) for executing the functions described in the present application. The software code can be stored in the memory and executed by the processor. The memory can be implemented in the processor or outside the processor.

[0390] Optionally, as another embodiment, the processor 1130 is further configured to execute the decoding method described in the foregoing embodiments when running the computer program.

[0391] FIG. 12 is a schematic diagram of a structure of an encoder according to an embodiment of the present application. As shown in FIG. 12, the encoder 1200 includes a first determining unit 1210 and a second determining unit 1220.

[0392] The first determining unit 1210 is configured to determine a filter mode of a first reconstructed image from a plurality of filter modes, the plurality of filter modes including at least a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image is filtered by a first filter and skips a second filter, and the second filter mode being that the first reconstructed image is filtered by the first filter and then filtered based on the second filter.

[0393] The second determining unit 1220 is configured to perform adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image.

[0394] In some embodiments, filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0395] In some embodiments, the encoder 1100 further includes a first writing unit configured to write a first parameter into a bitstream, the first parameter being used to indicate the filter mode of the first reconstructed image from the plurality of filter modes.

[0396] In some embodiments, the first parameter has a value including a first value and a second value, the first value being used to indicate that the filter mode of the first reconstructed image is the first filter mode, and the second value being used to indicate that the filter mode of the first reconstructed image is the second filter mode; if the first parameter has the first value, it is determined that the filter mode of the first reconstructed image is the first filter mode; or if the first parameter has the second value, it is determined that the filter mode of the first reconstructed image is the second filter mode.

[0397] In some embodiments, the first parameter has a value including a first preset value; if the first parameter has the first preset value, the filter mode of the first reconstructed image is the first filter mode; or if the first parameter does not have the first preset value, the filter mode of the first reconstructed image is the second filter mode.

[0398] In some embodiments, the first preset value is further used to indicate other information in addition to the plurality of filter modes.

[0399] In some embodiments, the first parameter is identification information of an adaptive parameter set (APS), or the first parameter is filter index information at a coding tree unit (CTU) level.

[0400] In some embodiments, the first reconstructed image is filtered multiple times based on the first filter.

[0401] In some embodiments, the encoder 1200 further includes a second writing unit configured to write, into the bitstream, a second parameter used to indicate a first filtering number, or used to indicate, from a plurality of filtering numbers, the first filtering number determined based on rate-distortion costs corresponding to the plurality of filtering numbers.

[0402] In some embodiments, the encoder 1200 further includes a third writing unit configured to write, into the bitstream, a third parameter used to indicate a first filter set corresponding to the first filtering number, the first filter set being used to determine the first filter, or used to indicate at least one filter corresponding to the first filtering number, the at least one filter being used to determine the first filter.

[0403] In some embodiments, the first determining unit 1210 is further configured to determine a first rate-distortion cost according to the first filtering mode, determine a second rate-distortion cost according to the second filtering mode, and determine a filtering mode of the first reconstructed image according to the first rate-distortion cost and the second rate-distortion cost.

[0404] In some embodiments, if the first rate-distortion cost is less than or equal to the second rate-distortion cost, the filtering mode of the first reconstructed image is the first filtering mode, or if the first rate-distortion cost is greater than the second rate-distortion cost, the filtering mode of the first reconstructed image is the second filtering mode.

[0405] In some embodiments, the encoder 1200 further includes a fourth writing unit configured to write, into the bitstream, a fourth parameter including one or more of the following information if the filtering mode of the first reconstructed image is the second filtering mode:

[0406] a number of groups of the second filter, ordering information of the second filter, and filter coefficients of the second filter.

[0407] In some embodiments, the encoder 1200 further includes a third determining unit configured to determine a size between a third rate-distortion cost and a fourth rate-distortion cost, the third rate-distortion cost being a rate-distortion cost corresponding to the second reconstructed image, the fourth rate-distortion cost being a rate-distortion cost corresponding to the first reconstructed image; and the second determining unit 1220 is further configured to perform the adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image if the third rate-distortion cost is less than or equal to the fourth rate-distortion cost.

[0408] In some embodiments, the first reconstructed image is skipped from the adaptive loop filtering if the third rate-distortion cost is greater than the fourth rate-distortion cost.

[0409] In some embodiments, the encoder 1200 further includes a fifth writing unit configured to write a fifth parameter into a bitstream, the fifth parameter being used to indicate whether the adaptive loop filtering is performed.

[0410] In some embodiments, the first filter is determined based on a first filter category and / or a quantization parameter, and the first filter category is determined based on variance information and / or gradient information of the first reconstructed image.

[0411] In some embodiments, the first filter is determined based on the first filter category and a first filter set.

[0412] In some embodiments, the second filter is determined based on a second filter category, and the second filter category is used to determine the second filter from a second filter set.

[0413] In some embodiments, filter coefficients of the second filter are determined based on a covariance matrix and / or an error vector of all coding tree units (CTUs) corresponding to the second filter category, and the all CTUs corresponding to the second filter category belong to the current image or a previous image of the current image.

[0414] In some embodiments, the first reconstructed image comprises one of:

[0415] the first reconstructed image is the current image; or

[0416] the first reconstructed image is one slice of the current image; or

[0417] the first reconstructed image is one CTU of the current image; or

[0418] the first reconstructed image is all CTUs corresponding to a second filter category in the current image, and the second filter category is used to determine the second filter.

[0419] In some embodiments, the first reconstructed picture is a de-blocking filtered and / or sample adaptive offset filtered reconstructed picture.

[0420] In some embodiments, the first reconstructed picture is a chroma reconstructed picture or a luma reconstructed chroma picture.

[0421] FIG. 13 is a schematic diagram of a structure of an encoder according to another embodiment of the present application. As shown in FIG. 13, the encoder 1300 includes a first determining unit 1310 and a second determining unit 1320.

[0422] The first determining unit 1310 is configured to determine a filter used by a first reconstructed picture according to a first filter and a second filter.

[0423] The second determining unit 1320 is configured to filter the first reconstructed picture according to the first filter to determine a second reconstructed picture if the first reconstructed picture is not filtered by the second filter.

[0424] In some embodiments, the second determining unit 1320 is further configured to filter the first reconstructed picture according to the first filter and the second filter to determine a third reconstructed picture if the first reconstructed picture is filtered by the second filter.

[0425] In some embodiments, the encoder 1300 further includes a first writing unit configured to write first identification information into a bitstream, the first identification information being used to indicate whether the first reconstructed picture is filtered by the second filter.

[0426] In some embodiments, a value of the first identification information includes a first value and a second value, the first value being used to indicate that the first reconstructed picture is not filtered by the second filter, and the second value being used to indicate that the first reconstructed picture is filtered by the second filter.

[0427] In some embodiments, the value of the first identification information includes a first preset value.

[0428] If the value of the first identification information is the first preset value, the first reconstructed picture is not filtered by the second filter; or

[0429] If the value of the first identification information is not the first preset value, the first reconstructed picture is filtered by the second filter.

[0430] In some embodiments, the first preset value is further used to indicate other information in addition to whether the second filter is used.

[0431] In some embodiments, the first identification information is identification information of an adaptive parameter set (APS), or the first identification information is filter index information at a coding tree unit (CTU) level.

[0432] In some embodiments, the first reconstructed image is filtered multiple times based on the first filter.

[0433] In some embodiments, the encoder 1300 further includes a second writing unit configured to write second identification information into the bitstream, the second identification information being used to indicate a first filtering number; or

[0434] The second identification information is used to indicate the first filtering number from a plurality of filtering numbers, and the first filtering number is determined based on rate-distortion costs corresponding to the plurality of filtering numbers.

[0435] In some embodiments, the encoder 1300 further includes a third writing unit configured to write third identification information into the bitstream, the third identification information being used to indicate a first filter set corresponding to the first filtering number, the first filter set being used to determine the first filter; or the third identification information being used to indicate at least one filter corresponding to the first filtering number, the at least one filter being used to determine the first filter.

[0436] In some embodiments, the first determining unit 1310 is further configured to determine a first rate-distortion cost according to the second reconstructed image, determine a second rate-distortion cost according to the third reconstructed image, and determine a filter used by the first reconstructed image according to the first rate-distortion cost and the second rate-distortion cost.

[0437] In some embodiments, if the first rate-distortion cost is less than or equal to the second rate-distortion cost, the first reconstructed image is not filtered using the second filter; or if the first rate-distortion cost is greater than the second rate-distortion cost, the first reconstructed image is filtered using the second filter.

[0438] In some embodiments, the encoder 1300 further includes a fourth writing unit configured to write first information into the bitstream if the first reconstructed image is filtered using the second filter, the first information including at least one of the following information:

[0439] The number of groups of the second filter, the ordering information of the second filter, and the filtering coefficients of the second filter.

[0440] In some embodiments, the encoder 1300 further includes a fourth determining unit configured to determine a size between a third rate-distortion cost and a fourth rate-distortion cost, the third rate-distortion cost being a minimum rate-distortion cost among rate-distortion costs corresponding to the second reconstructed image and the third reconstructed image, the fourth rate-distortion cost being a rate-distortion cost corresponding to the first reconstructed image.

[0441] The third determining unit 1330 is further configured to filter the first reconstructed image if the third rate-distortion cost is less than or equal to the fourth rate-distortion cost.

[0442] In some embodiments, the first reconstructed image is filtered if the third rate-distortion cost is greater than the fourth rate-distortion cost.

[0443] In some embodiments, the encoder 1300 further includes a fifth writing unit configured to write fourth identification information into a bitstream, the fourth identification information being used to indicate whether filtering is performed.

[0444] In some embodiments, the first filter is determined based on a first filter category and / or a quantization parameter, the first filter category being determined based on variance information and / or gradient information of the first reconstructed image.

[0445] In some embodiments, the first filter is determined based on the first filter category and a first filter set.

[0446] In some embodiments, the second filter is determined based on a second filter category, the second filter category being used to determine a second filter from a second filter set.

[0447] In some embodiments, filter coefficients of the second filter are determined based on a covariance matrix and / or an error vector of all coding tree units (CTUs) corresponding to the second filter category, the all CTUs corresponding to the second filter category belonging to the current image or a previous image of the current image.

[0448] In some embodiments, the first reconstructed image includes one of the following:

[0449] The first reconstructed image is the current image; or,

[0450] The first reconstructed image is one slice of the current image; or,

[0451] The first reconstructed image is one CTU of the current image; or,

[0452] The first reconstructed image is all CTUs corresponding to a second filter class in the current image, and the second filter class is used to determine the second filter.

[0453] In some implementations, the first reconstructed image is a reconstructed image that is deblocked and / or sample adaptive offset filtered.

[0454] In some implementations, the first reconstructed image is a chroma reconstructed image or a luma reconstructed chroma image.

[0455] In some implementations, the first filter and / or the second filter is a filter in an adaptive loop filter.

[0456] It can be understood that, in the embodiments of the present application, the "unit" can be a part of circuit, a part of processor, a part of program or software, etc., and of course can be a module, and can also be non-modular. Moreover, the components in the embodiments can be integrated in one processing unit, or can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software function module.

[0457] When the integrated unit is realized in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the method described in the embodiments. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various program code storage media.

[0458] Therefore, the embodiments of the present application provide a computer readable storage medium applied to the encoder 1200 or the encoder 1300, and the computer readable storage medium stores a computer program, and the computer program is executed by a processor to implement the encoding method in the foregoing embodiments.

[0459] Based on the above encoder 1200 or encoder 1300, and the computer readable storage medium, see FIG. 14, which shows a specific hardware structure diagram of the encoder 1200 or the encoder 1300 provided by the embodiment of the application. As shown in FIG. 14, the encoder 1400 can include: a communication interface 1410, a memory 1420 and a processor 1430; various components are coupled together through a bus system 1440. It can be understood that the bus system 1440 is used to realize the connection communication between the components. In addition to including a data bus, the bus system 1440 also includes a power bus, a control bus and a status signal bus. However, in order to clearly illustrate, various buses are marked as a bus system 1440 in FIG. 14. Among them,

[0460] The communication interface 1410 is used for receiving and sending signals in the process of transmitting information with other external network elements.

[0461] The memory 1420 is used for storing computer programs.

[0462] The processor 1430 is used for executing the following when running the computer program:

[0463] Determine the filter mode of the first reconstructed image from a plurality of filter modes, the plurality of filter modes at least including a first filter mode and a second filter mode, the first filter mode being that the first reconstructed image skips a second filter after filtering by a first filter, and the second filter mode being that the first reconstructed image is filtered based on the second filter again after filtering by the first filter; and performing adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image to determine a second reconstructed image.

[0464] Among them, the filter coefficients of the first filter are determined based on a fixed value, and the filter coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0465] Or, performing: determining the filter used by the first reconstructed image according to the first filter and the second filter; if the first reconstructed image does not use the second filter for filtering, filtering the first reconstructed image according to the first filter to determine a second reconstructed image; wherein the filter coefficients of the first filter are determined based on a fixed value, and the filter coefficients of the second filter are determined based on a current image or a previous image of the current image.

[0466] It is to be understood that the memory 1420 in the embodiments of the present application can be a volatile memory or a nonvolatile memory, or can include both volatile and nonvolatile memory. Among them, the nonvolatile memory can be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory can be a Random Access Memory (RAM) used as an external cache. By way of example, and not limitation, many forms of RAM can be used, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 1420 of the system and method described in the present application is intended to include, without being limited to, these and any other suitable types of memory.

[0467] The processor 1430 can be an integrated circuit chip powerfully processing signals. In implementation process, each step of the above method can be completed by the integrated logic circuit or the instruction in the form of software in the processor 1430. The processor 1430 described above can be a general processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Each method, step and logic block in the embodiments of the present application can be realized or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as a hardware code processor to execute, or be executed by a combination of hardware and software modules in the code processor. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register, or other mature storage medium in the art. The storage medium is located in the storage 1420, and the processor 1430 reads the information in the storage 1420 and combines the hardware to complete the steps of the above method.

[0468] It can be understood that the embodiments described in the present application can be realized by hardware, software, firmware, middleware, microcode or a combination thereof. For hardware implementation, the processing unit can be implemented in one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), general-purpose processors, controllers, microcontrollers, microprocessors, other electronic units for executing the functions described in the present application or a combination thereof. For software implementation, the technologies described in the present application can be realized by modules (such as processes, functions, etc.) for executing the functions described in the present application. The software code can be stored in a memory and executed by a processor. The memory can be implemented in the processor or outside the processor.

[0469] Optionally, as another embodiment, the processor 1430 is further configured to execute the encoding method described in the foregoing embodiments when running the computer program.

[0470] It should be noted that, in the present application, the terms "comprising", "containing" or any other variant thereof are intended to cover a non-exclusive inclusion, so that a process, method, article or apparatus that comprises a list of elements not only includes those elements, but also includes other elements not expressly listed or inherent to such process, method, article or apparatus. Without more limitations, the element defined by the phrase "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus that includes the element.

[0471] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0472] The methods disclosed in the several method embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method embodiments.

[0473] The features disclosed in the several product embodiments provided by the present application can be combined arbitrarily without conflict to obtain new product embodiments.

[0474] The features disclosed in the several method or device embodiments provided by the present application can be combined arbitrarily without conflict to obtain new method or device embodiments.

[0475] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A decoding method applied to a decoder, the method comprising: determining a filter mode of a first reconstructed picture from a plurality of filter modes, the plurality of filter modes comprising at least a first filter mode and a second filter mode, the first filter mode being that the first reconstructed picture is filtered by a first filter and skips a second filter, the second filter mode being that the first reconstructed picture is filtered by the first filter and is further filtered based on the second filter; performing adaptive loop filtering on the first reconstructed picture according to the filter mode of the first reconstructed picture to determine a second reconstructed picture; wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS). The determining of the filter mode of the first reconstructed picture from the plurality of filter modes comprises: parsing a bitstream to determine a first parameter, the first parameter being used to indicate the filter mode of the first reconstructed picture from the plurality of filter modes.

3. The method of claim 2, wherein: a value of the first parameter comprises a first value and a second value, the first value being used to indicate that the filter mode of the first reconstructed picture is the first filter mode, and the second value being used to indicate that the filter mode of the first reconstructed picture is the second filter mode; if the value of the first parameter is the first value, the filter mode of the first reconstructed picture is determined as the first filter mode; or if the value of the first parameter is the second value, the filter mode of the first reconstructed picture is determined as the second filter mode. The determining of the first parameter comprises: determining whether the value of the first parameter is a first preset value; if the value of the first parameter is the first preset value, the filter mode of the first reconstructed picture is the first filter mode; or if the value of the first parameter is not the first preset value, the filter mode of the first reconstructed picture is the second filter mode.

2. The method of claim 1, wherein, 5. The method of claim 4, wherein: the first preset value is further used to indicate other information in addition to the plurality of filter modes.

6. The method of any one of claims 2 to 5, wherein: the first parameter is identification information of an APS; or the first parameter is filter index information at a coding tree unit (CTU) level.

7. The method of any one of claims 4 to 6, wherein: if the first parameter is the identification information of the APS, the first preset value is further used to indicate filter coefficients used by the first reconstructed picture.

8. The method of any one of claims 1 to 7, wherein: the first reconstructed picture is filtered multiple times based on the first filter. The method further comprises: parsing a bitstream to determine a second parameter, the second parameter being used to indicate a first filter number; or the second parameter is used to indicate the first filter number from a plurality of filter numbers. The method further comprises: parsing a bitstream to determine a third parameter, the third parameter being used to indicate a first filter set, the first filter set being used to determine the first filter; or 4. The method of claim 2, wherein, ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ ​ 9. The method of claim 8, wherein, ​ ​ ​ 10. The method of claim 9, wherein, ​ ​ The third parameter is used to indicate at least one filter used to determine the first filter.

11. The method of any one of claims 1 to 10, wherein, The method further comprises: If the filtering mode of the first reconstructed image is the second filtering mode, parsing a code stream, determining a fourth parameter, the fourth parameter comprising at least one of the following information: The number of groups of the second filter, the ordering information of the second filter, and the filter coefficients of the second filter.

12. The method of any one of claims 1 to 11, wherein, Before the adaptive loop filtering of the first reconstructed image according to the filtering mode of the first reconstructed image, the method further comprises: Parsing a code stream, determining a fifth parameter, the fifth parameter being used to indicate whether to perform adaptive loop filtering; The adaptive loop filtering of the first reconstructed image according to the filtering mode of the first reconstructed image comprises: If the fifth parameter indicates to perform adaptive loop filtering, performing adaptive loop filtering of the first reconstructed image according to the filtering mode of the first reconstructed image.

13. The method of claim 12, wherein: If the fifth parameter indicates not to perform adaptive loop filtering, the first reconstructed image skips adaptive loop filtering.

14. The method of claim 1, wherein, The first filter is determined based on a first filter category and / or a quantization parameter, the first filter category being determined based on variance information and / or gradient information of the first reconstructed image.

15. The method of claim 14, wherein, The first filter is determined based on the first filter category and a first filter set.

16. The method of claim 1, wherein, The second filter is determined based on a second filter category, the second filter category being used to determine the second filter from a second filter set.

17. The method of claim 16, wherein, The filter coefficients of the second filter are determined based on the current image or a previous image of the current image.

18. The method of any one of claims 1 to 17, wherein, The first reconstructed image comprises one of the following: The first reconstructed image is the current image; or, The first reconstructed image is one slice of the current image; or, The first reconstructed image is one CTU of the current image; or, The first reconstructed image is all CTUs corresponding to a second filter category in the current image, the second filter category being used to determine the second filter.

19. The method of claim 1, wherein, The first reconstructed image is a reconstructed image after deblocking filtering and / or sample adaptive offset filtering.

20. The method of claim 1, wherein, The first reconstructed image is a chroma reconstructed image or a luma reconstructed image.

21. A decoding method applied to a decoder, the method comprising: Parsing first identification information, the first identification information being used to indicate whether a first reconstructed image is filtered using a second filter; If the first identification information indicates that the first reconstructed image is not filtered using the second filter, filtering the first reconstructed image according to a first filter to determine a second reconstructed image; Wherein filter coefficients of the first filter are determined based on a fixed value, and filter coefficients of the second filter are determined based on an adaptive parameter set (APS).

22. The method of claim 21, wherein, The method further comprises: If the first identification information indicates that the first reconstructed image is filtered using the second filter, filtering the first reconstructed image according to the first filter and the second filter to determine a third reconstructed image.

23. The method of claim 21 or 22, wherein: a value of the first identification information comprises a first value and a second value, the first value is used to indicate that the first reconstructed image is not filtered using the second filter, and the second value is used to indicate that the first reconstructed image is filtered using the second filter.

24. The method of claim 21 or 22, wherein: a value of the first identification information comprises a first preset value; if the value of the first identification information is the first preset value, the first reconstructed image is not filtered using the second filter; or if the value of the first identification information is not the first preset value, the first reconstructed image is filtered using the second filter.

25. The method of claim 24, wherein: the first preset value is further used to indicate other information in addition to whether the second filter is used.

26. The method of any one of claims 21 to 25, wherein: the first identification information is identification information of an APS; or the first identification information is filter index information at a coding tree unit (CTU) level.

27. The method of any one of claims 24 to 26, wherein: if the first identification information is identification information of an APS, the first preset value is further used to indicate filter coefficients used by the first reconstructed image.

28. The method of any one of claims 21 to 27, wherein: the first reconstructed image is filtered multiple times based on the first filter.

29. The method of claim 28, wherein, The method further comprises: parsing a bitstream to determine second identification information, the second identification information being used to indicate a first number of filtering; or the second identification information is used to indicate a first number of filtering from a plurality of numbers of filtering.

30. The method of claim 29, wherein, The method further comprises: parsing a bitstream to determine third identification information, the third identification information being used to indicate a first filter set, the first filter set being used to determine the first filter; or the third identification information is used to indicate at least one filter, the at least one filter being used to determine the first filter.

31. The method of any one of claims 21 to 30, wherein, The method further comprises: if the first reconstructed image is filtered using the second filter, parsing a bitstream to determine first information, the first information comprising at least one of the following information: a number of groups of the second filter, ordering information of the second filter, and filter coefficients of the second filter.

32. The method of claim 21, wherein, Before the first reconstructed image is filtered, the method further comprises: parsing a bitstream to determine fourth identification information, the fourth identification information being used to indicate whether filtering is performed; filtering the first reconstructed image comprises: if the fourth identification information indicates that filtering is performed, filtering the first reconstructed image.

33. The method of claim 32, wherein: If the fourth identification information indicates not to perform filtering, the first reconstructed image is filtered by skipping.

34. The method of claim 21, wherein, The first filter is determined based on a first filter category and / or a quantization parameter, and the first filter category is determined based on variance information and / or gradient information of the first reconstructed image.

35. The method of claim 34, wherein, The first filter is determined based on the first filter category and a first filter set.

36. The method of claim 21, wherein, The second filter is determined based on a second filter category, and the second filter category is used to determine the second filter from a second filter set.

37. The method of claim 36, wherein, Filtering coefficients of the second filter are determined based on the current image or a previous image of the current image.

38. The method of any one of claims 21 to 37, wherein, The first reconstructed image comprises one of: The first reconstructed image is the current image; or, The first reconstructed image is a slice of the current image; or, The first reconstructed image is a CTU of the current image; or, The first reconstructed image is all CTUs corresponding to a second filter category in the current image, and the second filter category is used to determine the second filter.

39. The method of claim 21, wherein, The first reconstructed image is a reconstructed image after deblocking filtering and / or sample adaptive offset filtering.

40. The method of claim 21, wherein, The first reconstructed image is a chroma reconstructed image or a luma reconstructed image.

41. The method of claim 21, wherein, The first filter and / or the second filter is a filter in an adaptive loop filter.

42. An encoding method applied to an encoder, the method comprising: determining a filtering mode of a first reconstructed image from a plurality of filtering modes, the plurality of filtering modes comprising at least a first filtering mode and a second filtering mode, the first filtering mode being that the first reconstructed image skips a second filter after filtering by a first filter, and the second filtering mode being that the first reconstructed image is filtered based on the second filter again after filtering by the first filter; performing adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image to determine a second reconstructed image; wherein filtering coefficients of the first filter are determined based on a fixed value, and filtering coefficients of the second filter are determined based on a current image or a previous image of the current image.

43. The method of claim 42, wherein, The method further comprises: writing a first parameter into a bitstream, the first parameter being used to indicate the filtering mode of the first reconstructed image from the plurality of filtering modes.

44. The method of claim 43, wherein: a value of the first parameter comprises a first value and a second value, the first value being used to indicate that the filtering mode of the first reconstructed image is the first filtering mode, and the second value being used to indicate that the filtering mode of the first reconstructed image is the second filtering mode; if the value of the first parameter is the first value, it is determined that the filtering mode of the first reconstructed image is the first filtering mode; or if the value of the first parameter is the second value, it is determined that the filtering mode of the first reconstructed image is the second filtering mode.

45. The method of claim 43, wherein: the value of the first parameter comprises a first preset value. If the value of the first parameter is the first preset value, the filter mode of the first reconstructed image is the first filter mode; or If the value of the first parameter is not the first preset value, the filter mode of the first reconstructed image is the second filter mode.

46. The method of claim 45, wherein: The first preset value is further used to indicate other information in addition to the plurality of filter modes.

47. The method of any one of claims 43-46, wherein: The first parameter is identification information of an adaptive parameter set (APS); or The first parameter is filter index information at a coding tree unit (CTU) level.

48. The method of any one of claims 45-47, wherein: If the first parameter is the identification information of the APS, the first preset value is further used to indicate filter coefficients used by the first reconstructed image.

49. The method of any one of claims 42-48, wherein: The first reconstructed image is filtered multiple times based on the first filter.

50. The method of claim 49, wherein, The method further comprises: writing, into a bitstream, a second parameter used to indicate a first filter number; or The second parameter is used to indicate, from a plurality of filter numbers, a first filter number determined based on rate-distortion costs corresponding to the plurality of filter numbers.

51. The method of claim 50, wherein, The method further comprises: writing, into a bitstream, a third parameter used to indicate a first filter set corresponding to the first filter number, the first filter set being used to determine the first filter; or The third parameter is used to indicate at least one filter corresponding to the first filter number, the at least one filter being used to determine the first filter.

52. The method of claim 42, wherein, The determining of the filter mode of the first reconstructed image from the plurality of filter modes comprises: determining a first rate-distortion cost according to the first filter mode; determining a second rate-distortion cost according to the second filter mode; determining the filter mode of the first reconstructed image according to the first rate-distortion cost and the second rate-distortion cost.

53. The method of claim 52, wherein: If the first rate-distortion cost is less than or equal to the second rate-distortion cost, the filter mode of the first reconstructed image is the first filter mode; or If the first rate-distortion cost is greater than the second rate-distortion cost, the filter mode of the first reconstructed image is the second filter mode.

54. The method of any one of claims 42-53, wherein, The method further comprises: If the filter mode of the first reconstructed image is the second filter mode, writing, into a bitstream, a fourth parameter comprising at least one of the following information: a number of groups of the second filter, ordering information of the second filter, and filter coefficients of the second filter.

55. The method of claim 42, wherein, Before the adaptively loop filtering the first reconstructed image according to the filter mode of the first reconstructed image, the method further comprises: determining a size between a third rate-distortion cost and a fourth rate-distortion cost, the third rate-distortion cost being a rate-distortion cost corresponding to the second reconstructed image, the fourth rate-distortion cost being a rate-distortion cost corresponding to the first reconstructed image; the adaptive loop filtering the first reconstructed image according to the filter mode of the first reconstructed image comprises: if the third rate-distortion cost is less than or equal to the fourth rate-distortion cost, performing adaptive loop filtering on the first reconstructed image according to the filter mode of the first reconstructed image.

56. The method of claim 55, wherein: if the third rate-distortion cost is greater than the fourth rate-distortion cost, the first reconstructed image skips adaptive loop filtering.

57. The method of any one of claims 42 to 56, wherein, The method further comprises: writing, into a bitstream, a fifth parameter, the fifth parameter being used to indicate whether adaptive loop filtering is performed.

58. The method of claim 42, wherein, The first filter is determined based on a first filter category and / or a quantization parameter, the first filter category being determined based on variance information and / or gradient information of the first reconstructed image.

59. The method of claim 58, wherein, The first filter is determined based on the first filter category and a first filter set.

60. The method of claim 42, wherein, The second filter is determined based on a second filter category, the second filter category being used to determine the second filter from a second filter set.

61. The method of claim 60, wherein, Filtering coefficients of the second filter are determined based on a covariance matrix and / or an error vector of all coding tree units (CTUs) corresponding to the second filter category, the all CTUs corresponding to the second filter category belonging to the current image or a previous image of the current image.

62. The method of any one of claims 42-61, wherein, The first reconstructed image comprises one of: The first reconstructed image is the current image; or, The first reconstructed image is a slice of the current image; or, The first reconstructed image is a CTU of the current image; or, The first reconstructed image is all CTUs of the current image corresponding to a second filter category, the second filter category being used to determine the second filter.

63. The method of claim 42, wherein, The first reconstructed image is a reconstructed image after deblocking filtering and / or sample adaptive offset filtering.

64. The method of claim 42, wherein, The first reconstructed image is a chroma reconstructed image or a luma reconstructed image.

65. A method of encoding, applied to an encoder, the method comprising: determining a filter used by a first reconstructed image according to a first filter and a second filter; if the first reconstructed image is not filtered using the second filter, filtering the first reconstructed image according to the first filter to determine a second reconstructed image; wherein filtering coefficients of the first filter are determined based on a fixed value, and filtering coefficients of the second filter are determined based on a current image or a previous image of the current image.

66. The method of claim 65, wherein, The method further comprises: if the first reconstructed image is filtered using the second filter, filtering the first reconstructed image according to the first filter and the second filter to determine a third reconstructed image.

67. The method of claim 65 or 66, wherein, The method further comprises: writing, into a bitstream, first identification information, the first identification information being used to indicate whether the first reconstructed image is filtered using the second filter.

68. The method of claim 67, wherein: the first identification information has a first value and a second value, the first value indicating that the first reconstructed picture is not filtered using the second filter, and the second value indicating that the first reconstructed picture is filtered using the second filter.

69. The method of claim 67, wherein: the first identification information has a first preset value; if the first identification information has the first preset value, the first reconstructed picture is not filtered using the second filter; or if the first identification information does not have the first preset value, the first reconstructed picture is filtered using the second filter.

70. The method of claim 69, wherein: the first preset value is further used to indicate other information in addition to whether the second filter is used.

71. The method of any of claims 67-70, wherein: the first identification information is identification information of an adaptation parameter set (APS); or the first identification information is filter index information at a coding tree unit (CTU) level.

72. The method of any of claims 69-71, wherein: if the first identification information is identification information of an APS, the first preset value is further used to indicate filter coefficients used by the first reconstructed picture.

73. The method of any of claims 65-72, wherein: the first reconstructed picture is filtered multiple times based on the first filter.

74. The method of claim 73, wherein, the method further comprises: writing, into a bitstream, second identification information used to indicate a first number of filtering; or the second identification information is used to indicate, from a plurality of numbers of filtering, a first number of filtering, the first number of filtering being determined based on rate-distortion costs corresponding to the plurality of numbers of filtering.

75. The method of claim 74, wherein, the method further comprises: writing, into a bitstream, third identification information used to indicate a first filter set corresponding to the first number of filtering, the first filter set being used to determine the first filter; or the third identification information is used to indicate at least one filter corresponding to the first number of filtering, the at least one filter being used to determine the first filter.

76. The method of claim 66, wherein, determining the filter used by the first reconstructed picture based on the first filter and the second filter comprises: determining a first rate-distortion cost based on the second reconstructed picture; determining a second rate-distortion cost based on the third reconstructed picture; determining the filter used by the first reconstructed picture based on the first rate-distortion cost and the second rate-distortion cost.

77. The method of claim 76, wherein: if the first rate-distortion cost is less than or equal to the second rate-distortion cost, the first reconstructed picture is not filtered using the second filter; or if the first rate-distortion cost is greater than the second rate-distortion cost, the first reconstructed picture is filtered using the second filter.

78. The method of any one of claims 65-77, wherein, the method further comprises: If the first reconstructed picture is filtered using the second filter, first information is written into the bitstream, the first information comprising at least one of the following: a number of groups of the second filter, ordering information of the second filter, and filter coefficients of the second filter.

79. The method of claim 66, wherein, Before the first reconstructed picture is filtered, the method further comprises: determining a size between a third rate-distortion cost and a fourth rate-distortion cost, the third rate-distortion cost being a minimum rate-distortion cost among rate-distortion costs corresponding to the second reconstructed picture and the third reconstructed picture, the fourth rate-distortion cost being a rate-distortion cost corresponding to the first reconstructed picture; filtering the first reconstructed picture comprises: if the third rate-distortion cost is less than or equal to the fourth rate-distortion cost, filtering the first reconstructed picture.

80. The method of claim 79, wherein: if the third rate-distortion cost is greater than the fourth rate-distortion cost, filtering the first reconstructed picture is skipped.

81. The method of any one of claims 65-80, wherein, The method further comprises: writing fourth identification information into the bitstream, the fourth identification information being used to indicate whether filtering is performed.

82. The method of claim 65, wherein, The first filter is determined based on a first filter category and / or a quantization parameter, the first filter category being determined based on variance information and / or gradient information of the first reconstructed picture.

83. The method of claim 82, wherein, The first filter is determined based on the first filter category and a first filter set.

84. The method of claim 65, wherein, The second filter is determined based on a second filter category, the second filter category being used to determine the second filter from a second filter set.

85. The method of claim 84, wherein, Filter coefficients of the second filter are determined based on a covariance matrix and / or an error vector of all coding tree units (CTUs) corresponding to the second filter category, the all CTUs corresponding to the second filter category belonging to the current picture or a previous picture of the current picture.

86. The method of any one of claims 65-85, wherein, The first reconstructed picture comprises one of the following: the first reconstructed picture is the current picture; or, the first reconstructed picture is a slice of the current picture; or, the first reconstructed picture is a CTU of the current picture; or, the first reconstructed picture is all CTUs corresponding to a second filter category in the current picture, the second filter category being used to determine the second filter.

87. The method of claim 65, wherein, The first reconstructed picture is a reconstructed picture after deblocking filtering and / or sample adaptive offset filtering.

88. The method of claim 65, wherein, The first reconstructed picture is a chroma reconstructed picture or a luma reconstructed picture.

89. The method of claim 65, wherein, The first filter and / or the second filter is a filter in an adaptive loop filter.

90. A decoder, comprising: a first determining unit configured to determine a filtering mode of a first reconstructed picture from a plurality of filtering modes, the plurality of filtering modes comprising at least a first filtering mode and a second filtering mode, the first filtering mode being that the first reconstructed picture is filtered by a first filter and skips a second filter, the second filtering mode being that the first reconstructed picture is filtered by the first filter and is further filtered based on the second filter; a second determining unit, configured to determine a second reconstructed image by performing adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image. wherein a filter coefficient of the first filter is determined based on a fixed value, and a filter coefficient of the second filter is determined based on an adaptive parameter set (APS).

91. A decoder comprising: a parsing unit, configured to parse first identification information, the first identification information being used to indicate whether a first reconstructed image is filtered using a second filter; a determining unit, configured to determine a second reconstructed image by filtering the first reconstructed image according to a first filter if the first identification information indicates that the first reconstructed image is not filtered using the second filter; wherein a filter coefficient of the first filter is determined based on a fixed value, and a filter coefficient of the second filter is determined based on an adaptive parameter set (APS).

92. A decoder comprising: a memory for storing a computer program; a processor for executing the method of any one of claims 1 to 20, or any one of claims 21 to 41 when the computer program is run.

93. An encoder comprising: a first determining unit, configured to determine a filtering mode of a first reconstructed image from a plurality of filtering modes, the plurality of filtering modes comprising at least a first filtering mode and a second filtering mode, the first filtering mode being that the first reconstructed image is filtered by a first filter and skips a second filter, and the second filtering mode being that the first reconstructed image is filtered by the first filter and is further filtered based on the second filter; a second determining unit, configured to determine a second reconstructed image by performing adaptive loop filtering on the first reconstructed image according to the filtering mode of the first reconstructed image; wherein a filter coefficient of the first filter is determined based on a fixed value, and a filter coefficient of the second filter is determined based on a current image or a previous image of the current image.

94. An encoder comprising: a first determining unit, configured to determine a filter used by a first reconstructed image according to a first filter and a second filter; a second determining unit, configured to determine a second reconstructed image by filtering the first reconstructed image according to the first filter if the first reconstructed image is not filtered using the second filter; wherein a filter coefficient of the first filter is determined based on a fixed value, and a filter coefficient of the second filter is determined based on a current image or a previous image of the current image.

95. An encoder comprising: a memory for storing a computer program; a processor for executing the method of any one of claims 42 to 64, or any one of claims 65 to 89 when the computer program is run.

96. A non-transitory computer readable storage medium storing a bitstream, the bitstream generated by an encoding method with an encoder or the bitstream decoded by a decoding method with a decoder, wherein, The decoding method is the method of any one of claims 1 to 20, or any one of claims 21 to 41, and the encoding method is the method of any one of claims 42 to 64, or any one of claims 65 to 89.

97. A computer readable storage medium, storing a bitstream generated by the method of any one of claims 42-64, or any one of claims 65-89.

98. A computer readable storage medium, wherein, The computer readable storage medium stores a computer program which, when executed, implements the method of any one of claims 1-41, or 42-89.

Citation Information

Patent Citations

  • Coding and decoding method and device and storage medium

    CN110677663A

  • Two-part signaling for adaptive loop filters in video coding

    CN117294847A

  • Adaptive loop filtering applied to off-line fixed filtering output

    CN118235395A

  • Adaptive Loop Filter With Adaptive Parameter Set

    US20200329239A1