Filtering method, device and equipment
By dividing the image frame into regions and flexibly selecting the shape of the filtering coefficients, the problem of region division in ALF filtering technology not considering pixel characteristics is solved, thus improving filtering performance and encoding/decoding effect.
Patent Information
- Application Number
- CN202110204290.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-23
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-02-23
AI Technical Summary
In existing ALF filtering techniques, the region division does not take into account pixel characteristics, resulting in poor filtering performance.
By dividing the luminance component of the current image frame into regions, ALF filtering is performed based on the region category and filtering coefficients of LCU to optimize the filtering effect. This includes using pixels in the boundary region for filtering when the reference pixel value cannot be obtained, and flexibly selecting multiple sets of filtering coefficients and shapes to improve the adaptability of the filter.
The ALF filtering effect has been optimized, the encoding and decoding performance has been improved, and the video quality has been enhanced.
Smart Images

Figure CN114640846B
Abstract
Description
Technical Field
[0001] The present application relates to video coding and decoding technology, and in particular to a filtering method, device and equipment. Background Art
[0002] Complete video coding generally includes operations such as prediction, transformation, quantization, entropy coding, and filtering.
[0003] There is a quantization operation after block-based motion compensation, which generates coding noise and causes video quality distortion. Loop post-processing technology is used to reduce the impact of such distortion. Loop post-processing technology includes deblocking filter (DBF), sample adaptive offset (SAO) and adaptive loop filter (ALF).
[0004] The ALF technology used in the Audio Video Coding Standard (AVS) coding framework calculates the optimal linear filtering that can be achieved for the original signal and the distorted signal in the mean square sense based on the principle of Wiener filtering.
[0005] However, it is found in practice that the ALF technology uses a fixed area division method, and the area division does not take pixel characteristics into consideration, which will affect the ALF filtering performance, resulting in poor ALF filtering performance. Summary of the invention
[0006] In view of this, the present application provides a filtering method, device and equipment.
[0007] Specifically, the present application is implemented through the following technical solutions:
[0008] According to a first aspect of an embodiment of the present application, a filtering method is provided, which is applied to a decoding end device, and the method includes:
[0009] Divide the brightness component of the current image frame into regions;
[0010] Determine the region category to which the LCU belongs based on the region category identifier of the LCU obtained by parsing the bitstream;
[0011] Determine a filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient obtained by parsing the bitstream;
[0012] ALF filtering is performed on pixels of the LCU one by one based on the filter coefficient of the LCU.
[0013] According to a second aspect of an embodiment of the present application, a filtering method is provided, which is applied to an encoding / decoding end device, and the method includes:
[0014] In the process of performing ALF filtering on any pixel in the current filtering unit, for any reference pixel, when the reference pixel is not in the current filtering unit:
[0015] In the case where the pixel value of the reference pixel cannot be obtained, the current filtering unit and the pixel closest to the reference pixel in the boundary area are used to replace the reference pixel for filtering; the boundary area includes the left boundary or the right boundary of the current filtering unit, the left boundary of the current filtering unit includes part or all of the areas in the filtering unit adjacent to the left side of the current filtering unit, and the left boundary of the current filtering unit includes part or all of the areas in the filtering unit adjacent to the right side of the current filtering unit;
[0016] Otherwise, use the reference pixel for filtering.
[0017] According to a third aspect of an embodiment of the present application, a filtering method is provided, which is applied to a decoding end device, and the method includes:
[0018] When it is determined to start ALF filtering for the current LCU of the current image frame, obtaining a region coefficient identifier of the merged region to which the current LCU belongs;
[0019] Based on the region coefficient identifier of the merged region to which the current LCU belongs, obtaining the filter coefficient of the current LCU; wherein the region coefficient identifier is used to identify the filter coefficient used by the merged region to which the LCU belongs in the preset multiple groups of filter coefficients;
[0020] ALF filtering is performed on pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0021] According to a fourth aspect of an embodiment of the present application, a filtering method is provided, which is applied to a decoding end device, and the method includes:
[0022] When it is determined that the ALF filtering is started for the current LCU of the current frame image, a coefficient selection identifier of the current LCU is obtained;
[0023] Determine a filter coefficient of the current LCU based on the merged region to which the current LCU belongs and a coefficient selection identifier of the current LCU; wherein the coefficient selection identifier is used to identify a filter coefficient selected for use by the current LCU from among multiple groups of candidate filter coefficients;
[0024] ALF filtering is performed on pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0025] According to a fifth aspect of an embodiment of the present application, a filtering method is provided, which is applied to a decoding end device, and the method includes:
[0026] When it is determined to start ALF filtering for the current LCU of the current frame image, based on the merged area to which the current LCU belongs, obtaining a filter shape of the merged area to which the current LCU belongs;
[0027] Based on the filter shape, obtaining a filter coefficient of the merged area to which the current LCU belongs;
[0028] ALF filtering is performed on pixels of the current LCU one by one based on the filter shape and the filter coefficient.
[0029] According to a sixth aspect of an embodiment of the present application, a filtering method is provided, which is applied to a decoding end device, and the method includes:
[0030] When it is determined to start ALF filtering for the current LCU of the current frame image, based on the area to which the current LCU belongs, a filter coefficient of the merged area to which the current LCU belongs and a weight coefficient of each reference pixel position are obtained;
[0031] Based on the filter coefficient and the weight coefficient of each reference pixel position, ALF filtering is performed on the pixels of the current LCU one by one.
[0032] According to a seventh aspect of an embodiment of the present application, a filtering method is provided, which is applied to an encoding end device, and the method includes:
[0033] Divide the brightness component of the current image frame into regions;
[0034] For any region, classify each LCU in the region, and divide the region into multiple region categories based on the category of each LCU;
[0035] Merge regions of each region category and determine the filter coefficient of each merged region;
[0036] The filter coefficients of each merged area and the area category identifier of each LCU are written into the bitstream.
[0037] According to an eighth aspect of an embodiment of the present application, a filtering method is provided, which is applied to an encoding end device, and the method includes:
[0038] For any merged area of the current image frame, determine the filter coefficient used in the merged area based on the RDO decision;
[0039] Determining a region coefficient identifier of the merged region based on the filter coefficient used by the merged region; wherein the region coefficient identifier is used to identify the filter coefficient used by the merged region in a plurality of preset groups of filter coefficients;
[0040] The filter coefficients used by each merged area and the area coefficient identifiers of each merged area are written into the bitstream.
[0041] According to a ninth aspect of an embodiment of the present application, a filtering method is provided, which is applied to an encoding end device, and the method includes:
[0042] For any merged area of the current image frame, a filter coefficient used for the merged area is determined from multiple groups of filter coefficients based on the RDO decision;
[0043] Based on the filter coefficient used in the merged area, determine a coefficient selection identifier of each LCU in the merged area; wherein the coefficient selection identifier is used to identify the filter coefficient selected by each LCU from multiple groups of candidate filter coefficients;
[0044] The filter coefficients used in each merged area and the coefficient selection flags of each LCU are written into the bitstream.
[0045] According to a tenth aspect of an embodiment of the present application, a filtering method is provided, which is applied to an encoding end device, and the method includes:
[0046] For any merged region of the current image frame, determine the filter shape and filter coefficient used in the merged region based on the RDO decision;
[0047] The filter shape and filter coefficients used in each merged area are written into the bitstream.
[0048] According to an eleventh aspect of the embodiments of the present application, a filtering method is provided, which is applied to an encoding end device, and the method includes:
[0049] For any merged area of the current image frame, determine the filter coefficient used in the merged area and the corresponding weight coefficients of each reference pixel position based on the RDO decision;
[0050] The filter coefficients used in each merged area and the corresponding weight coefficients of each reference pixel position are written into the bitstream.
[0051] According to a twelfth aspect of an embodiment of the present application, a filtering device is provided, which is applied to a decoding end device, and the device includes:
[0052] A division unit, used for dividing the brightness component of the current image frame into regions;
[0053] A first determining unit, configured to determine a region category to which the LCU belongs based on a region category identifier of the LCU obtained by parsing the bitstream;
[0054] A second determining unit, configured to determine a filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient obtained by parsing a bit stream;
[0055] The filtering unit is configured to perform ALF filtering on pixels of the LCU one by one based on the filtering coefficient of the LCU.
[0056] According to a thirteenth aspect of an embodiment of the present application, a filtering device is provided, which is applied to an encoding / decoding end device, and the device includes:
[0057] A filtering unit, configured to, in a process of performing ALF filtering on any pixel in a current filtering unit, for any reference pixel, when the reference pixel is not in the current filtering unit:
[0058] In the case where the pixel value of the reference pixel cannot be obtained, the current filtering unit and the pixel closest to the reference pixel in the boundary area are used to replace the reference pixel for filtering; the boundary area includes the left boundary or the right boundary of the current filtering unit, the left boundary of the current filtering unit includes part or all of the areas in the filtering unit adjacent to the left side of the current filtering unit, and the left boundary of the current filtering unit includes part or all of the areas in the filtering unit adjacent to the right side of the current filtering unit;
[0059] Otherwise, use the reference pixel for filtering.
[0060] According to the fourteenth aspect of the embodiment of the present application, a decoding end device is provided, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions to implement the above-mentioned filtering method applied to the decoding end device.
[0061] According to the fifteenth aspect of the embodiment of the present application, a coding end device is provided, including a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions to implement the above-mentioned filtering method applied to the coding end device.
[0062] The filtering method of the embodiment of the present application divides the brightness component of the current image frame into regions; determines the region category to which the LCU belongs based on the region category identifier of the LCU obtained by parsing the bitstream; determines the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient obtained by parsing the bitstream; performs ALF filtering on the pixels of the LCU one by one based on the filter coefficient of the LCU, and classifies the LCUs in the regions divided according to the fixed region division method, so that the region division is more in line with the pixel characteristics of each LCU, thereby optimizing the ALF filtering effect and improving the encoding and decoding performance. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 It is a flow chart of video encoding and decoding;
[0064] Figure 2 It is a schematic diagram of regional division;
[0065] Figure 3 It is a schematic diagram of regional merging;
[0066] Figure 4A It is a schematic diagram of a centrosymmetric filter shape of a 7*7 cross plus a 5*5 square;
[0067] Figure 4B is a Figure 4A A schematic diagram of reference pixels corresponding to the filter coefficients shown;
[0068] Figure 5 is a schematic diagram of a sample filtering compensation unit shown in an exemplary embodiment of the present application;
[0069] Figure 6 is a flowchart of a filtering method shown in an exemplary embodiment of the present application;
[0070] Figure 7 is a flowchart of a filtering method shown in an exemplary embodiment of the present application;
[0071] Figure 8 is a flowchart of a filtering method shown in an exemplary embodiment of the present application;
[0072] Fig. 9 is a flowchart of a filtering method shown in an exemplary embodiment of the present application;
[0073] Fig.10 is a flowchart of a filtering method shown in an exemplary embodiment of the present application;
[0074] Fig.11 is a flowchart of a filtering method shown in an exemplary embodiment of the present application;
[0075] Fig.12 It is a schematic diagram of a centrosymmetric filter shape of a 7*7 cross plus a 3*3 square;
[0076] Fig.13 is a schematic diagram of a merged area shown in an exemplary embodiment of the present application;
[0077] Fig.14 is a schematic diagram of various filter shapes shown in an exemplary embodiment of the present application;
[0078] Fig.15 is a schematic diagram of a 3*3 pixel block shown in an exemplary embodiment of the present application;
[0079] Fig.16 is a schematic diagram of a filter with asymmetric filter coefficients shown in an exemplary embodiment of the present application;
[0080] Fig.17A is a schematic diagram of a reference pixel position shown in an exemplary embodiment of the present application;
[0081] Fig. 17B is a schematic diagram of another reference pixel position shown in an exemplary embodiment of the present application;
[0082] Fig.18A and Fig.18B is a schematic diagram of performing secondary division of regions obtained by multiple fixed region division methods according to an exemplary embodiment of the present application;
[0083] Fig.18C This is an exemplary embodiment of the present application. Fig.18A Schematic diagram of area numbers corresponding to each secondary division method;
[0084] Fig.19 is a structural schematic diagram of a filtering device shown in an exemplary embodiment of the present application;
[0085] Fig. 20 is a structural schematic diagram of a filtering device shown in an exemplary embodiment of the present application;
[0086] Fig.21 is a schematic diagram of the hardware structure of a decoding end device shown in an exemplary embodiment of the present application;
[0087] Fig. 22 It is a schematic diagram of the hardware structure of an encoding terminal device shown in an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0088] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0089] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0090] In order to enable those skilled in the art to better understand the technical solution provided by the embodiments of the present application, the technical terms involved in the embodiments of the present application, the main processes of existing video encoding and decoding, and the implementation of ALF filtering technology are briefly described below.
[0091] 1. Technical terms
[0092] 1. Rate-Distortion Optimized (RDO): The indicators for evaluating coding efficiency include bit rate and Peak Signal to Noise Ratio (PSNR). The smaller the bit rate, the greater the compression rate; the larger the PSNR, the better the reconstructed image quality. When selecting a mode, the discriminant formula is essentially a comprehensive evaluation of the two.
[0093] The cost corresponding to the mode is: J(mode) = D + λ*R. Where D represents distortion, which is usually measured by the SSE (mean square difference) indicator. SSE refers to the mean square difference between the reconstructed block and the source image block; λ is the Lagrange multiplier; R is the actual number of bits required for encoding the image block in this mode, including the sum of bits required for encoding mode information, motion information, residual, etc.
[0094] When selecting a mode, if you use the RDO principle to make comparison decisions on the encoding mode, you can usually ensure the best encoding performance.
[0095] 2. Tree Coding Unit (CTU): Traditional video coding is based on macroblocks. For videos in 4:2:0 sampling format, a macroblock contains a 16×16 luminance block and two 8×8 chrominance blocks. Considering the characteristics of HD / UHD videos, Versatile Video Coding (VVC) introduces CTU, whose size is specified by the encoder and is allowed to be larger than the macroblock size. A luminance coding tree block (CTB) and two chrominance CTBs at the same location, plus corresponding syntax elements, form a CTU. In VVC, for an L×L luminance CTB, L∈{8, 16, 32, 64, 128}.
[0096] The range of brightness CTB size is: {8×8, 16×16, 32×32, 64×64, 128×128}
[0097] The chroma CTB size range is {4×4, 8×8, 16×16, 32×32, 64×64}
[0098] In the high-resolution video encoding process, using a larger CTB can achieve better compression effect.
[0099] 3. Deblocking filter: The image encoding process is based on different blocks. Each block is encoded relatively independently. Since each block uses different parameters, the distribution characteristics within the block are independent of each other, resulting in discontinuity at the edge of the block, which can be called the block effect. Deblocking filter mainly smoothes the boundaries of the blocks to remove the block effect.
[0100] 4. Sample adaptive compensation: Starting from the pixel domain, the reconstructed image is classified according to its characteristics, and then compensation is performed in the pixel domain. This is mainly to reduce the ringing effect.
[0101] 5. Adaptive loop filtering (ALF filtering): Applied after DB and SAO, the main purpose is to further improve the image quality under objective conditions. ALF technology builds a multivariate linear regression model based on least squares according to the characteristics of reference pixels, and performs filtering compensation in the pixel domain.
[0102] 6. Wiener filtering: The essence is to minimize the mean square value of the estimation error (defined as the difference between the expected response and the actual output of the filter).
[0103] 2. The main process of video encoding and decoding
[0104] Please refer to Figure 1In (a), taking video coding as an example, video coding generally includes prediction, transformation, quantization, entropy coding and other processes. Furthermore, the coding process can also be Figure 1 It can be implemented by the framework of (b) in the figure.
[0105] Among them, prediction can be divided into intra-frame prediction and inter-frame prediction. Intra-frame prediction uses the surrounding coded blocks as references to predict the current uncoded block, effectively removing redundancy in the spatial domain. Inter-frame prediction uses the neighboring coded images to predict the current image, effectively removing redundancy in the temporal domain.
[0106] Transformation refers to converting an image from the spatial domain to the transform domain, and using transform coefficients to represent the image. Most images contain many flat areas and slowly changing areas. Appropriate transformation can transform the image from a dispersed distribution in the spatial domain to a relatively concentrated distribution in the transform domain, remove the frequency domain correlation between signals, and cooperate with the quantization process to effectively compress the bit stream.
[0107] Entropy coding is a lossless coding method that can transform a series of element symbols into a binary code stream for transmission or storage. The input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform quantization related syntax, etc. Entropy coding can effectively remove the redundancy of video element symbols.
[0108] The above is introduced using encoding as an example. The processes of video decoding and video encoding are relative, that is, video decoding usually includes entropy decoding, prediction, inverse quantization, inverse transformation, filtering and other processes. The implementation principles of each process are the same or similar to entropy coding.
[0109] 3. Implementation of ALF filtering technology
[0110] The ALF encoding process may include: region division → obtaining reference pixels → region merging and calculating filter coefficients → CTU decision to determine whether to start filtering for each LCU.
[0111] The parameters that need to be calculated and obtained in the whole process are:
[0112] 1) Number of filter parameters;
[0113] 2) Regional merger mark;
[0114] 3) Each group of filter coefficients;
[0115] 4) Whether LCU starts filtering identification;
[0116] 5) Whether the filtering flag is enabled for the current component (Y, U, V).
[0117] The following is a detailed description of some of the processing and concepts in the ALF filtering process.
[0118] 1. Regional division
[0119] In the ALF process, for the acquired reconstructed video data, the data on the luminance component is processed in a partitioned manner, and the data on the chrominance component is processed in a non-partitioned manner.
[0120] Exemplarily, the specific implementation process of region division can be: divide the image into 16 regions of substantially equal size and aligned based on LCU. The width of the non-rightmost region is (((pic_width_InLcus+1) / 4)×Lcu_Width), where pic_width_InLcus represents the number of LCUs on the image width, and Lcu_Width represents the width of each LCU. The width of the rightmost region is the difference between the image width and the width of the non-rightmost three regions (the image width minus the total width of the non-rightmost three regions).
[0121] Similarly, the height of the non-bottom area is (((pic_height_InLcus+1) / 4)×Lcu_Height), where pic_height_InLcus represents the number of LCUs in the image height, and Lcu_Height represents the height of each LCU. The height of the bottommost area is the difference between the image height and the height of the three non-bottom areas (the image height minus the total height of the three non-bottommost areas).
[0122] After obtaining the region division results of the entire image, an index value is assigned to each region. The schematic diagram can be as follows Figure 2 shown.
[0123] 2. Regional merger
[0124] The region merging operation refers to judging whether adjacent regions should be merged according to the order of index values. The purpose of merging is to reduce the coding coefficient. A merge flag is required to indicate whether the current region is merged with the adjacent region.
[0125] For example, after the area division is performed according to the above area division method, a total of 16 areas are included (which can be called 16 categories or 16 groups, with index values 0 to 15 respectively). During the first merger, you can try to merge area 0 and area 1, merge area 1 and area 2, merge area 2 and area 3, ..., merge area 13 and area 14, merge area 14 and area 15 in turn, and perform the first area merger in the merging method with the smallest error, so that the 16 areas become 15 areas after merger.
[0126] For the 15 regions after the first merger (assuming that region 2 and region 3 are merged to obtain region 2+3), try to merge region 0 with region 1, region 1 with region 2+3, region 2+3 with region 4, ..., region 13 with region 14, region 14 with region 15 in turn, and perform a second region merger in the merging method with the smallest error, so that the 15 regions become 14 regions after merger.
[0127] For the 14 regions after the second merger (assuming that region 14 and region 15 are merged to obtain region 14+15, that is, the merged region includes region 2+3 and region 14+15), try to merge region 0 with region 1, region 1 with region 2+3, region 2+3 with region 4, ..., region 12 with region 13, region 13 with region 14+15 in turn, and perform the third region merger in the merging method with the smallest error, so that the 14 regions become 13 regions after the merger.
[0128] And so on, until it is merged into one area, the schematic diagram can be as follows Figure 3 shown.
[0129] After completing the above region merging operation, the error of Wiener filtering on the entire frame image can be calculated in sequence under the conditions of no region merging (a total of 16 regions), one region merging (a total of 15 regions), ..., 14 region merging (a total of 2 regions), and 15 region merging (a total of 1 region), and the region merging method with the smallest error is determined as the final region merging method.
[0130] 3. Reference pixels and filter coefficients
[0131] After the regions are divided in the above manner, the filter coefficients may be calculated based on the reference pixels of each pixel in each region according to the Wiener filter principle.
[0132] For all pixels involved in filtering, take each pixel as the center, take the surrounding pixels within a certain range as reference pixels, take the reference pixels and the current pixel as input, take the original value of each pixel as the target, and calculate the filtering coefficient using the least squares method.
[0133] See also Figure 4A , is a schematic diagram of a filter shape, such as Figure 4A As shown, it is a centrosymmetric filter shape of 7*7 cross plus 5*5 square. The reference pixels corresponding to the filter coefficients can be found in Figure 4B .
[0134] like Figure 4B As shown, the central symmetric filters P0 and P28 The filter coefficients are the same, so when training at the encoding end, (P i +P 28-i , i = 0, ..., 13) as the same feature input, P 14 It is input as a feature and 15 filter coefficients are trained.
[0135] That is, the reference pixel is selected as:
[0136] E[i]=(P i +P 28-i )
[0137] E
[14] =P14
[0138] Among them, P i Belongs to the pixel in the reconstructed image before filtering, E[i] is the value of the reference pixel, i = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13.
[0139] The goal of Wiener filtering is to linearly combine the reference pixel values to make them close to the pixel values of the original image.
[0140] The ALF technology is based on the largest coding unit (LCU) for processing. LCUs belonging to the same merged area are filtered using the same set of filter coefficients.
[0141] 4. Adaptive correction filter unit
[0142] like Figure 5 As shown, the adaptive correction filter unit is derived according to the current maximum coding unit in the following steps:
[0143] 4.1. Delete the portion of the sample area where the current largest coding unit C is located that exceeds the image boundary to obtain the sample area D;
[0144] 4.2. If the sample at the lower boundary of sample area D does not belong to the lower boundary of the image, shrink the lower boundary of the luminance component and chrominance component sample area D by four rows upward to obtain sample area E1; otherwise, let sample area E1 be equal to sample area D. The last row of samples in sample area D is the lower boundary of the area;
[0145] 4.3. If the sample at the upper boundary of sample area E1 belongs to the upper boundary of the image, or belongs to the slice boundary and the value of cross_patch_loopfilter_enable_flag is '0', let sample area E2 be equal to sample area E1; otherwise, extend the upper boundary of luminance component and chrominance component sample area E1 upward by four rows to obtain sample area E2. The first row of samples in sample area E1 is the upper boundary of the area;
[0146] 4.4. The sample area E2 is used as the current adaptive correction filter unit. The first row of samples of the image is the upper boundary of the image, and the last row of samples is the lower boundary of the image.
[0147] 5. Adaptive correction filtering operation
[0148] When it is determined to filter the current adaptive filtering unit, the reference pixel used in the adaptive correction filtering process is a sample in the adaptive correction filtering unit, and the sample is directly used for filtering;
[0149] If the sample used in the adaptive correction filtering process is a sample in the adaptive correction filtering unit, the sample is directly used for filtering; otherwise, filtering is performed in the following manner:
[0150] 5.1. If the sample is outside the image boundary or outside the slice boundary and the value of cross_patch_loopfilter_enable_flag is '0', that is, filtering across the slice boundary is allowed, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0151] 5.2. Otherwise, if the sample is outside the upper boundary or the lower boundary of the adaptive correction filter unit, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0152] 5.3. If the sample is neither outside the upper boundary of the adaptive correction filter unit nor outside the lower boundary of the adaptive correction filter unit, the sample is directly used for filtering.
[0153] 6. Coding Tree Unit (CTU) Decision
[0154] For the encoding end device, after the region merging calculation obtains the filter coefficients of each region, a CTU decision needs to be made. The CTU decision is also based on the LCU as the basic unit to determine whether each LCU in the current image uses ALF (that is, whether to start the Wiener filter).
[0155] The encoding end device can calculate the rate distortion cost before and after the current LCU is turned on and off to determine whether the current LCU uses ALF. If the current LCU is marked as using ALF, Wiener filtering is performed on each pixel in the LCU.
[0156] In the related art, the ALF technology only transmits a fixed set of filter coefficients for each area, and the shape of the filter coefficients is fixed. Therefore, there may be some problems, such as: the fixed divided areas cannot divide pixels with the same characteristics into the same category, or the shape of the filter used is not appropriate. At the same time, for the divided areas, each area can only transmit a set of filter coefficients at most. For larger areas or areas with complex image textures, one set of filter coefficients is not enough.
[0157] In order to optimize the ALF filtering effect and improve the encoding and decoding performance, the embodiment of the present application proposes the following optimization scheme:
[0158] Solution 1: For each frame, LCU is used as the smallest unit and is adaptively divided into multiple regions, where each region may include more than one LCU. Therefore, it is proposed to classify each LCU and divide the LCUs in the same region into N categories, where N is a positive integer.
[0159] Exemplarily, if the LCUs in each region are classified into the same category, then the fixed region division scheme of the traditional ALF scheme is used. In one example, in order to distinguish from the fixed region division method of the traditional ALF scheme, N≥2.
[0160] Solution 2: Multiple sets of filter coefficients can be transmitted in each region, and the shape of each set of filters can be the same or different.
[0161] Solution 3: A set of filter coefficients is adaptively selected based on each LCU. The LCU in the same area can select the filter coefficients of the adjacent area.
[0162] Solution 4: Each region can only pass one set of filter coefficients, but the filter shape of each region can be different.
[0163] Solution 5: Modify the symmetric filter into an asymmetric filter, make the filter coefficients at the symmetric positions the same, and optimize the filter coefficients at the symmetric positions to meet a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
[0164] Solution 6: Optimize the sample values at the boundary during filtering.
[0165] In order to make the above-mentioned purposes, features and advantages of the embodiments of the present application more obvious and easy to understand, the technical solutions in the embodiments of the present application are further described in detail below with reference to the accompanying drawings.
[0166] It should be noted that the following text takes the ALF filtering performed by the solution provided in the embodiment of the present application at the size of LCU as an example, but this is not a limitation on the scope of protection of the present application. In the embodiment of the present application, other sizes or methods of representing image blocks may also be used instead, such as an image block of size N*M, where N is a positive integer less than or equal to the width of the image frame, and M is a positive integer less than or equal to the height of the image frame.
[0167] Embodiment 1
[0168] See also Figure 6 , is a flow chart of a filtering method provided in an embodiment of the present application, wherein the filtering method can be applied to a decoding end device, such as Figure 6 As shown, the filtering method may include the following steps:
[0169] Step S600: dividing the brightness component of the current image frame into regions.
[0170] Exemplarily, the implementation of the regional division of the brightness component of the image frame can refer to the relevant description of the "region division" part above, and the embodiments of the present application will not be described here.
[0171] Step S610: Determine the region category to which the LCU belongs based on the region category identifier of the LCU obtained by parsing the bitstream.
[0172] In an embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, when the brightness component of the image frame is divided into multiple regions according to a fixed region division method, for each region, the LCU in the region can be classified based on the pixel characteristics of each pixel in the region, and the LCU in the region can be divided into at least one category, that is, a region can be divided into at least one region (which can be called a sub-region or region category) by LCU classification.
[0173] Exemplarily, for any LCU, the category of the region to which it belongs may be determined based on the region to which the LCU belongs and the category of the LCU within the region to which it belongs.
[0174] Exemplarily, when the encoding end device sends a bitstream to the decoding end device, the region category identifier used to identify the region category to which each LCU belongs may be carried in the bitstream and sent to the decoding end device.
[0175] Exemplarily, for any LCU, the decoding end device may parse the region category identifier of the LCU from the bitstream, and determine the region category to which the LCU belongs based on the region category identifier of the LCU obtained by parsing.
[0176] Step S620: Determine the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient obtained by parsing the bitstream.
[0177] In an embodiment of the present application, when the LCUs in each area are classified in the above manner, the encoding end device can merge the areas of each area category to obtain at least one merged area (which can be called a merged area) and determine the filter coefficients of each merged area.
[0178] Exemplarily, the implementation method of merging regions for each region category is similar to the relevant description in the “region merging” section above, and the embodiments of the present application are not described in detail here.
[0179] Exemplarily, for any region category, the encoding end device may allocate a coefficient index to it based on the merged region to which it belongs, and the coefficient index corresponds to a filter coefficient of one of the merged regions.
[0180] The encoding end device may write the filter coefficients of each merged region and the index of each region category into the bitstream and send it to the decoding end device.
[0181] Exemplarily, for any LCU, the decoding end device can determine the coefficient index of the region category to which the LCU belongs based on the region category to which the LCU belongs, and determine the filter coefficient of the LCU based on the coefficient index and the filter coefficient parsed from the bitstream.
[0182] Step S630: Perform ALF filtering on the pixels of the LCU one by one based on the filter coefficient of the LCU.
[0183] In the embodiment of the present application, for any LCU, when the filter coefficient of the LCU is determined, ALF filtering can be performed on the pixels of the LCU one by one based on the filter coefficient of the LCU.
[0184] It can be seen that by classifying the LCUs in the area divided according to the fixed area division method, the area division is made more consistent with the pixel characteristics of each LCU, thereby optimizing the ALF filtering effect and improving the encoding and decoding performance.
[0185] In one embodiment, in step S610, based on the region category identifier of the LCU parsed from the bitstream, determining the region category to which the LCU belongs includes:
[0186] Based on the region to which the LCU belongs and the region category identifier of the LCU, the region category to which the LCU belongs is determined.
[0187] Exemplarily, for any LCU, the region category to which the LCU belongs may be determined based on the region to which the LCU belongs (the region obtained according to a fixed region division method) and the region category identifier of the LCU.
[0188] In an example, the region category identifier of the LCU is used to identify the category of the LCU in the region to which the LCU belongs, and the category of the LCU in the region to which the LCU belongs is determined by classifying each LCU in the region to which the LCU belongs;
[0189] The above-mentioned determining the region category to which the LCU belongs based on the region to which the LCU belongs and the region category identifier of the LCU may include:
[0190] The region category to which the LCU belongs is determined based on the number of categories of each region, the region to which the LCU belongs, and the region category identifier of the LCU.
[0191] Exemplarily, for any LCU, the decoding end device may determine the category of the LCU in the region to which it belongs based on the region category identifier of the LCU obtained by parsing the bitstream.
[0192] For example, assuming that the LCUs in a region are divided into at most two categories, the region category identifier of the LCUs divided into the first category may be 0; and the region category identifier of the LCUs divided into the second category may be 1.
[0193] For any LCU in any area, when the value of the area category identifier of the LCU obtained by parsing the bitstream is 0, it can be determined that the category of the LCU in the area is the first category; when the value of the area category identifier of the LCU obtained by parsing the bitstream is 1, it can be determined that the category of the LCU in the area is the second category.
[0194] Exemplarily, for any LCU, the decoding end device may determine the region category to which the LCU belongs based on the number of categories of each category, the region to which the LCU belongs, and the region category to which the LCU belongs.
[0195] As an example, the above-mentioned determination of the region category to which the LCU belongs based on the number of categories of each region, the region to which the LCU belongs, and the region category identifier of the LCU may include:
[0196] Determine the total number of categories of the regions before the region to which the LCU belongs based on the number of categories of the regions before the region to which the LCU belongs;
[0197] The category of the region to which the LCU belongs is determined based on the total number of categories of the regions before the region to which the LCU belongs and the region category identifier of the LCU.
[0198] Exemplarily, for any LCU, the total number of categories of regions before the region to which the LCU belongs can be determined based on the number of categories of each region, and the category of the region to which the LCU belongs can be determined based on the total number of categories of regions before the region to which the LCU belongs and the region category identifier of the LCU.
[0199] For example, assuming that the brightness of the current image frame is divided into L areas, and the LCUs in each area are divided into N categories, then for any LCU in area K, when the value of the area category identifier of the LCU obtained by parsing the bitstream is m, it can be determined that the area category to which the LCU belongs is N*K+m; where m∈[0, N-1], N≥1, K∈[0, L-1].
[0200] In some embodiments, in step S620, before determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream, the following may also be included:
[0201] Determine whether to enable ALF filtering for LCU;
[0202] When it is determined to start ALF filtering for the LCU, it is determined to perform the above operation of determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient obtained by parsing the bitstream.
[0203] Exemplarily, for any LCU, the encoding end device may determine whether to start ALF filtering for the LCU based on the RDO decision.
[0204] Exemplarily, before performing ALF filtering on an LCU, the decoding end device may first determine whether to start ALF filtering on the LCU.
[0205] For example, the decoding end device may determine whether to enable ALF filtering for the LCU based on an identifier obtained by parsing the bitstream and used to identify whether to enable ALF filtering for the LCU.
[0206] When the decoding end device determines to start ALF filtering for the LCU, the filter coefficient of the LCU may be determined based on the region category to which the LCU belongs and the filter coefficient obtained by parsing the bitstream in the manner described in the above embodiment.
[0207] In an example, the determining whether to start ALF filtering for the LCU may include:
[0208] Parsing an LCU coefficient identifier of the LCU from a bitstream; wherein the LCU coefficient identifier is used to identify a filter coefficient used by the LCU in at least one set of filter coefficients used in a merged region to which the LCU belongs;
[0209] When the value of the LCU coefficient identifier of the LCU is not the first value, it is determined to start ALF filtering for the LCU.
[0210] For example, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the filter coefficients used in a merged area are no longer limited to one set of filter coefficients, but one or more sets of filter coefficients can be selected and used according to actual conditions.
[0211] Exemplarily, for any merged area, the encoding end device can train multiple groups of filter coefficients and determine that the merged area uses one or more groups of filter coefficients based on the RDO decision. For any LCU in the area, the encoding end device can identify the filter coefficient used by the LCU in one or more groups of filter coefficients used by the merged area through an LCU coefficient identifier.
[0212] Exemplarily, for any LCU, when the value of the LCU coefficient identifier of the LCU is the first value, it indicates that ALF filtering is not started for the LCU.
[0213] For any LCU, when the value of the LCU coefficient identifier of the LCU parsed from the bitstream by the decoding end device is not the first value, it can be determined to start ALF filtering for the LCU.
[0214] For example, assuming that the first value is 0, for any LCU, when the value of the LCU coefficient identifier of the LCU obtained by the decoding end device from the bit stream is 0, it can be determined that ALF filtering is not started for the LCU; when the LCU coefficient identifier of the LCU obtained by the decoding end device from the bit stream is not 0, it can be determined that ALF filtering is started for the LCU. At this time, the decoding end device can determine the filter coefficient used by the LCU according to the LCU coefficient identifier of the LCU.
[0215] It should be noted that when the value of the LCU coefficient identifier of the LCU is not the first value, if the merged area to which the LCU belongs uses a set of filter coefficients, the filter coefficient of the LCU is this set of filter coefficients; if the merged area to which the LCU belongs uses multiple sets of filter coefficients, it is also necessary to determine the filter coefficient of the LCU based on the specific value of the LCU coefficient identifier of the LCU.
[0216] In an example, determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream may include:
[0217] The filter coefficient of the LCU is determined based on the region category to which the LCU belongs, the filter coefficient parsed from the bitstream, and the region coefficient identifier of the merged region to which the LCU belongs parsed from the bitstream; wherein the region coefficient identifier is used to identify the filter coefficient used by the merged region to which the LCU belongs in the preset multiple groups of filter coefficients.
[0218] Exemplarily, for any merged area, the encoding end device can train multiple groups of filter coefficients, and determine based on the RDO decision that the merged area uses one or more of the multiple groups of filter coefficients, and write the regional coefficient identifier used to identify the filter coefficients used by the merged area into the bitstream.
[0219] Exemplarily, for any LCU of any merged area, the decoding end device may determine the filter coefficient used for the merged area based on the area coefficient identifier of the merged area obtained by parsing the bitstream.
[0220] For example, assuming that the preset multiple groups of filter coefficients include two groups of filter coefficients (assuming filter coefficient A and filter coefficient B), for any merged area, when the encoding end device determines that the merged area uses filter coefficient A, the encoding end device determines that the value of the region coefficient identifier of the merged area is 0; when the encoding end device determines that the merged area uses filter coefficient B, the encoding end device determines that the value of the region coefficient identifier of the merged area is 1; when the encoding end device determines that the merged area uses filter coefficient A and filter coefficient B, the encoding end device determines that the value of the region coefficient identifier of the merged area is 2.
[0221] For any merged area, when the value of the region coefficient identifier of the merged area parsed by the decoding end device from the bit stream is 0, it is determined that the region uses filter coefficient A; when the value of the region coefficient identifier of the merged area parsed by the decoding end device from the bit stream is 1, it is determined that the merged area uses filter coefficient B; when the value of the region coefficient identifier of the merged area parsed by the decoding end device from the bit stream is 2, it is determined that the merged area uses filter coefficient A and filter coefficient B.
[0222] Exemplarily, for any merged area, when the decoding end device determines that the merged area uses a set of filter coefficients based on the area coefficient identifier of the merged area obtained by parsing the bit stream, for any LCU of the merged area, when it is determined to start ALF filtering for the LCU, if the value of the LCU coefficient identifier of the LCU is not the first value, it can be determined that the filter coefficient used by the LCU is the filter coefficient used by the merged area; when the decoding end device determines that the merged area uses multiple sets of filter coefficients based on the area coefficient identifier of the merged area obtained by parsing the bit stream, when it is determined to start ALF filtering for the LCU, the filter coefficient used by the LCU (a set of filter coefficients among the multiple sets of filter coefficients used by the merged area) can be determined based on the LCU coefficient identifier of the LCU.
[0223] As an example, determining the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient obtained by parsing the bitstream, and the region coefficient identifier of the merged region to which the LCU belongs obtained by parsing the bitstream may include:
[0224] When it is determined that the merged area to which the LCU belongs uses multiple sets of filter coefficients based on the area coefficient identifier of the merged area to which the LCU belongs, the filter coefficient of the LCU is determined based on the area category to which the LCU belongs, the filter coefficient parsed from the bitstream, and the LCU coefficient identifier of the LCU.
[0225] Exemplarily, for any LCU, when the decoding end device determines the area category to which the LCU belongs based on the area category identifier of the LCU obtained by parsing the bit stream, it can also determine the merged area to which the LCU belongs based on the area category to which the LCU belongs, and determine the filter coefficient used by the area category based on the area coefficient identifier of the merged area to which the area category belongs obtained by parsing the bit stream.
[0226] For example, assuming that the brightness component of the current image frame is divided into 16 regions according to a fixed region division method, a total of 32 region categories are obtained by classifying the LCU of the region class. After the region categories are merged, an index table can be obtained based on the region category merging situation. The index table can be a 32-element one-dimensional vector, and each element in the 32-element one-dimensional vector is, in turn, the index of the merged region to which each region category belongs.
[0227] Assuming that the 32-element one-dimensional vector is {a1, a2, a3, ..., a32}, then a1 is the index of the merged region belonging to region category 0 ... a32 is the index of the merged region belonging to region category 32. Assuming that a1 to a5 are all 0 and a6 to a11 are all 1, it means that region categories 0 to 4 are merged into merged region 0, and region categories 5 to 10 are merged into merged region 1.
[0228] The encoding end device can send the above-mentioned index table to the decoding end device through the code stream, so that the decoding end device determines the merged area to which each area category belongs based on the index table parsed from the code stream. Therefore, for any LCU, the area category to which the LCU belongs can be determined based on the area category identifier of the LCU, and the merged area to which the LCU belongs can be determined according to the area category to which the LCU belongs.
[0229] When the decoding end device determines that the merged area to which the LCU belongs uses multiple sets of filter coefficients, the decoding end device may determine the filter coefficients used by the LCU based on the LCU coefficient identifier of the LCU obtained by parsing the bitstream.
[0230] It should be noted that, for any merged region, the filter shapes of the multiple sets of filter coefficients used in the merged region may be completely the same or not completely the same.
[0231] For example, assuming that merge area 1 uses filter coefficient A, filter coefficient B and filter coefficient C, the filter shapes of filter coefficient A, filter coefficient B and filter coefficient C can be the same, or different, or partially the same, such as the filter shapes of filter coefficient A and filter coefficient B are the same, but the filter shapes of filter coefficient A and filter coefficient C are different.
[0232] In some embodiments, in step S620, based on the region category to which the LCU belongs and the filter coefficients parsed from the bitstream, determining the filter coefficients of the LCU may include:
[0233] The filter coefficient of the LCU is determined based on the region category to which the LCU belongs, the filter coefficient obtained by parsing the bitstream, and the coefficient selection identifier of the LCU; wherein the coefficient selection identifier is used to identify the filter coefficient selected by the LCU for use from multiple groups of candidate filter coefficients.
[0234] Exemplarily, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the LCU is no longer limited to selecting the filter coefficients of the merged area to which it belongs, but can adaptively select a set of filter coefficients from multiple sets of filter coefficients for ALF filtering.
[0235] Exemplarily, for any LCU, the candidate filter coefficients of the LCU may include but are not limited to the filter coefficients of the merged area to which it belongs and the filter coefficients of the adjacent merged areas to which it belongs. Thus, when a set of filter coefficients is transmitted in each merged area, an LCU may have multiple sets of candidate filter coefficients, thereby improving the flexibility of LCU filter coefficient selection, optimizing the ALF filtering effect, and improving the encoding and decoding performance.
[0236] Exemplarily, for any LCU, the encoding end device may determine the filter coefficient used by the LCU from multiple groups of candidate filter coefficients based on the RDO decision, and write a coefficient selection identifier corresponding to the filter coefficient into a bitstream and send it to the decoding end device.
[0237] The decoding end device may determine the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient obtained by parsing the bitstream, and the coefficient selection identifier of the LCU.
[0238] In an example, determining the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient obtained by parsing the bitstream, and the coefficient selection identifier of the LCU may include:
[0239] When the value of the coefficient selection flag of the LCU is the first value, determining the filter coefficient of the previous merging area of the merging area to which the LCU belongs as the filter coefficient of the LCU;
[0240] When the value of the coefficient selection flag of the LCU is the second value, the filter coefficient of the merged area to which the LCU belongs is determined as the filter coefficient of the LCU;
[0241] When the value of the coefficient selection flag of the LCU is the third value, the filter coefficient of the next merging area of the merging area to which the LCU belongs is determined as the filter coefficient of the LCU.
[0242] Exemplarily, for any LCU, its candidate filter coefficients may include the filter coefficient of the merged region to which it belongs, the filter coefficient of the merged region before the merged region to which it belongs, and the filter coefficient of the merged region after the merged region to which it belongs.
[0243] Exemplarily, the previous merged region of the merged region to which the LCU belongs is a merged region corresponding to a previous adjacent index of the index of the merged region to which the LCU belongs.
[0244] Exemplarily, the next merged region to which the LCU belongs is a merged region corresponding to a next adjacent index of the index of the merged region to which the LCU belongs.
[0245] For example, assuming that the merged area to which the LCU belongs is merged area 2, and its corresponding index is 2, then the previous merged area of the merged area to which the LCU belongs is the merged area corresponding to the previous adjacent index of index 2 (i.e., 1) (i.e., merged area 1), and the next merged area of the merged area to which the LCU belongs is the merged area corresponding to the next adjacent index of index 2 (i.e., 3) (i.e., merged area 3).
[0246] Exemplarily, for any LCU, the encoding end device can determine the filter coefficient it uses based on the RDO decision. When determining that the filter coefficient used by the LCU is the filter coefficient of the previous merged area of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a first value, such as 0; when determining that the filter coefficient used by the LCU is the filter coefficient of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a second value, such as 1; when determining that the filter coefficient used by the LCU is the filter coefficient of the next merged area of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a third value, such as 2.
[0247] Exemplarily, for any LCU, when the value of the coefficient selection identifier of the LCU obtained by the decoding end device from the bit stream is a first value, the filter coefficient of the previous merged area of the merged area to which the LCU belongs can be determined as the filter coefficient of the LCU; when the value of the coefficient selection identifier of the LCU obtained from the bit stream is a second value, the filter coefficient of the merged area to which the LCU belongs can be determined as the filter coefficient of the LCU; when the value of the coefficient selection identifier of the LCU obtained from the bit stream is a third value, the filter coefficient of the next merged area of the merged area to which the LCU belongs can be determined as the filter coefficient of the LCU.
[0248] In some embodiments, obtaining the filter coefficients by parsing the bitstream may include:
[0249] For any merged region, the filter shape of the merged region is parsed from the bitstream;
[0250] Based on the filter shape, the filter coefficients of the merged area are parsed from the bitstream.
[0251] For example, in order to improve the flexibility of the filter coefficients, optimize the ALF filtering effect, and improve the encoding and decoding performance, each merged area is no longer restricted to using the same filter shape, but can selectively use different filter shapes, that is, the filter shapes used in different merged areas can be the same or different.
[0252] Exemplarily, for any merged area, the encoding end device can train multiple sets of filter coefficients with different filter shapes, and determine the filter shape and filter coefficients used in the merged area based on the RDO decision, and write the filter shape and filter coefficients into the code stream and send it to the decoding end device.
[0253] Exemplarily, for any merged region, when obtaining the filter coefficient of the merged region, the decoding end device may parse the filter shape of the merged region from the bitstream, and parse the filter coefficient of the region category from the bitstream based on the filter shape.
[0254] In an example, determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream may include:
[0255] Determine the filter shape and filter coefficient of the LCU based on the region category to which the LCU belongs and the filter shape and filter coefficient obtained by parsing the bitstream;
[0256] The above-mentioned ALF filtering of the pixels of the LCU one by one based on the filter coefficient of the LCU may include:
[0257] ALF filtering is performed on the pixels of the LCU one by one based on the filter shape and filter coefficient of the LCU.
[0258] Exemplarily, for any LCU, the merged area to which the LCU belongs can be determined based on the area category to which the LCU belongs, the filter shape and filter coefficient of the merged area can be parsed from the bitstream, the filter shape and filter coefficient can be determined as the filter shape and filter coefficient of the LCU, and ALF filtering can be performed on the pixels of the LCU one by one based on the filter shape and filter coefficient.
[0259] It should be noted that, in the embodiment of the present application, the filter shape may also be selected for the image frame, or for the components of the image frame (such as the brightness component and / or the chrominance component). Figure 4A The filter shape shown is a 7*7 cross plus a 5*5 square centrosymmetric filter shape. Then, each LCU in the image frame A that starts ALF filtering uses a 7*7 cross plus a 5*5 square centrosymmetric filter shape.
[0260] In some embodiments, in step S630, performing ALF filtering on the pixels of the LCU one by one based on the filter coefficient of the LCU may include:
[0261] Based on the filter coefficient of the LCU and the weight coefficient of each reference pixel position corresponding to the merged area to which the LCU belongs, which is parsed from the bitstream, ALF filtering is performed on the pixels of the LCU one by one.
[0262] For example, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the filter used for ALF filtering is no longer limited to a symmetric filter, but an asymmetric filter can be used, that is, the positionally symmetrical filter coefficients can be different and satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
[0263] It should be noted that, when ALF filtering is performed based on a determined filter coefficient, for any filter coefficient at a non-central position, it is necessary to obtain the filtered pixel value based on the sum of the products of the filter coefficient and the filter coefficient at a symmetrical position of the filter coefficient and the reference pixels at the corresponding positions. Therefore, the above ratio can be used as the ratio between the filter coefficients at symmetrical positions, or it can also be used as the ratio of the weighted proportions of the pixel values of the reference pixels corresponding to the filter coefficients at the symmetrical positions participating in the ALF filtering calculation (also referred to as the weight ratio), that is, the above asymmetric filter means that the filter coefficients at the symmetrical positions are different, or the pixel values of the reference pixels corresponding to the filter coefficients at the symmetrical positions have different weights when participating in the ALF filtering calculation.
[0264] For example, the filter coefficient C of the centrosymmetric filter shape of 7*7 cross plus 5*5 square isi , the filter coefficient of its symmetrical position is C 28-i , then C i :C 28-i =A i :(2-A i ), or, P i and P 28-i The weighted ratio when participating in the ALF filtering calculation is A i :(2-A i ), P i C i The pixel value at the corresponding reference pixel position, P 28-i C 28-i The pixel value of the corresponding reference pixel position, for any pixel of the LCU, the pixel value of the pixel after filtering can be determined by:
[0265]
[0266] Among them, C i is the (i+1)th filter coefficient in the filter coefficients of the merged area to which the LCU belongs, P i is the filter coefficient C i The pixel value at the corresponding reference pixel position, P 28-i The corresponding reference pixel position and P i The corresponding reference pixel position is symmetrical about the pixel position of the current filtering pixel, A i P i The weight coefficient of the pixel value at the corresponding reference pixel position, P 14 is the pixel value of the current filtered pixel, C 14 is the filter coefficient of the current filter pixel, 0<A i <2.
[0267] For example, for any merged region, the encoding end device can determine the filter coefficients and filtering performance of the merged region under different weight coefficients corresponding to each position. Select a set of filter coefficients with the best filtering performance, record the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter, and write them into the bitstream and send them to the decoding end device.
[0268] For example, a weight coefficient set (such as A i A value set is obtained, and each weight coefficient is selected from the set to obtain the filter coefficient with the best filtering performance and the corresponding weight coefficient at each position of the corresponding filter, and the index of the weight coefficient in the weight coefficient set is written into the bitstream and sent to the decoding end device.
[0269] For any LCU, the decoding end device can parse the bitstream to obtain the filter coefficient of the merged area to which the LCU belongs, as well as the weight coefficient of each reference pixel position corresponding to the merged area to which the LCU belongs, and perform ALF filtering on the pixels of the LCU one by one.
[0270] In some embodiments, in step S630, performing ALF filtering on the pixels of the LCU one by one based on the filter coefficient of the LCU may include:
[0271] For any pixel of the LCU, in the process of performing ALF filtering on the pixel, the pixel value of the pixel is updated based on the pixel values of the surrounding pixels of the pixel;
[0272] Based on the updated pixel value of the pixel, ALF filtering is performed on the pixel.
[0273] For example, considering that for any pixel position, when the pixel value of the pixel position is too large or too small, the filtering performance of filtering the pixel position using traditional ALF technology is poor. Therefore, in order to optimize the ALF filtering effect, for any pixel, in the process of ALF filtering the pixel, the pixel value of the pixel can be updated based on the pixel values of the surrounding pixels of the pixel, so that the pixel value of the pixel position is smoother than the pixel values of the surrounding pixels.
[0274] In an example, updating the pixel value of the pixel based on the pixel values of surrounding pixels of the pixel may include:
[0275] Determine the maximum and minimum values of the pixel values of each pixel except the center position in the target pixel block; wherein the target pixel block is a 3*3 pixel block with the pixel as the center position;
[0276] When the pixel value of the pixel is greater than the maximum value, the pixel value of the pixel is updated to the maximum value;
[0277] When the pixel value of the pixel is less than the minimum value, the pixel value of the pixel is updated to the minimum value.
[0278] Exemplarily, the surrounding pixels of a pixel are taken as the 8 neighboring pixels of the pixel, that is, the remaining pixels except the center position in a 3*3 pixel block (referred to as a target pixel block in this article) with the pixel as the center position.
[0279] For any pixel in any LCU, the pixel values of each pixel except the central position in the target pixel block may be determined, and the maximum value and the minimum value of each pixel value may be determined.
[0280] When the pixel value of the pixel is greater than the maximum value, the pixel value of the pixel is updated to the maximum value; when the pixel value of the pixel is less than the minimum value, the pixel value of the pixel is updated to the minimum value.
[0281] For example, Fig.15 Taking the 3*3 pixel block shown as an example, assuming that the current filtering pixel is pixel 0, and its surrounding pixels include 8 neighboring pixels of the pixel, namely pixel 1 to pixel 8, when filtering pixel 0, the pixel values of pixel 1 to pixel 8 can be obtained respectively, and the maximum and minimum values of the pixel values of the 8 pixels can be determined. Assuming that the pixel value of pixel 1 is the largest and the pixel value of pixel 8 is the smallest, the maximum value of the pixel values of the 8 pixels is the pixel value of pixel 1 (assuming p1), and the minimum value is the pixel value of pixel 8 (assuming p8), then the pixel value of pixel 0 (assuming p0) can be compared with p1 and p8, if p0>p1, the pixel value of pixel 0 is updated to p1; if p0<p8, the pixel value of pixel 0 is updated to p8.
[0282] Embodiment 2
[0283] See also Figure 7 , is a flow chart of a filtering method provided in an embodiment of the present application, wherein the filtering method can be applied to a coding / decoding end device, such as Figure 7 As shown, the filtering method may include the following steps:
[0284] Step S700: In the process of performing ALF filtering on any pixel in the current filtering unit, for any reference pixel, when the reference pixel is not in the current filtering unit, go to step S710.
[0285] Step S710, determine whether the pixel value of the reference pixel can be obtained; if so, go to step S730; otherwise, go to step S720.
[0286] Step S720: Use the current filtering unit and the pixel in the boundary area closest to the reference pixel to replace the reference pixel for filtering.
[0287] Step S730: Use the reference pixel to perform filtering.
[0288] Exemplarily, the filtering unit may be an LCU, or an image block obtained based on the LCU, for example, an image block obtained by cropping or expanding the LCU.
[0289] Exemplarily, the implementation of the filtering unit based on the LCU can refer to the relevant description in the "adaptive correction filtering unit" section above, and the embodiments of the present application will not go into details.
[0290] In an embodiment of the present application, considering that for the boundary pixels of the filtering unit, some of the reference pixels may be outside the filtering unit, that is, not in the filtering unit. At this time, the pixel values of these reference pixels may not be obtained.
[0291] In an example, the pixel value of the reference pixel that cannot be obtained may include but is not limited to one of the following:
[0292] The reference pixel is outside the image boundary, outside the slice boundary and filtering across the slice boundary is not allowed, and outside the upper boundary or the lower boundary of the current filtering unit.
[0293] For example, considering that for any pixel position, the other pixel positions closest to the pixel are usually also the pixel positions whose pixel values are closest to the pixel value of the pixel position. Therefore, in order to optimize the ALF filtering effect, in the case where the pixel value of the reference pixel cannot be obtained, the current filtering unit and the pixels closest to the reference pixel position in the boundary area can be used instead of the reference pixel for filtering.
[0294] Exemplarily, the distance between pixel positions may be a Euclidean distance.
[0295] Exemplarily, the boundary area includes the left boundary or the right boundary of the current filtering unit, the left boundary of the current filtering unit includes part or all of the area in the filtering unit adjacent to the left side of the current filtering unit, and the right boundary of the current filtering unit includes part or all of the area in the filtering unit adjacent to the right side of the current filtering unit.
[0296] For example, Figure 5 The filter unit shown (i.e. Figure 5 The sample filtering compensation unit in the example is taken as the current filtering unit, and the boundary area of the current filtering unit may include Figure 5 The three columns of pixels on the left side of the left boundary of the sample filter compensation unit shown (that is, the three columns of pixels close to the current filter unit in the filter unit on the left side of the current filter unit can be called the left boundary outside); the boundary area of the current filter unit may include Figure 5 The sample shown is 3 columns of pixels on the right side of the right boundary of the filtering and compensation unit (ie, 3 columns of pixels in the filtering unit on the right side of the current filtering unit and close to the current filtering unit, which can be called outside the right boundary).
[0297] It can be seen that in Figure 7 In the method flow shown, in the process of ALF filtering each pixel in the current filtering unit, for the reference pixel position that is not in the current filtering unit, when the pixel value of the reference pixel position cannot be obtained, the current filtering unit and the pixel closest to the reference pixel position in the boundary area are used to replace the reference pixel for filtering, thereby optimizing the ALF filtering performance and improving the encoding and decoding performance.
[0298] In some embodiments, when the pixel value of the reference pixel cannot be obtained, before the filtering using the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel, the following may also be included:
[0299] determining whether the reference pixel corresponds to a specified position of the filter shape;
[0300] If so, it is determined to perform the above-mentioned operation of using the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering.
[0301] Exemplarily, considering that for a reference pixel at a certain specific position, when the pixel value of the reference pixel cannot be obtained, the pixel value of the pixel position closest to the position in the boundary area cannot be obtained either.
[0302] For example, the reference pixel is located just to the left, just to the right, just above, or just below the current filtering pixel position.
[0303] For example, suppose the current filtering pixel position (i.e., C 14 The corresponding pixel position) is at the left boundary of the current filter unit. 11 The corresponding reference pixel position is located to the left of the current filtering pixel position and is 3 pixels away from the current filtering pixel position. The width of a filtering unit is usually greater than 3 pixels. Therefore, if C 11 If the pixel value of the corresponding reference pixel position cannot be obtained, it can be determined that the filter unit on the left side of the current filter unit is outside the boundary of the current image frame (i.e., the picture frame where the current filter unit is located), or outside the slice boundary of the current slice (i.e., the slice where the current filter unit is located) and filtering across the slice boundary is not allowed. At this time, the pixel position in the boundary area that is closest to the reference pixel position, i.e., C 12 The pixel value of the corresponding pixel position cannot be obtained. At this time, it is necessary to use the distance from the reference pixel position (C 11 The pixel value of the corresponding reference pixel position) is used to replace the reference pixel for filtering.
[0304] by Fig.17A Take the scenario shown in the figure as an example. When C 11 When the pixel value of the corresponding reference pixel position cannot be obtained, C 12 The corresponding reference pixel position cannot be obtained either.
[0305] For the reference pixel at the upper left, upper right, lower left or lower right position of the current filtering pixel position, when its pixel value cannot be obtained, it may be because it is outside the upper boundary or lower boundary of the current filtering unit (the pixel value of the pixel position outside the upper boundary or lower boundary of the current filtering unit cannot be obtained), and at this time, the pixel position closest to the reference pixel position may be outside the left boundary or right boundary of the current filtering unit, and its pixel value may be available.
[0306] For example, suppose the current filtering pixel position (i.e., C 14 The corresponding pixel position) is located in the upper left of the current filtering unit. For the reference pixel position corresponding to C1, since the reference pixel position is located in the upper left of the current filtering pixel position, when the current filtering pixel position is closer to the upper left vertex of the current filtering unit, the reference pixel position corresponding to C1 may be outside the upper boundary of the current filtering unit. Thus, the pixel value of the reference pixel position cannot be obtained. In this case, the pixel position corresponding to C6 may be outside the left boundary of the current filtering unit, and its pixel value may be obtainable.
[0307] by Fig. 17B Taking the scene shown as an example, since the reference pixel position corresponding to C1 is outside the upper boundary of the current filtering unit, the pixel value of the reference pixel position corresponding to C1 cannot be obtained, and the reference pixel position corresponding to C6 is outside the left boundary of the current filtering unit. When the pixel value outside the left boundary of the current filtering unit can be obtained, such as when the left boundary of the current filtering unit is not an image boundary or a slice boundary, the pixel value of the reference pixel position corresponding to C6 can be obtained. Therefore, in this case, for the reference pixel position whose pixel value cannot be obtained, the pixel value of the nearest pixel position in the current filtering unit or in the boundary area can be used to replace the reference pixel for filtering.
[0308] Therefore, in order to optimize the ALF filtering effect, for the reference pixel at a specified position in the filter state, if the pixel value of the reference pixel cannot be obtained, the current filtering unit and the pixel closest to the reference pixel position in the boundary area can be used to replace the reference pixel for filtering.
[0309] Exemplarily, if the reference pixel does not correspond to the specified position of the filter shape, the pixel closest to the reference pixel in the current filtering unit may be used to replace the reference pixel for filtering, that is, the pixels in the boundary area are not considered.
[0310] In one example, the designated position may include, but is not limited to, a first position, a second position, a third position, and a symmetrical position of the first position, the second position, and the third position in the first filter;
[0311] Among them, the first filter is a centrally symmetrical filter of a 7*7 cross plus a 5*5 square, the first position is the upper left corner position of the first filter, the second position is the adjacent position on the right side of the first position, and the third position is the adjacent position below the first position. The symmetrical positions include axially symmetrical positions and centrally symmetrical positions.
[0312] For example, for Figure 4A The first filter shown in the figure has a first position of C1, an axially symmetrical position of C5, a second position of C2, an axially symmetrical position of C4, and a third position of C6. 10 Position, that is, the above specified positions can include C1, C2, C6, C4, C5 and C 10 .
[0313] In some embodiments, when the pixel value of the reference pixel cannot be obtained, before the filtering using the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel, the following may also be included:
[0314] Determine whether the current filtering unit allows the use of enhanced adaptive correction filtering;
[0315] If so, it is determined to perform the above-mentioned operation of using the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering.
[0316] Exemplarily, considering the case where the enhanced adaptive correction filtering is allowed and the case where the enhanced adaptive correction filtering is not allowed, the filters used are usually different.
[0317] Exemplarily, the filter used in the case where enhanced adaptive correction filtering is allowed can be as follows Figure 4A As shown, the filter used when enhanced adaptive correction filtering is not allowed can be as follows Fig.12 shown.
[0318] And for Fig.12 For the filter shown, when the pixel value of a reference pixel cannot be obtained, usually the pixel value of the pixel position closest to the reference pixel position outside the current filtering unit will also not be obtained. Therefore, in cases where enhanced adaptive correction filtering is not allowed, it is not necessary to consider using pixels in the boundary area to replace the reference pixel whose pixel value cannot be obtained for filtering.
[0319] Therefore, for any reference pixel, when the pixel value of the reference pixel cannot be obtained, it can be determined whether the current filtering unit allows the use of enhanced adaptive correction filtering.
[0320] Exemplarily, whether the current filtering unit allows the use of enhanced adaptive correction filtering can be determined based on the value of EalfEnableFlag. When EalfEnableFlag is equal to 1, it means that enhanced adaptive correction filtering can be used; when EalfEnableFlag is equal to 0, it means that adaptive correction filtering should not be used.
[0321] Exemplarily, the value of EalfEnableFlag may be derived from a decoding end, where the value of EalfEnableFlag may be obtained from a bitstream or may be a constant value.
[0322] Exemplarily, the value of EalfEnableFlag may be determined based on the value of the enhanced adaptive correction filtering enable flag (ealf_enable_flag) obtained by parsing the bitstream.
[0323] It should be noted that the "enhanced adaptive correction filter enable flag" can be a sequence header level parameter, that is, a value of an "enhanced adaptive correction filter enable flag" can be used to indicate whether an image sequence is allowed to use the enhanced adaptive correction filter.
[0324] Exemplarily, when the decoding end device determines that the current filtering unit allows the use of enhanced adaptive correction filtering, the current filtering unit and the pixel closest to the reference pixel in the boundary area may be used to replace the reference pixel for filtering.
[0325] Exemplarily, if the current filtering unit does not allow the use of enhanced adaptive correction filtering, the pixel closest to the reference pixel in the current filtering unit may be used to replace the reference pixel for filtering, that is, pixels in the boundary area are not considered.
[0326] Embodiment 3
[0327] See also Figure 8 , is a flow chart of a filtering method provided in an embodiment of the present application, wherein the filtering method can be applied to a decoding end device, such as Figure 8 As shown, the filtering method may include the following steps:
[0328] Step S800: When it is determined to start ALF filtering for the current LCU of the current image frame, obtain the region coefficient identifier of the merged region to which the current LCU belongs.
[0329] Step S810: Obtain the filter coefficient of the current LCU based on the region coefficient identifier of the merged region to which the current LCU belongs; wherein the region coefficient identifier is used to identify the filter coefficient used by the merged region to which the LCU belongs in the preset multiple groups of filter coefficients.
[0330] In the embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the filter coefficients used in a merged area are no longer limited to one set of filter coefficients, but one or more sets of filter coefficients can be selected according to actual conditions.
[0331] Exemplarily, for any merged area, the encoding end device can train multiple groups of filter coefficients, and determine based on the RDO decision that the merged area uses one or more of the multiple groups of filter coefficients, and write the regional coefficient identifier used to identify the filter coefficients used by the merged area into the bitstream.
[0332] Exemplarily, when the decoding end device determines to start ALF filtering for the current LCU of the current image frame, the decoding end device can obtain the area coefficient identifier of the merged area to which the current LCU belongs based on the information parsed from the bit stream, and based on the area coefficient identifier, determine the filter coefficient used for the merged area to which the current LCU belongs.
[0333] When the filter coefficient used by the merged region to which the current LCU belongs is determined, the filter coefficient of the current LCU may be determined from the filter coefficient used by the merged region.
[0334] Exemplarily, when the merged region to which the current LCU belongs uses a set of filter coefficients, the filter coefficients used by the merged region may be determined as the filter coefficients of the current LCU.
[0335] Step S820: Perform ALF filtering on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0336] In the embodiment of the present application, when the filter coefficient of the current LCU is determined, ALF filtering can be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0337] It can be seen that in Figure 8 In the method flow shown, multiple groups of filter coefficients are trained for each region, and based on the RDO decision, it is determined that each merged region uses one or more of the trained multiple groups of filter coefficients, and the decision result is notified to the decoding end device through the regional coefficient identifier. Therefore, a region is no longer limited to using one set of filter coefficients, but can choose to use one or more groups of filter coefficients based on performance, thereby optimizing the ALF filtering performance and improving the encoding and decoding performance.
[0338] In some embodiments, in step S800, determining to start ALF filtering for the current LCU of the current frame image may include:
[0339] Parsing an LCU coefficient identifier of a current LCU from a bitstream; wherein the LCU coefficient identifier is used to identify a filter coefficient used by the current LCU in at least one set of filter coefficients used in a merged region to which the current LCU belongs;
[0340] When the value of the LCU coefficient identifier of the LCU is not the first value, it is determined to start ALF filtering for the current LCU.
[0341] Exemplarily, the encoding end device can notify the decoding end device that the merged region uses one or more sets of filter coefficients through the region coefficient identifier. For any LCU in the region, the encoding end device can identify the filter coefficient used by the LCU in the one or more sets of filter coefficients used by the merged region through the LCU coefficient identifier.
[0342] Exemplarily, for any LCU, the decoding end device may determine whether to enable ALF filtering for the LCU based on the LCU coefficient identifier of the LCU obtained by parsing the bitstream, and the filter coefficient of the LCU when ALF filtering is enabled for the LCU.
[0343] Exemplarily, for any LCU, when the value of the LCU coefficient identifier of the LCU is the first value, it indicates that ALF filtering is not started for the LCU.
[0344] For any LCU, when the value of the LCU coefficient identifier of the LCU parsed from the bitstream by the decoding end device is not the first value, it can be determined to start ALF filtering for the LCU.
[0345] For example, assuming that the first value is 0, for any LCU, when the value of the LCU coefficient identifier of the LCU obtained by the decoding end device from the bit stream is 0, it can be determined that ALF filtering is not started for the LCU; when the value of the LCU coefficient identifier of the LCU obtained by the decoding end device from the bit stream is not 0, it can be determined that ALF filtering is started for the LCU. At this time, the decoding end device can determine the filter coefficient used by the LCU according to the LCU coefficient identifier of the LCU.
[0346] It should be noted that when the value of the LCU coefficient identifier of the LCU is not the first value, if the merged area to which the LCU belongs uses a set of filter coefficients, the filter coefficient of the LCU is this set of filter coefficients; if the merged area to which the LCU belongs uses multiple sets of filter coefficients, it is also necessary to determine the filter coefficient of the LCU based on the specific value of the LCU coefficient identifier of the LCU.
[0347] In an example, in step S810, based on the region coefficient identifier of the merged region to which the current LCU belongs, obtaining the filter coefficient of the current LCU may include:
[0348] When it is determined that the merged region to which the current LCU belongs uses multiple sets of filter coefficients based on the region coefficient identifier of the merged region to which the current LCU belongs, the filter coefficient of the current LCU is determined from the multiple sets of filter coefficients used in the merged region to which the LCU belongs based on the LCU coefficient identifier of the current LCU.
[0349] Exemplarily, for any LCU, when the decoding end device determines that the merged area to which the LCU belongs uses multiple sets of filter coefficients, the decoding end device can determine the filter coefficients used by the LCU based on the LCU coefficient identifier of the LCU obtained by parsing the bitstream.
[0350] It should be noted that, for any merged region, the filter shapes of the multiple sets of filter coefficients used in the merged region may be completely the same or not completely the same.
[0351] Embodiment 4
[0352] See also Fig. 9 , is a flow chart of a filtering method provided in an embodiment of the present application, wherein the filtering method can be applied to a decoding end device, such as Fig. 9 As shown, the filtering method may include the following steps:
[0353] Step S900: When it is determined to start ALF filtering for the current LCU of the current frame image, a coefficient selection identifier of the current LCU is obtained.
[0354] Step S910: Determine the filter coefficient of the current LCU based on the merged area to which the current LCU belongs and the coefficient selection identifier of the current LCU; wherein the coefficient selection identifier is used to identify the filter coefficient selected for use by the current LCU from multiple groups of candidate filter coefficients.
[0355] In the embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the LCU is no longer limited to selecting the filter coefficients of the merged area to which it belongs, but can adaptively select a set of filter coefficients from multiple sets of filter coefficients for ALF filtering.
[0356] Exemplarily, for any LCU, the candidate filter coefficients of the LCU may include but are not limited to the filter coefficients of the merged area to which it belongs and the filter coefficients of the adjacent areas of the merged area to which it belongs. Thus, when a set of filter coefficients is transmitted in each area, an LCU may have multiple sets of candidate filter coefficients, thereby improving the flexibility of LCU filter coefficient selection, optimizing the ALF filtering effect, and improving the encoding and decoding performance.
[0357] Exemplarily, for any LCU, the encoding end device may determine the filter coefficient used by the LCU from multiple groups of candidate filter coefficients based on the RDO decision, and write a coefficient selection identifier corresponding to the filter coefficient into a bitstream and send it to the decoding end device.
[0358] The decoding end device may determine the filter coefficient of the current LCU based on the merged area to which the current LCU belongs and the coefficient selection identifier of the current LCU obtained by parsing the bitstream.
[0359] Step S920: Perform ALF filtering on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0360] In the embodiment of the present application, when the decoding end device determines the filter coefficient of the current LCU, ALF filtering can be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0361] It can be seen that in Fig. 9 In the method flow shown, multiple groups of candidate filter coefficients are set for each LCU, and the filter coefficients used by each LCU are determined based on the RDO decision. The decision results are notified to the decoding end device through the coefficient selection identifier. This can improve the flexibility of the filter coefficients used by each LCU, optimize the ALF filtering performance, and improve the encoding and decoding performance.
[0362] In some embodiments, in step S910, determining the filter coefficient of the LCU based on the merged region to which the LCU belongs and the coefficient selection identifier of the LCU may include:
[0363] When the value of the coefficient selection flag of the current LCU is the first value, determining the filter coefficient of the previous merged area of the merged area to which the current LCU belongs as the filter coefficient of the previous LCU;
[0364] When the value of the coefficient selection identifier of the current LCU is the second value, determining the filter coefficient of the merged area to which the current LCU belongs as the filter coefficient of the current LCU;
[0365] When the value of the coefficient selection flag of the current LCU is the third value, the filter coefficient of the next merging area of the merging area to which the current LCU belongs is determined as the filter coefficient of the current LCU.
[0366] Exemplarily, for any LCU in any merged area, the candidate filter coefficients of the LCU may include the filter coefficient of the merged area, the filter coefficient of the previous merged area of the merged area, and the filter coefficient of the next merged area of the merged area.
[0367] Exemplarily, the previous merged region of the merged region to which the LCU belongs is a merged region corresponding to a previous adjacent index of the index of the merged region to which the LCU belongs.
[0368] Exemplarily, the next merged region to which the LCU belongs is a merged region corresponding to a next adjacent index of the index of the merged region to which the LCU belongs.
[0369] It should be noted that, for the merged area obtained by merging the 16 areas obtained according to the fixed area division method (assuming that they are merged area 0 to merged area 15 in sequence), the merged area after merged area 15 can be merged area 0, and the merged area before merged area 0 can be area 15.
[0370] Exemplarily, for any LCU, the encoding end device can determine the filter coefficient it uses based on the RDO decision. When determining that the filter coefficient used by the LCU is the filter coefficient of the previous merged area of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a first value, such as 0; when determining that the filter coefficient used by the LCU is the filter coefficient of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a second value, such as 1; when determining that the filter coefficient used by the LCU is the filter coefficient of the next merged area of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a third value, such as 3.
[0371] Exemplarily, for any LCU, when the value of the coefficient selection identifier of the LCU obtained by the decoding end device from the bit stream is a first value, the filter coefficient of the previous merged area of the merged area to which the LCU belongs can be determined as the filter coefficient of the LCU; when the value of the coefficient selection identifier of the LCU obtained from the bit stream is a second value, the filter coefficient of the merged area to which the LCU belongs can be determined as the filter coefficient of the LCU; when the value of the coefficient selection identifier of the LCU obtained from the bit stream is a third value, the filter coefficient of the next merged area of the merged area to which the LCU belongs can be determined as the filter coefficient of the LCU.
[0372] It can be seen that by taking the filter coefficients of the merged area to which the LCU belongs and the previous merged area and the next merged area to which the LCU belongs as candidate filter coefficients of the LCU, and selecting a group of filter coefficients as the filter coefficients of the LCU based on the RDO decision, thereby, when a group of filter coefficients can be trained in one merged area, there can be multiple groups of candidate filter coefficients for the LCU in the merged area. When there is no need to train multiple groups of filter coefficients for one merged area, the flexibility of the filter coefficients of the LCU is improved, thereby optimizing the ALF filtering performance and improving the encoding and decoding performance.
[0373] Embodiment 5
[0374] See also Fig.10 , is a flow chart of a filtering method provided in an embodiment of the present application, wherein the filtering method can be applied to a decoding end device, such as Fig.10 As shown, the filtering method may include the following steps:
[0375] Step S1000: When it is determined to start ALF filtering for the current LCU of the current frame image, based on the merged area to which the current LCU belongs, a filter shape of the merged area to which the current LCU belongs is obtained.
[0376] Step S1010: Based on the filter shape, obtain the filter coefficient of the merged area to which the current LCU belongs.
[0377] In an embodiment of the present application, in order to improve the flexibility of the filter coefficients, optimize the ALF filtering effect, and improve the encoding and decoding performance, each region is no longer restricted to using the same filter shape, but can selectively use different filter shapes, that is, the filter shapes used in different merged regions can be the same or different.
[0378] Exemplarily, for any merged area, the encoding end device can train multiple sets of filter coefficients with different filter shapes, and determine the filter shape and filter coefficients used in the merged area based on the RDO decision, and write the filter shape and filter coefficients into the code stream and send it to the decoding end device.
[0379] Exemplarily, for any merged region, when acquiring the filter coefficient of the merged region, the decoding end device may parse the filter shape of the merged region from the bitstream, and parse the filter coefficient of the merged region from the bitstream based on the filter shape.
[0380] Step S1020: Perform ALF filtering on the pixels of the current LCU one by one based on the filter shape and the filter coefficient.
[0381] In the embodiment of the present application, when the decoding end device determines the filter coefficient of the current LCU, ALF filtering can be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0382] It can be seen that in Fig.10 In the method flow shown, multiple groups of filter coefficients with different filter shapes are trained for each region, and the filter shape and filter coefficients used for each merged region are determined based on the RDO decision. The decision result is notified to the decoding end device through the bit stream. The decoding end device can parse the bit stream to obtain the filter shape and filter coefficients of each region, thereby optimizing the ALF filtering effect and improving the encoding and decoding performance.
[0383] It should be noted that, in the embodiment of the present application, the filter shape may be selected for the image frame, or the filter shape may be selected for the components of the image frame (such as the luminance component and / or the chrominance component). For example, when the image frame A selects a 7*7 cross plus a 5*5 square centrosymmetric filter shape, each LCU in the image frame A that starts the ALF filter uses a 7*7 cross plus a 5*5 square centrosymmetric filter shape.
[0384] Embodiment 6
[0385] See also Fig.11 , is a flow chart of a filtering method provided in an embodiment of the present application, wherein the filtering method can be applied to a decoding end device, such as Fig.11 As shown, the filtering method may include the following steps:
[0386] Step S1100: When it is determined to start ALF filtering for the current LCU of the current frame image, based on the merged area to which the current LCU belongs, obtain the filter coefficient of the merged area to which the current LCU belongs and the weight coefficient of each reference pixel position.
[0387] Step S1110: Based on the filter coefficient and the weight coefficient of each reference pixel position, perform ALF filtering on the pixels of the current LCU one by one.
[0388] In an embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the filter used for ALF filtering is no longer limited to a symmetric filter, but an asymmetric filter can be used, that is, the positionally symmetric filter coefficients can be different and satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
[0389] It should be noted that, when ALF filtering is performed based on a determined filter coefficient, for any filter coefficient at a non-central position, it is necessary to obtain the filtered pixel value based on the sum of the products of the filter coefficient and the filter coefficient at a symmetrical position of the filter coefficient and the reference pixels at the corresponding positions. Therefore, the above ratio can be used as the ratio between the filter coefficients at symmetrical positions, or it can also be used as the ratio of the weighted weights of the reference pixels corresponding to the filter coefficients at the symmetrical positions participating in the ALF filtering calculation (also referred to as the weight ratio), that is, the above asymmetric filter means that the filter coefficients at the symmetrical positions are different, or the weights of the pixel values of the reference pixels corresponding to the filter coefficients at the symmetrical positions are different.
[0390] For example, the filter coefficient C of the centrosymmetric filter shape of 7*7 cross plus 5*5 square is i , the filter coefficient of its symmetrical position is C 28-i , then C i :C 28-i =A i :(2-A i ), or, P i and P 28-i The weighted ratio when participating in the ALF filtering calculation is A i :(2-A i ), P i C iThe pixel value at the corresponding reference pixel position, P 28-i C 28-i The pixel value of the corresponding reference pixel position, for any pixel of the LCU, the pixel value of the pixel after filtering can be determined by:
[0391]
[0392] Among them, C i is the (i+1)th filter coefficient in the filter coefficients of the merged area to which the LCU belongs, P i is the filter coefficient C i The pixel value at the corresponding reference pixel position, P 28-i The corresponding reference pixel position and P i The corresponding reference pixel position is symmetrical about the pixel position of the current filtering pixel, A i P i The weight coefficient of the pixel value at the corresponding reference pixel position, P 14 is the pixel value of the current filtered pixel, C 14 is the filter coefficient of the current filter pixel, 0<A i <2.
[0393] In the embodiment of the present application, for any merged region, the encoding end device can determine the filter coefficients and filtering performance of the merged region under different weight coefficients corresponding to each position, select a set of filter coefficients with the best filtering performance, record the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter, and write them into the bitstream and send them to the decoding end device.
[0394] For example, a weight coefficient set (such as A i A value set is obtained, and each weight coefficient is selected from the set to obtain the filter coefficient with the best filtering performance and the corresponding weight coefficient at each position of the corresponding filter, and the index of the weight coefficient in the weight coefficient set is written into the bitstream and sent to the decoding end device.
[0395] For any LCU, the decoding end device can parse the bitstream to obtain the filter coefficient of the merged area to which the LCU belongs, as well as the weight coefficient of each reference pixel position corresponding to the merged area to which the LCU belongs, and perform ALF filtering on the pixels of the LCU one by one.
[0396] It can be seen that in Fig.11In the method flow shown, the filter used in each merged area is no longer limited to a symmetric filter, and the filter coefficients of the reference pixels at symmetrical positions are no longer limited to be the same, but can satisfy a certain proportional relationship. Moreover, since the filter coefficients at symmetrical positions satisfy the proportional relationship, the number of required filter coefficients does not increase, thereby improving the flexibility of the filter coefficients, optimizing the ALF filtering performance, and improving the encoding and decoding performance.
[0397] Embodiment 7
[0398] The embodiment of the present application provides a filtering method, which can be applied to an encoding end device, and the filtering method may include the following steps:
[0399] T100, dividing the brightness component of the current image frame into regions.
[0400] Exemplarily, the implementation of the regional division of the brightness component of the image frame can refer to the relevant description of the "region division" part above, and the embodiments of the present application will not be described here.
[0401] T110 . For any region, classify each LCU in the region, and divide the region into multiple region categories based on the category of each LCU.
[0402] In an embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, when the brightness component of the image frame is divided into multiple regions according to a fixed region division method, for each region, the LCU in the region can be classified based on the pixel characteristics of each pixel in the region, and the LCU in the region can be divided into at least one category, that is, a region can be divided into at least one region (which can be called a sub-region or region category) by LCU classification.
[0403] T120, merging regions of each region category and determining filter coefficients of each merged region.
[0404] T130. Write the filter coefficients of each merged region and the region category identifier of each LCU into the bitstream.
[0405] In an embodiment of the present application, when the encoding end device classifies the LCUs in each area in the above manner, the encoding end device can merge the areas of each area category to obtain at least one merged area, and determine the filter coefficients of each merged area.
[0406] Exemplarily, the implementation method of merging regions for each region category is similar to the relevant description in the “region merging” section above, and the embodiments of the present application are not described in detail here.
[0407] Exemplarily, for any region category, the encoding end device may allocate a coefficient index to it based on the merged region to which it belongs, and the coefficient index corresponds to a filter coefficient of one of the merged regions.
[0408] In an embodiment of the present application, the encoding end device can write the filter coefficients of each merged area, the index of each area category, and the area category identifier used to identify the area category to which each LCU belongs into the bitstream and send it to the decoding end device.
[0409] Exemplarily, the processing flow of the decoding end device can refer to the relevant description in the above embodiment, and the embodiment of the present application will not be described in detail here.
[0410] Embodiment 8
[0411] The embodiment of the present application provides a filtering method, which can be applied to an encoding end device, and the filtering method may include the following steps:
[0412] T200. For any merged region of the current image frame, determine the filter coefficient used for the merged region based on the RDO decision.
[0413] T210. Determine a region coefficient identifier of the merged region based on a filter coefficient used in the region; wherein the region coefficient identifier is used to identify a filter coefficient used in the merged region among a plurality of preset groups of filter coefficients.
[0414] T220: Write the filter coefficients used by each merged area and the area coefficient identifiers of each merged area into the bitstream.
[0415] In the embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the filter coefficients used in a merged area are no longer limited to one set of filter coefficients, but one or more sets of filter coefficients can be selected according to actual conditions.
[0416] Exemplarily, for any merged area, the encoding end device can train multiple groups of filter coefficients, and determine based on the RDO decision that the merged area uses one or more of the multiple groups of filter coefficients, and write the regional coefficient identifier used to identify the filter coefficients used by the merged area into the bitstream.
[0417] Exemplarily, the processing flow of the decoding end device can refer to the relevant description in the above embodiment, and the embodiment of the present application will not be described in detail here.
[0418] In some embodiments, the filtering method may further include:
[0419] For any merged area of the current image frame, when the filter coefficients used in the merged area include multiple sets, determining the LCU coefficient identifier of each LCU based on the filter coefficients used by each LCU in the merged area;
[0420] The LCU coefficient identifier of each LCU is written into the bitstream.
[0421] Exemplarily, the encoding end device can notify the decoding end device that the merged area uses one or more sets of filter coefficients through the area coefficient identifier. For any LCU of the merged area, the encoding end device can identify the filter coefficient used by the LCU in the one or more sets of filter coefficients used by the merged area through the LCU coefficient identifier.
[0422] For any merged area, when the encoding end device determines that the merged area uses multiple groups of filter coefficients, for any LCU of the merged area, the encoding end device can notify the decoding end device of the filter coefficients used by the LCU in the multiple groups of filter coefficients through the LCU coefficient identifier.
[0423] Exemplarily, for any LCU, when ALF filtering is not started for the LCU, the encoding end device may write the value of the LCU coefficient identifier of the LCU in the bitstream as the first value.
[0424] For example, assuming that the first value is 0, for any LCU, when the encoding end device determines not to start ALF filtering for the LCU, the value of the LCU coefficient identifier of the LCU written into the bitstream is 0.
[0425] Embodiment 9
[0426] The embodiment of the present application provides a filtering method, which can be applied to an encoding end device, and the filtering method may include the following steps:
[0427] T300, for any merged area of the current image frame, determining a filter coefficient used for the merged area from multiple groups of filter coefficients based on the RDO decision;
[0428] T310. Determine a coefficient selection identifier for each LCU in the merged area based on the filter coefficient used in the area; wherein the coefficient selection identifier is used to identify the filter coefficient selected for use by each LCU from multiple groups of candidate filter coefficients.
[0429] T320: Write the filter coefficients used by each merged area and the coefficient selection flag of each LCU into the bitstream.
[0430] In the embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the LCU is no longer limited to selecting the filter coefficients of the merged area to which it belongs, but can adaptively select a set of filter coefficients from multiple sets of filter coefficients for ALF filtering.
[0431] Exemplarily, for any LCU, the candidate filter coefficients of the LCU may include but are not limited to the filter coefficients of the merged area to which it belongs and the filter coefficients of the adjacent areas of the merged area to which it belongs. Thus, when a set of filter coefficients is transmitted in each area, an LCU may have multiple sets of candidate filter coefficients, thereby improving the flexibility of LCU filter coefficient selection, optimizing the ALF filtering effect, and improving the encoding and decoding performance.
[0432] Exemplarily, for any LCU, the encoding end device may determine the filter coefficient used by the LCU from multiple groups of candidate filter coefficients based on the RDO decision, and write a coefficient selection identifier corresponding to the filter coefficient into a bitstream and send it to the decoding end device.
[0433] Exemplarily, the processing flow of the decoding end device can refer to the relevant description in the above embodiment, and the embodiment of the present application will not be described in detail here.
[0434] Exemplarily, for any LCU in any merged area, the candidate filter coefficients of the LCU may include the filter coefficient of the merged area, the filter coefficient of the previous merged area of the merged area, and the filter coefficient of the next merged area of the area.
[0435] It should be noted that the 16 areas obtained according to the fixed area division method include 16 merged areas after area merging (assuming that they are merged area 0 to merged area 15 in sequence). The merged area after merged area 15 can be merged area 0, and the merged area before merged area 0 can be merged area 15.
[0436] Exemplarily, for any LCU, the encoding end device can determine the filter coefficient it uses based on the RDO decision. When determining that the filter coefficient used by the LCU is the filter coefficient of the previous merged area of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a first value, such as 0; when determining that the filter coefficient used by the LCU is the filter coefficient of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a second value, such as 1; when determining that the filter coefficient used by the LCU is the filter coefficient of the next merged area of the merged area to which the LCU belongs, it can be determined that the value of the coefficient selection identifier of the LCU is a third value, such as 3.
[0437] Embodiment 10
[0438] The embodiment of the present application provides a filtering method, which can be applied to an encoding end device, and the filtering method may include the following steps:
[0439] T400. For any merged region of the current image frame, determine the filter shape and filter coefficient used in the merged region based on the RDO decision.
[0440] T410. Write the filter shape and filter coefficients used in each region into the bitstream.
[0441] In an embodiment of the present application, in order to improve the flexibility of the filter coefficients, optimize the ALF filtering effect, and improve the encoding and decoding performance, each merging area is no longer restricted to using the same filter shape, but can selectively use different filter shapes, that is, the filter shapes used in different merging areas can be the same or different.
[0442] Exemplarily, for any merged area, the encoding end device can train multiple sets of filter coefficients with different filter shapes, and determine the filter shape and filter coefficients used in the merged area based on the RDO decision, and write the filter shape and filter coefficients into the code stream and send it to the decoding end device.
[0443] Exemplarily, the processing flow of the decoding end device can refer to the relevant description in the above embodiment, and the embodiment of the present application will not be described in detail here.
[0444] It should be noted that, in the embodiment of the present application, the filter shape may be selected for the image frame, or the filter shape may be selected for the components of the image frame (such as the luminance component and / or the chrominance component). For example, when the image frame A selects a 7*7 cross plus a 5*5 square centrosymmetric filter shape, each LCU in the image frame A that starts the ALF filter uses a 7*7 cross plus a 5*5 square centrosymmetric filter shape.
[0445] Embodiment 11
[0446] The embodiment of the present application provides a filtering method, which can be applied to an encoding end device, and the filtering method may include the following steps:
[0447] T500, for any merged area of the current image frame, determine the filter coefficient used in the merged area and the corresponding weight coefficients of each reference pixel position based on the RDO decision;
[0448] T510: Write the filter coefficients used in each merged area and the corresponding weight coefficients of each reference pixel position into the bitstream.
[0449] In an embodiment of the present application, in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the filter used for ALF filtering is no longer limited to a symmetric filter, but an asymmetric filter can be used, that is, the positionally symmetric filter coefficients can be different and satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
[0450] For example, Fig.16 Take the filter shown in the figure as an example. Fig.16In the filter shown, the filter coefficients symmetrical about the center of C14 are no longer restricted to be the same, but can satisfy a certain proportional relationship, for example, C1:C 27 =0.5:1.5, C6:C 22 =0.6:1.4, etc.
[0451] It should be noted that, when ALF filtering is performed based on a determined filter coefficient, for any filter coefficient at a non-central position, it is necessary to obtain the filtered pixel value based on the sum of the products of the filter coefficient and the filter coefficient at a symmetrical position of the filter coefficient and the reference pixels at the corresponding positions. Therefore, the above ratio can be used as the ratio between the filter coefficients at symmetrical positions, or it can also be used as the ratio of the weighted weights of the reference pixels corresponding to the filter coefficients at the symmetrical positions participating in the ALF filtering calculation (also referred to as the weight ratio), that is, the above asymmetric filter means that the filter coefficients at the symmetrical positions are different, or the weights of the pixel values of the reference pixels corresponding to the filter coefficients at the symmetrical positions are different.
[0452] For example, if Fig.16 The filter coefficient C of the centrosymmetric filter shape of 7*7 cross plus 5*5 square is shown i , the filter coefficient of its symmetrical position is C 28-i , then C i :C 28-i =A i :(2-A i ), or, P i and P 28-i The weighted ratio when participating in the ALF filtering calculation is A i :(2-A i ), P i C i The pixel value at the corresponding reference pixel position, P 28-i C 28-i The pixel value of the corresponding reference pixel position, for any pixel of the LCU, the pixel value of the pixel after filtering can be determined by:
[0453]
[0454] Among them, C i is the (i+1)th filter coefficient in the filter coefficients of the merged area to which the LCU belongs, P i is the filter coefficient C i The pixel value at the corresponding reference pixel position, P 28-i The corresponding reference pixel position and P i The corresponding reference pixel position is symmetrical about the pixel position of the current filtering pixel, A i P iThe weight coefficient of the pixel value at the corresponding reference pixel position, P 14 is the pixel value of the current filtered pixel, C 14 is the filter coefficient of the current filter pixel, 0<A i <2.
[0455] like Fig.16 The filter shown, assuming C i :C 28-i =A i :(2-A i ), then in the symmetric position (about C 14 When the filter coefficients of the central symmetry are different, it is also possible to only train C0~C 14 Of these 15 coefficients, the remaining coefficients can be determined based on weight coefficients.
[0456] For example, assuming A1 = 0.5, then C1:C 27 =0.5:1.5; Assuming A0=0.6, then C0:C 28 =0.6:1.4.
[0457] In the embodiment of the present application, for any merged region, the encoding end device can determine the filter coefficients and filtering performance of the merged region under different weight coefficients corresponding to each position, select a set of filter coefficients with the best filtering performance, record the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter, and write them into the bitstream and send them to the decoding end device.
[0458] For example, a weight coefficient set (such as A i A value set is obtained, and each weight coefficient is selected from the set to obtain the filter coefficient with the best filtering performance and the corresponding weight coefficient at each position of the corresponding filter, and the index of the weight coefficient in the weight coefficient set is written into the bitstream and sent to the decoding end device.
[0459] Exemplarily, the processing flow of the decoding end device can refer to the relevant description in the above embodiment, and the embodiment of the present application will not be described in detail here.
[0460] In order to enable those skilled in the art to better understand the technical solutions provided in the embodiments of the present application, the technical solutions provided in the embodiments of the present application are described below with reference to specific examples.
[0461] In view of the shortcomings of traditional ALF technology, the present application embodiment proposes the following optimization scheme:
[0462] Solution 1: For each frame, LCU is used as the smallest unit and is adaptively divided into multiple regions, where each region may include more than one LCU. Therefore, it is proposed to classify each LCU and divide the LCUs in the same region into N categories, where N is a positive integer.
[0463] Solution 2: Multiple sets of filter coefficients can be transmitted in each region, and the shape of each set of filters can be the same or different.
[0464] Solution 3: A set of filter coefficients is adaptively selected based on each LCU. The LCU in the same area can select the filter coefficients of the adjacent area.
[0465] Solution 4: Each region can only pass one set of filter coefficients, but the filter shape of each region can be different.
[0466] Solution 5: Modify the symmetric filter into an asymmetric filter, make the filter coefficients at the symmetric positions the same, and optimize the filter coefficients at the symmetric positions to meet a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
[0467] Solution 6: Optimize the sample values at the boundary during filtering.
[0468] The main improvements of the present application will be described below from the perspectives of the encoding and decoding ends respectively.
[0469] 1. Encoding method and encoding end equipment
[0470] For the encoding end device, the ALF switch sequence header can be obtained to determine whether the current sequence needs to enable the ALF technology. If the ALF switch sequence header is off, the ALF technology is turned off, and the ALF optimization technology (that is, the optimization of the traditional ALF technology by the ALF filtering scheme provided in the embodiment of the present application, which can include any one or more of the above-mentioned schemes 1 to 6) is also turned off, and the ALF switch sequence header is transmitted to the decoding end device. If the ALF switch sequence header is on, the ALF technology encoding is entered, and the ALF technology optimization sequence header can be obtained.
[0471] If the ALF technology optimization is turned off, the original ALF technology is used for filtering. The ALF switch sequence header, the optimization technology sequence header and the parameters required by the ALF technology are transmitted to the decoding end device.
[0472] If the ALF technology optimization is turned on, the following scheme can be used for optimization, and the ALF switch sequence header, the optimization technology sequence header and the parameters required for the optimized ALF technology are passed to the decoding end device.
[0473] Exemplarily, the optimization technology sequence header may not exist. In this case, if the ALF switch sequence header is turned on, it is determined to use the optimized ALF technology solution.
[0474] 1.1. Adaptive area division with LCU as the smallest unit
[0475] The luminance component is divided into fixed areas to obtain multiple areas; the LCUs belonging to the same area are divided again (ie, each LCU in the same area is classified), and the same area is divided into at most N1 categories, where N1 is a positive integer.
[0476] For example, if N1=2, the total number of regions is at most twice the original number; if N1=1, it is the original fixed region division scheme.
[0477] The encoding end device may mark the result of LCU division in each region and send the mark to the decoding end device (ie, send the region category identifier of each LCU to the decoding end device).
[0478] 1.2. Multiple sets of filter coefficients can be delivered in each region
[0479] For any merged region, a maximum of n sets of filter coefficients can be transmitted. Each LCU in the merged region is identified. 0 means off, that is, ALF filtering is not started; i means that the current LCU uses a set of filter coefficients in the region, and the value range of i is [1, n].
[0480] Exemplarily, each set of filter coefficients is obtained as follows:
[0481] When training the filter coefficients for the first time, all LCUs enable ALF filtering by default. After the CTU decision is made, the disabled LCUs (i.e., LCUs that do not enable ALF filtering) do not participate in the second training of the filter coefficients. At the same time, LCUs with the same mark jointly train the same set of filter coefficients.
[0482] Similarly, the third filter coefficient training is performed based on the result of the second CTU decision.
[0483] Finally, based on the frame level or the region level, it is determined that the image frame or the merged region uses at most n sets of filter coefficients, and finally the filter coefficients corresponding to each merged region are written into the bitstream.
[0484] 1.3. Each LCU adaptively selects a set of filter coefficients
[0485] For the brightness component, for any LCU, when making a CTU decision, you can choose to use the filter coefficient of the area where the current LCU is located or use the filter coefficient of other areas. The maximum number of filters that each LCU can select is N2 (that is, N2 groups of filter coefficients, N2 ≥ 2). RDO decisions are made under the N2 groups of filter coefficients, and the group of filter coefficients with the best performance is selected. The optimal selection result of the current LCU is sent to the decoding end device (that is, the coefficient selection identifier is sent to the decoding end device).
[0486] Exemplarily, N2 is less than or equal to the number of merged regions.
[0487] 1.4. Select filters of different shapes for each region
[0488] Each region transmits a set of filter coefficients. Therefore, for any LCU, the encoding end device can notify the decoding end device to start ALF filtering for the LCU or not start (ie, turn off) ALF filtering through a flag bit.
[0489] When calculating the filter coefficients of each area, for any merged area, the filter coefficients under N3 (N3≥2) different filter shapes can be calculated separately, and the filtering performance of the area under the N3 filter shapes can be calculated separately, and the filter shape with the best performance is selected, and the best filter shape and filter coefficient of each area are notified to the decoding end device through the code stream.
[0490] It should be noted that the encoding end device may also select filters of different shapes based on the frame level, or select filters of different shapes based on the Y, U and V components.
[0491] Taking the selection of filters of different shapes based on the frame level as an example, for any image frame, the filter coefficients of each area under N4 different filter shapes can be calculated respectively, and the filtering performance of the image frame under N4 (N4≥2) filter shapes can be calculated respectively, and the filter shape with the best performance is selected. The filter shape with the best performance of the image frame and the filter coefficients of each area are notified to the decoding end device through the code stream.
[0492] 1.5. Change the symmetric filter to an asymmetric filter
[0493] For a symmetric filter with N5 (N5 ≥ 2) coefficients, only training filter coefficients.
[0494] For example, This is a round-down operation, that is, when "*" is not an integer, the non-integer part of "*" is set to 0, such as
[0495] For example, after the symmetric filter is modified into an asymmetric filter, the filter coefficients at the symmetric position satisfy different proportional relationships, so when the coefficients are trained, only the training filter coefficients.
[0496] For example, Figure 4A Taking the filter shape shown as an example, C i With C 28-i The proportional relationship of the filter coefficients at each symmetrical position can be selected through RDO decision, and the filter coefficients at each position and the ratio of the filter coefficients at the symmetrical position are sent to the decoding end device through the code stream.
[0497] Exemplarily, when the ratio of the filter coefficients at all symmetrical positions is 1:1, the trained filter is still a symmetrical filter.
[0498] 2. Decoding Method and Decoding Device
[0499] For the decoding end device, the ALF switch sequence header can be read from the bitstream to determine whether the current sequence needs to enable the ALF technology. If the ALF switch sequence header is off, the ALF technology is turned off. If the ALF switch sequence header is on, the ALF technology optimization sequence header can continue to be read.
[0500] If the ALF technology optimization sequence header is closed, the filtering parameters required by the original ALF technology are obtained;
[0501] If the ALF technology optimization sequence header is turned on, the filter parameters required for the optimized ALF technology are read.
[0502] Exemplarily, the ALF optimization technique sequence header may not exist. In this case, if the ALF switch sequence header is turned on, the filtering parameters required by the optimized ALF technique are read.
[0503] 2.1. Adaptive area division with LCU as the smallest unit
[0504] The luminance component is divided into fixed areas to obtain multiple areas; the filter coefficients of all areas are read from the bitstream, and the area category identifiers of all LCUs that start ALF filtering are read from the bitstream, and the area category of the LCU is determined according to the fixed area division result and the area category identifier of the LCU, the corresponding filter coefficients are obtained according to the area category of the LCU, and ALF filtering is performed on the pixels of the LCU one by one.
[0505] 2.2. Multiple sets of filter coefficients can be delivered in each region
[0506] The frame-level or region-level coefficient identifier is read from the bitstream, and multiple groups of filter coefficients in each merged area are obtained from the bitstream according to the frame-level or region-level coefficient identifier, and the number of selectable filters (i.e., the number of filter coefficient groups) is determined by the frame-level or region-level coefficient identifier.
[0507] The LCU coefficient identifier of each LCU is obtained from the bitstream, and a group of filter coefficients is selected according to the LCU coefficient identifier of each LCU. When filtering the current LCU, the group of filter coefficients is used to perform ALF filtering on the pixels of the LCU one by one.
[0508] 2.3. Each LCU adaptively selects a set of filter coefficients
[0509] The filter coefficients in each area and the flag of each LCU turning on or off ALF filtering (i.e., starting ALF filtering for the LCU or not starting ALF filtering) are read from the bitstream. For each LCU starting ALF filtering, the coefficient selection flag of the LCU is read from the bitstream.
[0510] Exemplarily, for any LCU, the maximum number of selectable filters is N2 (ie, the number of candidate filter coefficients is at most N2 groups).
[0511] 2.4. Select filters of different shapes for each region
[0512] For any merged area, the filter shape of the merged area can be read from the bitstream, and the filter coefficient of the merged area can be read according to the filter shape. ALF filtering is performed on the pixels of each LCU in the merged area one by one according to the filter shape and filter coefficient.
[0513] 2.5. Modify the symmetric filter to an asymmetric filter
[0514] The filter coefficients of each merged area are read from the bitstream, and the proportional coefficients of the filter coefficients at the symmetrical positions are read.
[0515] According to the filter coefficients at each position and the proportional coefficients of the filter coefficients at the symmetrical positions, the filter coefficients at each position in the merged area are derived, and ALF filtering is performed on the pixels of each LCU in the merged area one by one.
[0516] The following is an explanation of the optimization scheme for sampling filter boundaries.
[0517] Example 12: Optimization Solution 1 for Sample Values at Filter Boundaries
[0518] Assume the filter shape is Figure 4AIf the sample used in the adaptive correction filtering process (i.e., the reference pixel when filtering any pixel in the adaptive correction filtering unit) is a sample in the adaptive correction filtering unit (i.e., the reference pixel is in the adaptive correction filtering unit), the sample is used for filtering; if the sample used in the adaptive correction filtering process does not belong to the sample in the adaptive correction filtering unit (i.e., the reference pixel is not in the adaptive correction filtering unit), filtering is performed in the following manner:
[0519] 12.1. If the sample is outside the image boundary, or outside the slice boundary and filtering across the slice boundary is not allowed, then:
[0520] 12.1.1. If the sample corresponds to filter shape C1, C2, C6, C4, C5 or C 10 position, the sample closest to the sample in the boundary area is used to replace the sample for filtering;
[0521] 12.1.2. Otherwise, that is, the sample does not correspond to filter shape C1, C2, C6, C4, C5 or C 10 Position, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0522] 12.2. Otherwise, if the sample is outside the upper boundary or the lower boundary of the adaptive correction filter unit, then:
[0523] 12.2.1. If the sample corresponds to filter shape C1, C2, C6, C4, C5 or C 10 position, the sample closest to the sample in the boundary area is used to replace the sample for filtering;
[0524] 12.2.2. Otherwise, the sample does not correspond to filter shape C1, C2, C6, C4, C5 or C 10 Position, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0525] 12.3. Otherwise, that is, the sample does not meet the conditions in 12.1 or 12.2, then the sample is used for filtering.
[0526] Example 13: Optimization Solution 2 for Sample Values at Filter Boundaries
[0527] Assume the filter shape is Figure 4AIf the sample used in the adaptive correction filtering process (i.e., the reference pixel when filtering any pixel in the adaptive correction filtering unit) is a sample in the adaptive correction filtering unit (i.e., the reference pixel is in the adaptive correction filtering unit), the sample is used for filtering; if the sample used in the adaptive correction filtering process does not belong to the sample in the adaptive correction filtering unit (i.e., the reference pixel is not in the adaptive correction filtering unit), filtering is performed in the following manner:
[0528] 13.1. If the sample is outside the image boundary, or outside the slice boundary and filtering across the slice boundary is not allowed, the sample is replaced by the sample closest to the sample in the boundary area using the adaptive correction filter unit;
[0529] 13.2. Otherwise, if the sample is outside the upper boundary or the lower boundary of the adaptive correction filter unit, the sample closest to the sample in the boundary area between the adaptive correction filter unit and the sample is used to replace the sample for filtering;
[0530] 13.3. Otherwise, that is, the sample does not meet the conditions in 13.1 or 13.2, then the sample is used for filtering.
[0531] Example 14: Optimization Scheme 3 for Sample Values at Filter Boundaries
[0532] Assume the filter shape is Figure 4A If the sample used in the adaptive correction filtering process (i.e., the reference pixel when filtering any pixel in the adaptive correction filtering unit) is a sample in the adaptive correction filtering unit (i.e., the reference pixel is in the adaptive correction filtering unit), the sample is used for filtering; if the sample used in the adaptive correction filtering process does not belong to the sample in the adaptive correction filtering unit (i.e., the reference pixel is not in the adaptive correction filtering unit), filtering is performed in the following manner:
[0533] 14.1. If the sample is outside the image boundary, or outside the slice boundary and filtering across the slice boundary is not allowed, then:
[0534] 14.1.1. If EalfEnableFlag is equal to 1, the sample closest to the sample in the boundary area of the adaptive correction filter unit is used to replace the sample for filtering;
[0535] 14.1.2. Otherwise, that is, EalfEnableFlag is equal to 0, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0536] 14.2. Otherwise, if the sample is outside the upper boundary or the lower boundary of the adaptive correction filter unit, then:
[0537] 14.2.1. If EalfEnableFlag is equal to 1, the sample closest to the sample in the boundary area of the adaptive correction filter unit is used to replace the sample for filtering;
[0538] 14.2.2. Otherwise, that is, EalfEnableFlag is equal to 0, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0539] 14.3. Otherwise, that is, the sample does not meet the conditions in 14.1 or 14.2, then the sample is used for filtering.
[0540] It should be noted that EalfEnableFlag refers to a flag, and its value may include '1' or '0'. When EalfEnableFlag is equal to 1, it indicates that enhanced adaptive correction filtering can be used; when EalfEnableFlag is equal to 0, it indicates that adaptive correction filtering should not be used.
[0541] Exemplarily, the value of EalfEnableFlag may be derived from a decoding end, where the value of EalfEnableFlag may be obtained from a bitstream or may be a constant value.
[0542] Exemplarily, the value of EalfEnableFlag may be equal to the value of ealf_enable_flag (ie, enhanced adaptive correction filtering enable flag); when EalfEnableFlag is equal to 1, it indicates that enhanced adaptive correction filtering can be used; when EalfEnableFlag is equal to 0, it indicates that adaptive correction filtering should not be used.
[0543] The ALF filtering optimization scheme is described in detail below.
[0544] Embodiment 15: Adaptive region division using LCU as the smallest unit
[0545] Encoding equipment
[0546] by Figure 2 Taking the fixed region division method shown in the figure as an example, for the brightness component of the image frame, the fixed region division can be performed in the manner described in the "Region Division" section above. The brightness component is divided into 16 regions, each region is marked as K, K∈[0,15], and there are one or more LCUs in each region.
[0547] The LCUs belonging to the same area are divided again.
[0548] For example, the LCU division method in the region can use the LCU merging method to calculate the cost of merging two LCUs, merge the two LCUs with the lowest cost, and so on, calculate all the costs when only [1, N6] classes are left after merging, and select a division method with the lowest cost. Mark the last choice of each LCU.
[0549] For example, the area category identifier can be divided into two categories at most, that is, N6=2. Therefore, each LCU is marked as 1 or 0, that is, the value of the area category identifier of the LCU includes 1 or 0.
[0550] Exemplarily, for an LCU marked as 0 (ie, the value of the region category identifier is 0), the region category to which it belongs is 2K; and for an LCU marked as 1 (ie, the value of the region category identifier is 1), the category to which it belongs is 2K+1.
[0551] Exemplarily, the luminance component is divided into 32 regions at most. After the region division, the 32 regions are merged to calculate the filter coefficient of each merged region. The LCU region division result (i.e., the region category identifier of each LCU) and the filter coefficient obtained after the region division are sent to the decoding end device through the bit stream.
[0552] Decoding equipment
[0553] For the brightness component of the image frame, fixed region division can be performed in the manner described in the "region division" section above. The brightness component is divided into 16 regions, and the schematic diagram of the division result can be shown as follows Figure 2 shown.
[0554] For any LCU in area K, the area category identifier of the LCU can be obtained; an LCU whose area category identifier value is 0 belongs to area category 2K; an LCU whose area category is 1 belongs to area category 2K+1.
[0555] Based on the region category of each LCU and the filter coefficient obtained by parsing the bitstream, the filter coefficient of each LCU is determined, and the ALF filtering is performed on the pixels of each LCU one by one based on the filter coefficient of each LCU.
[0556] Embodiment 16: Optimization scheme for transmitting two sets of filter coefficients in each region
[0557] Encoding equipment
[0558] Each LCU is identified, assuming that 0 means turning off ALF filtering, 1 means using the first group of filter coefficients, and 2 means using the second group of filter coefficients, that is, the value of the LCU coefficient identifier of the LCU includes 0, 1 or 2, the above-mentioned first value is 0, and the non-first value includes 1 or 2.
[0559] The coefficients of each region are marked, 0 means that only the first set of filter coefficients are used, 1 means that only the second set of filter coefficients are used, and 2 means that both sets of filter coefficients are used.
[0560] Exemplarily, the filter shape of the first set of filter coefficients may be as follows: Figure 4A As shown, the filter shape of the second set of filter coefficients can be as follows Fig.12 As shown (7*7 cross plus 3*3 square centrosymmetric filter shape).
[0561] During the filter coefficient training process, when the filter coefficient is calculated for the first time, the filter parameters use the pixels of all LCUs in the current area. After the CTU decision, the first set of coefficients is trained, and only the LCUs with the value of 1 are used for training. When training the second set of coefficients, only the LCUs with the value of 2 are used for training. Finally, the RDO decision determines whether the current area uses only one set of filters or the performance of two sets of filters.
[0562] If the performance of using only the first group of filter coefficients is optimal, the value of the regional coefficient identifier is determined to be 0, written into the bitstream, and the first group of filter coefficients is written into the bitstream, and the LCU coefficient identifier of each LCU is written into the bitstream, and the value of the LCU coefficient identifier of each LCU is 0 or 1; if the performance of using only the second group of filter coefficients is optimal, the value of the regional coefficient identifier is determined to be 1, written into the bitstream, and the second group of filter coefficients is written into the bitstream, and the LCU coefficient identifier of each LCU is written into the bitstream, and the value of the LCU coefficient identifier of each LCU is 0 or 1; if the performance of using two groups of filter coefficients is optimal, the value of the regional coefficient identifier is determined to be 2, written into the bitstream, and the two groups of filter coefficients are written into the bitstream, and the LCU identifier is written into the bitstream, and the value of the LCU coefficient identifier of each LCU is 0, 1 or 2.
[0563] Decoding equipment
[0564] For any merged area, the region coefficient identifier of the merged area is read from the bitstream. If the value of the region coefficient identifier is 0, the merged area obtains 15 filter coefficients (i.e., the first group of filter coefficients); if the value of the region coefficient identifier is 1, the merged area obtains 9 filter coefficients (i.e., the second group of filter coefficients); if the value of the region coefficient identifier is 2, the merged area obtains 9 filter coefficients and 15 filter coefficients respectively.
[0565] Exemplarily, if the value of the area coefficient identifier is 0, the LCU coefficient identifiers of all LCUs in the merged area are obtained; if the value of the LCU coefficient identifier is 0, it means that the ALF filtering is turned off for the LCU, that is, the ALF filtering is not started for the LCU; if the value of the LCU coefficient identifier is 1, it means that the ALF filtering is turned on for the LCU, that is, the ALF filtering is started for the LCU, and the LCU uses the first set of filter coefficients.
[0566] If the value of the area coefficient identifier is 1, the LCU coefficient identifiers of all LCUs in the merged area are obtained. If the value of the LCU coefficient identifier is 0, it means that the ALF filtering is turned off for the LCU, that is, the ALF filtering is not started for the LCU; if the value of the LCU coefficient identifier is 1, it means that the ALF filtering is turned on for the LCU, that is, the ALF filtering is started for the LCU, and the LCU uses the second set of filter coefficients.
[0567] If the value of the regional coefficient identifier is 2, the LCU coefficient identifiers of all LCUs in the merged area are obtained. If the value of the LCU coefficient identifier is 0, it means that the ALF filtering is turned off for the LCU, that is, the ALF filtering is not started for the LCU; if the value of the LCU coefficient identifier is 1, it means that the ALF filtering is turned on for the LCU, that is, the ALF filtering is started for the LCU, and the LCU uses the first set of filter coefficients; if the value of the LCU coefficient identifier is 2, it means that the ALF filtering is turned on for the LCU, that is, the ALF filtering is started for the LCU, and the LCU uses the second set of filter coefficients.
[0568] Embodiment 17: Each LCU adaptively selects a set of filter coefficients
[0569] Encoding equipment
[0570] For example, each LCU can select up to 3 groups of filter coefficients. That is, for any LCU, the candidate filter coefficients of the LCU include the filter coefficients of the merged area to which the LCU belongs (which can be called the filter coefficients of the current merged area), the filter coefficients of the previous merged area to which the LCU belongs (which can be called the filter coefficients of the previous merged area), and the filter coefficients of the next merged area to which the LCU belongs (which can be called the filter coefficients of the next merged area).
[0571] For any LCU, the performance under three groups of filter coefficients can be calculated respectively (RDO decision), and a group of filter coefficients with the best performance can be selected.
[0572] Exemplarily, if the group filter coefficient with the best performance is the filter of the previous merged area, the value of the coefficient selection identifier of the LCU is 0 (that is, taking the first value of 0 as an example); if the filter coefficient with the best performance is the filter coefficient of the current merged area, the value of the coefficient selection identifier of the LCU is 1 (that is, taking the second value of 1 as an example); if the filter coefficient with the best performance is the filter coefficient of the next merged area, the value of the coefficient selection identifier of the LCU is 2 (that is, taking the third value of 2 as an example).
[0573] For example, suppose the current image frame merge area is Fig.13As shown, the number of merged areas is 16; when making a CTU decision, if the currently processed LCU belongs to merged area 2, the candidate filter coefficients of the LCU may include the filter coefficients of merged area 1, the filter coefficients of merged area 2, and the filter coefficients of merged area 3. The filter coefficients with the best performance can be determined based on the RDO decision, and the LCU can be marked based on the decision result.
[0574] It should be noted that since the chrominance component (U component or V component) has only one set of filter coefficients, its LCU may not participate in the selection of the filter coefficients, or the LCUs of the two chrominance components may select the filter coefficients on the other component, that is, the LCU of the U component may select the filter coefficients of the V component, and the LCU of the V component may select the filter coefficients of the U component.
[0575] Decoding equipment
[0576] Obtain the filter coefficient of the merged area to which the current LCU belongs (i.e., the filter coefficient of the current area), as well as the filter coefficients of the two adjacent areas (i.e., the filter coefficient of the previous merged area and the filter coefficient of the next merged area), and select the filter coefficient of the current LCU according to the coefficient selection identifier of the LCU.
[0577] It should be noted that since there is only one set of filter coefficients on each of the two chrominance components, their LCUs may not participate in the selection of the filter coefficients, or, when the ALF filter switches are turned on for both chrominance components, the LCUs on the two chrominance components may select the filter coefficients on the other component, that is, the LCU of the U component may select the filter coefficients of the V component, and the LCU of the V component may select the filter coefficients of the U component.
[0578] Embodiment 18: Selecting filters of different shapes for each region
[0579] Encoding equipment
[0580] For example, the filter shape may be selected as shown in FIG4 or Fig.12 The filter shape can also be selected as Fig.14 Two or more of the four filter shapes shown in FIG. 4 and FIG. Fig. 9 as well as Fig.10 Other filter shapes than those shown.
[0581] For any merged area, N3 groups of filter coefficients can be trained. The filter shapes of the N3 groups of filter coefficients are different. The performance of the merged area after using one of the filter shapes is calculated in each area, and the group of filter coefficients with the best performance is selected. The corresponding filter shape is sent to the decoding end device through the bit stream, and the filter coefficients with the best performance in the merged area are sent to the decoding end device.
[0582] Decoding equipment
[0583] For any LCU, when it is determined to start ALF filtering for the LCU, a filter shape of the merged area is obtained based on the merged area to which the LCU belongs, and a filter coefficient of the merged area is obtained based on the filter shape.
[0584] When the filter coefficient of the current LCU is determined, ALF filtering may be performed on pixels of the current LCU one by one based on the filter coefficient of the current LCU.
[0585] Embodiment 19: Modifying the symmetric filter into an asymmetric filter
[0586] Encoding equipment
[0587] by Figure 4A Taking the filter shape shown in the figure as an example, C i The weight coefficient A of the pixel value of the reference pixel at position (i=0, 1, ..., 13) i , at this time its symmetrical position C 28-i The corresponding reference pixel value weight is 2-A i .
[0588] For example, A i ∈[0.5, 0.6, 0.8, 1.2, 1.4, 1.5, 1].
[0589] like Figure 4A As shown, there are 14 symmetrical positions in total. The filter coefficients and filter performance of the region under different weight coefficients corresponding to each position can be calculated. A set of filter coefficients with the best filter performance is selected, and the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter are recorded.
[0590] Exemplarily, for any weight coefficient, a number (or index) for identifying the position of the weight coefficient in the weight coefficient set may be transmitted to the decoding end device.
[0591] Decoding equipment
[0592] Get the filter coefficient of each region and the weight coefficient corresponding to each filter coefficient.
[0593] For any merged region, its filter coefficient and the weight coefficient corresponding to each filter coefficient are obtained to derive the filter coefficient at the corresponding position.
[0594] For any pixel of the LCU, the pixel value after filtering can be determined by:
[0595]
[0596] Among them, Ci is the (i+1)th filter coefficient in the filter coefficients of the merged area to which the LCU belongs, P i is the filter coefficient C i The pixel value at the corresponding reference pixel position, P 28-i The corresponding reference pixel position and P i The corresponding reference pixel position is symmetrical about the pixel position of the current filtering pixel, A i P i The weight coefficient of the pixel value at the corresponding reference pixel position, P 14 is the pixel value of the current filtered pixel, C 14 is the filter coefficient of the current filter pixel, 0<A i <2.
[0597] Embodiment 20: Each LCU adaptively selects a set of filter coefficients
[0598] In the process of filtering pixels, for any pixel to be filtered, the maximum and minimum pixel values are taken out in the 3*3 pixel block (the 3*3 pixel block with the current pixel to be filtered as the center point, and excluding the current pixel to be filtered), that is, the maximum and minimum pixel values of the 8 pixels excluding the center position in the 3*3 pixel block with the current pixel to be filtered as the center.
[0599] If the pixel value of the current pixel to be filtered is greater than the maximum value, or less than the minimum value, the maximum value or the minimum value will replace the pixel value of the current pixel to be filtered to participate in filtering, that is, if the pixel value of the current pixel to be filtered is greater than the maximum value, the pixel value of the current pixel to be filtered will be replaced by the maximum value to participate in filtering; if the pixel value of the current pixel to be filtered is less than the minimum value, the pixel value of the current pixel to be filtered will be replaced by the minimum value to participate in filtering.
[0600] The following is a detailed description of the adaptive correction filter decoding process
[0601] Embodiment 21: Adaptive correction filtering decoding process
[0602] 1. Definition of adaptive correction filter parameters:
[0603] Parameter 1, adaptive correction filter enable flag (alf_enable_flag): a binary variable. A value of '1' indicates that the adaptive correction filter can be used; a value of '0' indicates that the adaptive correction filter should not be used.
[0604] Exemplarily, the value of AlfEnableFlag is equal to the value of alf_enable_flag.
[0605] It should be noted that the value of alf_enable_flag can be obtained from the sequence header, that is, before the entire sequence starts to be compressed, a value of '1' indicates that the ALF technology of the entire video sequence is turned on, and a value of '0' indicates that the ALF technology of the entire video sequence is turned off, which is a sequence header flag.
[0606] Parameter 2, enhanced adaptive correction filter enable flag (ealf_enable_flag): a binary variable. A value of '1' indicates that the enhanced adaptive correction filter can be used; a value of '0' indicates that the enhanced adaptive correction filter should not be used.
[0607] Exemplarily, the value of EalfEnableFlag is equal to the value of ealf_enable_flag, and its syntax is described as follows:
[0608] if(AlfEnableFlag){ ealf_enable_flag u(1) }
[0609] It should be noted that when the value of AlfEnableFlag is 1, the enhanced adaptive correction filtering enable flag is read from the bitstream, and the flag is a sequence header flag.
[0610] Parameter 3, picture-level adaptive correction filter enable flag (picture_alf_enable_flag[compIdx]): binary variable. A value of '1' indicates that the compIdx-th component of the current image can use adaptive correction filtering; a value of '0' indicates that the compIdx-th component of the current image should not use adaptive correction filtering.
[0611] Exemplarily, the value of PictureAlfEnableFlag[compIdx] is equal to the value of picture_alf_enable_flag[compIdx], and its syntax description is as follows:
[0612] if(AlfEnableFlag){ for(compIdx=0;compIdx<3;compIdx++){ picture_alf_enable_flag[compIdx] u(1) }
[0613] It should be noted that when the value of AlfEnableFlag is 1, the image-level adaptive correction filtering enable flag of the three components Y, U, and V is read from the bitstream, and this flag is the image header flag.
[0614] Parameter 4, image luminance component sample adaptive correction filter coefficient (alf_coeff_luma[i][j]): alf_coeff_luma[i][j] represents the jth coefficient of the i-th adaptive correction filter of the luminance component.
[0615] Exemplarily, the value of AlfCoeffLuma[i][j] is equal to the value of alf_coeff_luma[i][j].
[0616] For example, if the value of EalfEnableFlag is 0, the value range of AlfCoeffLuma[i][j] (j=0-7) should be -64-63, and the value range of AlfCoeffLuma[i][8] should be -1088-1071.
[0617] If the value of EalfEnableFlag is 1, the value range of AlfCoeffLuma[i][j] (j=0~13) should be -64~63, and the value range of AlfCoeffLuma[i]
[14] should be -1088~1071.
[0618] Parameter 5, image chrominance component adaptive correction filter coefficients (alf_coeff_chroma[0][j], alf_coeff_chroma[1][j]): alf_coeff_chroma[0][j] represents the coefficient of the j-th adaptive correction filter of the Cb component, and alf_coeff_chroma[1][j] represents the coefficient of the j-th adaptive correction filter of the Cr component.
[0619] Illustratively, the value of AlfCoeffChroma[0][j] is equal to the value of alf_coeff_chroma[0][j], and the value of AlfCoeffChroma[1][j] is equal to the value of alf_coeff_chroma[1][j].
[0620] For example, if the value of EalfEnableFlag is 0, the value range of AlfCoeffChroma[i][j] (i=0~1, j=0~7) should be -64~63, and the value range of AlfCoeffChroma[i][8] (i=0~1) should be -1088~1071.
[0621] If the value of EalfEnableFlag is 1, the value range of AlfCoeffChroma[i][j] (i=0~1, j=0~13) should be -64~63, and the value range of AlfCoeffChroma[i]
[14] (i=0~1) should be -1088~1071.
[0622] Parameter 6, number of adjacent adaptive correction filter regions of image brightness component (alf_region_distance[i]): alf_region_distance[i] represents the difference between the starting number of the i-th adaptive correction filter region basic unit of the brightness component and the starting number of the i-1-th adaptive correction filter region basic unit.
[0623] Exemplarily, the value range of alf_region_distance[i] should be 1 to FilterNum-1.
[0624] For example, when alf_region_distance[i] does not exist in the bitstream, if i is equal to 0, the value of alf_region_distance[i] is 0; if i is not equal to 0 and the value of alf_filter_num_minus1 is FilterNum-1, the value of alf_region_distance[i] is 1.
[0625] Exemplarily, the sum of alf_region_distance[i] (i=0-alf_filter_num_minus1) should be less than or equal to FilterNum-1.
[0626] Parameter 7, LCU adaptive correction filter enable flag (alf_lcu_enable_flag[compIdx][LcuIndex]): binary variable. A value of '1' indicates that the sample of the LcuIndex-th LCU compIdx component should use adaptive correction filtering; a value of '0' indicates that the sample of the LcuIndex-th LCU compIdx component should not use adaptive correction filtering.
[0627] Exemplarily, the value of AlfLCUEnableFlag[compIdx][LcuIndex] is equal to the value of alf_lcu_enable_flag[compIdx][LcuIndex], and its syntax description is as follows:
[0628]
[0629] It should be noted that if one of the image-level adaptive correction filter enable flags on the three components is 1, the following adaptive correction filter parameters are obtained, that is, if EalfEnableFlag = 1, each filter coefficient is 15, and the luminance component is divided into 64 regions; otherwise, each filter coefficient is 9, and the luminance component is divided into 16 regions. Then obtain the filter coefficients on the three components respectively. If the image-level adaptive correction filter enable flag is turned on, if it is on chrominance, it is necessary to obtain the filter coefficient alf_coeff_chroma on the component; if it is on luminance, it is necessary to obtain the region merging mode flag alf_region_order_idx, the number of filters minus 1 alf_filter_num_minus1, the region merging result alf_region_distance[i]), and each filter coefficient alf_coeff_luma.
[0630] The syntax description of the above adaptive correction filter parameters can be as follows:
[0631]
[0632]
[0633] 2. Specific process of adaptive correction filtering decoding
[0634] If the value of PictureAlfEnableFlag[compIdx] is 0, the value of the offset sample component is directly used as the value of the corresponding reconstructed sample component; otherwise, adaptive correction filtering is performed on the corresponding offset sample component.
[0635] Exemplarily, compIdx equal to 0 represents the luminance component, equal to 1 represents the Cb component, and equal to 2 represents the Cr component.
[0636] The unit of the adaptive correction filter is an adaptive correction filter unit derived from the maximum coding unit, which is processed in sequence according to the raster scanning order. First, the adaptive correction filter coefficients of each component are obtained according to the adaptive correction filter coefficient decoding process, and then the adaptive correction filter unit is derived, and the adaptive correction filter coefficient index of the brightness component of the current adaptive correction filter unit is determined, and finally, the adaptive correction filter is performed according to the brightness and chrominance components of the adaptive correction filter unit to obtain the reconstructed sample.
[0637] Adaptive correction filter coefficient decoding process:
[0638] 21.1.1. If EalfEnableFlag is equal to 0, the i-th group of filter coefficients AlfCoeffLuma[i][j] (i=0~alf_filter_num_minus1, j=0~7) of the luminance sample is parsed from the bitstream. Fig.12 C8 in the filter shown is treated as follows:
[0639]
[0640] Wherein, the bit width of AlfCoeffLuma[i][j] (j=0~7) is 7 bits, and the value range is -64~63; after the above processing, the value range of AlfCoeffLuma[i][8] is 0~127.
[0641] If EalfEnableFlag is equal to 1, the i-th group of filter coefficients AlfCoeffLuma[i][j] (i=0~alf_filter_num_minus1, j=0~13) of the luminance sample is parsed from the bitstream. Figure 4A The C in the filter shown 14 ) to do the following:
[0642]
[0643] Wherein, the bit width of AlfCoeffLuma[i][j] (j=0~13) is 7 bits, and the value range is -64~63; after the above processing, the value range of AlfCoeffLuma[i]
[14] is 0~127.
[0644] 21.1.2. According to alf_region_distance[i] (i>1), the adaptive correction filter coefficient index array of the brightness component is obtained (denoted as alfCoeffIdxTab[FilterNum]):
[0645] count=0
[0646] alfCoeffIdxTab[0]=0
[0647] for(i=1;i <alf_filter_num_minus1+1;i++){
[0648] for(j=0; j <alf_region_distance[i]-1;j++){
[0649] alfCoeffIdxTab[count+1]=alfCoeffIdxTab[count]
[0650] count=count+1
[0651] }
[0652] alfCoeffIdxTab[count+1]=alfCoeffIdxTab[count]+1
[0653] count=count+1
[0654] }
[0655] for(i=count;i <FilterNum;i++){
[0656] alfCoeffIdxTab[i]=alfCoeffIdxTab[count]
[0657] 21.1.3. If EalfEnableFlag is equal to 0, the filter coefficients AlfCoeffChroma[0][j] and AlfCoeffChroma[1][j] (j=0-7) of the chroma samples are parsed from the bitstream. For the coefficients AlfCoeffChroma[0][8] and AlfCoeffChroma[1][8] (i.e. Fig.12 C8 in the filter shown is processed as follows:
[0658]
[0659] Wherein, the bit width of AlfCoeffChroma[i][j] (j=0-7) is 7 bits, and the value range is -64-63; after the above processing, the value range of AlfCoeffChroma[i][8] is 0-127.
[0660] If EalfEnableFlag is equal to 1, the filter coefficients AlfCoeffChroma[0][j] and AlfCoeffChroma[1][j] (j=0-13) of the chroma samples are parsed from the bitstream. Figure 4A The C in the filter shown 14 ) respectively do the following processing:
[0661]
[0662] Wherein, the bit width of AlfCoeffChroma[i][j] (j=0-13) is 7 bits, and the value range is -64-63; after the above processing, the value range of AlfCoeffChroma[i]
[14] is 0-127.
[0663] Export Adaptive Correction Filter Unit
[0664] According to the current maximum coding unit, the adaptive correction filter unit is derived according to the following steps (which can be as follows Figure 5 shown):
[0665] 21.2.1. Delete the portion of the sample region where the current largest coding unit C is located that exceeds the image boundary to obtain a sample region D;
[0666] 21.2.2. If the sample at the lower boundary of sample area D does not belong to the lower boundary of the image, shrink the lower boundary of the luminance component and chrominance component sample area D upward by four rows to obtain sample area E1; otherwise, let sample area E1 be equal to sample area D. The last row of samples in sample area D is the lower boundary of the area;
[0667] 21.2.3. If the sample at the upper boundary of sample area E1 belongs to the upper boundary of the image, or belongs to the slice boundary and the value of cross_patch_loopfilter_enable_flag is '0', let sample area E2 be equal to sample area E1; otherwise, extend the upper boundary of luminance component and chrominance component sample area E1 upward by four rows to obtain sample area E2. The first row of samples in sample area E1 is the upper boundary of the area;
[0668] 21.2.4. Use sample area E2 as the current adaptive correction filter unit. The first row of samples of the image is the upper boundary of the image, and the last row of samples is the lower boundary of the image.
[0669] Determine the adaptive correction filter coefficient index of the brightness component adaptive correction filter unit
[0670] If the value of EalfEnableFlag is equal to 0, the adaptive correction filter coefficient index (referred to as filterIdx) of the current luminance component adaptive correction filter unit is calculated according to the following method:
[0671] xInterval=((((horizontal_size+(1<<LcuSizeInBit)-1)> >LcuSizeInBit)+1)>>2)< <LcuSizeInBit
[0672] yInterval=((((vertical_size+(1<<LcuSizeInBit)-1)> >LcuSizeInBit)+1)>>2)< <LcuSizeInBit
[0673] if(xInterval==0&&yInterval==0){
[0674] index=15
[0675] }
[0676] else if(xInterval == 0){
[0677] index=Min(3,y / yInterval)*4+3
[0678] }
[0679] else if (yInterval == 0) {
[0680] index=Min(3,x / xInterval)+12
[0681] }
[0682] else{
[0683] index=Min(3,y / yInterval)*4+Min(3,x / xInterval)
[0684] }
[0685] filterIdx=alfCoeffIdxTab[regionTable[index]]
[0686] Among them, (x, y) is the coordinate of the upper left corner sample of the largest coding unit in the image from which the current adaptive correction filter unit is derived, and regionTable is defined as follows:
[0687] regionTable
[16] ={0,1,4,5,15,2,3,6,14,11,10,7,13,12,9,8}
[0688] If EalfEnableFlag is equal to 1, the adaptive correction filter coefficient index (referred to as filterIdx) of the current luminance component adaptive correction filter unit is calculated according to the following method.
[0689] lcu_width=1< <LcuSizeInBit
[0690] lcu_height=1<<LcuSizeInBit
[0691] y_interval=((((vertical_size+lcu_height-1) / lcu_height)+4) / 8*lcu_height)
[0692] x_interval=((((horizontal_size+lcu_width-1) / lcu_width)+4) / 8*lcu_width)
[0693] if(yInterval==0){
[0694] y_st_offset=0
[0695] }
[0696] else{
[0697] y_cnt=Clip3(0,8,(vertical_size+y_interval-1) / y_interval)
[0698] y_st_offset=vertical_size-y_interval*(y_cnt-1)
[0699] y_st_offset=(y_st_offset+lcu_height / 2) / lcu_height*lcu_height
[0700] }
[0701] if(xInterval==0){
[0702] x_st_offset=0
[0703] }
[0704] else{
[0705] x_cnt=Clip3(0,8,(horizontal_size+x_interval-1) / x_interval)
[0706] x_st_offset=horizontal_size-x_interval*(x_cnt-1)
[0707] x_st_offset=(x_st_offset+lcu_width / 2) / lcu_width*lcu_width
[0708] }
[0709] y_index=(y_interval==0)?7:Clip3(0,7,y / y_interval)
[0710] y_index_offset=y_index<<3
[0711] y_index2=(y_interval==0||y<y_st_offset)?0:Clip3(-1,6,(y-y_st_offset) / y_interval)+1
[0712] y_index_offset2=y_index2<<3
[0713] x_index=(x_interval==0)?7:Clip3(0,7,x / x_interval)
[0714] x_index2=(x_interval==0||x<x_st_offset)?0:Clip_post(-1,6,(x-x_st_offset) / x_interval)+1
[0715] if(AlfRegionOrderIndex==0){
[0716] filterIdx=alfCoeffIdxTab[regionTable[0][y_index_offset+x_index]]
[0717] }
[0718] else if(AlfRegionOrderIndex==1)
[0719] filterIdx=alfCoeffIdxTab[regionTable[1][y_index_offset+x_index2]]
[0720] }
[0721] else if(AlfRegionOrderIndex==2)
[0722] filterIdx=alfCoeffIdxTab[regionTable[2][y_index_offset2+x_index2]]
[0723] }
[0724] else if(AlfRegionOrderIndex===3)
[0725] filterIdx=alfCoeffIdxTab[regionTable[3][y_index_offset2+x_index]]
[0726] }
[0727] Among them, (x, y) is the coordinate of the upper left corner sample of the largest coding unit in the image from which the current adaptive correction filter unit is derived, and regionTable is defined as follows:
[0728] regionTable[4]
[64] ={
[0729] {63,60,59,58,5,4,3,0,62,61,56,57,6,7,2,1,49,50,55,54,9,8,13,14,48,51,52,53,10,11,12,15,47,46,33,32,31,30,17,16,44,45,34,35,28,29,18,19,43,40,39,36,27,24,23,20,42,41,38,37,26,25,22,21},
[0730] {42,43,44,47,48,49,62,63,41,40,45,46,51,50,61,60,38,39,34,33,52,55,56,59,37,36,35,32,53,54,57,58,26,27,28,31,10,9,6,5,25,24,29,30,11,8,7,4,22,23,18,17,12,13,2,3,21,20,19,16,15,14,1,0},
[0731] {21,22,25,26,37,38,41,42,20,23,24,27,36,39,40,43,19,18,29,28,35,34,45,44,16,17,30,31,32,33,46,47,15,12,11,10,53,52,51,48,14,13,8,9,54,55,50,49,1,2,7,6,57,56,61,62,0,3,4,5,58,59,60,63},
[0732] {0,1,14,15,16,19,20,21,3,2,13,12,17,18,23,22,4,7,8,11,30,29,24,25,5,6,9,10,31,28,27,26,58,57,54,53,32,35,36,37,59,56,55,52,33,34,39,38,60,61,50,51,46,45,40,41,63,62,49,48,47,44,43,42}}
[0733] Adaptive Correction Filter Operation
[0734] If the left boundary outside the current adaptive correction filter unit is the image boundary, or is located outside the slice boundary and the value of CplfEnableFlag is 0, the left boundary outside does not exist, otherwise the left boundary outside is the area where the current adaptive correction filter unit is shifted 3 sample points to the left to the current adaptive correction filter unit.
[0735] If the right boundary outside the current adaptive correction filter unit is the image boundary, or is outside the slice boundary and the value of CplfEnableFlag is 0, then the right boundary outside does not exist. Otherwise, the area outside the right boundary is the area where the current adaptive correction filter unit is shifted 3 sample points to the left to the current adaptive correction filter unit.
[0736] Exemplarily, the boundary area includes a left outer boundary area and a right outer boundary area.
[0737] If AlfLCUEnableFlag[compIdx][LcuIndex] is equal to 1, adaptive correction filtering is performed on the compIdx component, otherwise adaptive correction filtering is not performed.
[0738] If EalfEnableFlag is equal to 0, when the sample used in the adaptive correction filtering process is a sample in the adaptive correction filtering unit, the sample is directly used for filtering; when the sample used in the adaptive correction filtering process does not belong to the sample in the adaptive correction filtering unit, filtering is performed as follows:
[0739] 21.3.1. If the sample is outside the image boundary or outside the slice boundary and the value of CplfEnableFlag is 0, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0740] 21.3.2. Otherwise, if the sample is outside the upper boundary or the lower boundary of the adaptive correction filter unit, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering;
[0741] 21.3.3. If the conditions in 21.3.1 and 21.3.2 are not met, use the sample for filtering.
[0742] Exemplarily, the adaptive correction filtering operation of the brightness component of the adaptive correction filtering unit is as follows:
[0743] ptmp=AlfCoeffLuma[filterIdx][8]*p(x,y)
[0744] for(j=0;j<8;j++){
[0745] ptmp+=AlfCoeffLuma[filterIdx][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
[0746] }
[0747] ptmp=(ptmp+32)>>6
[0748] p'(x,y)=Clip3(0,(1< <BitDepth)–1,ptmp)
[0749] Wherein, p(x, y) is the sample after migration, p'(x, y) is the reconstructed sample, Hor[j] and Ver[j] (j=0~7).
[0750] Exemplarily, the adaptive correction filtering operation of the chrominance component of the adaptive correction filtering unit is as follows:
[0751] ptmp=AlfCoeffChroma[i][8]*p(x,y)
[0752] for(j=0;j<8;j++){
[0753] ptmp+=AlfCoeffChroma[i][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
[0754] }
[0755] ptmp=(ptmp+32)>>6
[0756] p'(x,y)=Clip3(0,(1< <BitDepth)–1,ptmp)
[0757] Among them, p(x, y) is the sample after migration, p'(x, y) is the reconstructed sample, Hor[j] and Ver[j] (j=0~7), which can be shown in Table 1.
[0758] Table 1. Sample compensation filter coordinate offset values
[0759] The value of j The value of Hor[j] The value of Ver[j] 0 0 3 1 0 2 2 1 1 3 0 1 4 1 -1 5 3 0 6 2 0 7 1 0
[0760] If EalfEnableFlag is equal to 1, when the sample used in the adaptive correction filtering process is a sample in the adaptive correction filtering unit, the sample is directly used for filtering; when the sample used in the adaptive correction filtering process does not belong to the sample in the adaptive correction filtering unit, filtering is performed as follows:
[0761] 21.4.1. If the sample is outside the image boundary, or outside the slice boundary and the value of CplfEnableFlag is 0, then:
[0762] 21.4.1.1, Figure 4A As an example, if the sample corresponds to filter shape C1, C2, C6, C4, C5 or C 10 When the position is reached, the sample is replaced by the adaptive correction filter unit and the sample closest to the sample in the boundary area for filtering;
[0763] 21.4.1.2. Otherwise, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering.
[0764] 21.4.2. Otherwise, if the sample is outside the upper or lower boundary of the adaptive correction filter unit, then:
[0765] 21.4.2.1. Figure 4A As an example, if the sample corresponds to filter shape C1, C2, C6, C4, C5 or C 10 When the position is reached, the sample is replaced by the adaptive correction filter unit and the sample closest to the sample in the boundary area for filtering;
[0766] 21.4.2.2. Otherwise, the sample closest to the sample in the adaptive correction filter unit is used to replace the sample for filtering.
[0767] 21.4.3. Otherwise, that is, the conditions in 21.4.1 and 21.4.2 are not met, use the sample for filtering.
[0768] Exemplarily, the adaptive correction filtering operation of the brightness component of the adaptive correction filtering unit is as follows:
[0769] ptmp=AlfCoeffLuma[filterIdx]
[14] *p(x,y)
[0770] for(j=0;j<14;j++){
[0771] ptmp+=AlfCoeffLuma[filterIdx][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
[0772] }
[0773] ptmp=(ptmp+32)>>6
[0774] p'(x,y)=Clip3(0,(1< <BitDepth)–1,ptmp)
[0775] Wherein, p(x, y) is the sample after migration, p'(x, y) is the reconstructed sample, Hor[j] and Ver[j] (j=0-13), which can be shown in Table 2.
[0776] Exemplarily, the adaptive correction filtering operation of the chrominance component of the adaptive correction filtering unit is as follows:
[0777] ptmp=AlfCoeffChroma[i]
[14] *p(x,y)
[0778] for(j=0;j<14;j++){
[0779] ptmp+=AlfCoeffChroma[i][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
[0780] }
[0781] ptmp=(ptmp+32)>>6
[0782] p'(x,y)=Clip3(0,(1< <BitDepth)–1,ptmp)
[0783] Table 2. Sample compensation filter coordinate offset values
[0784] The value of j The value of Hor[j] The value of Ver[j] 0 0 3 1 2 2 2 1 2 3 0 2 4 1 -2 5 2 -2 6 2 1 7 1 1 8 0 1 9 1 -1 10 2 -1 11 3 0 12 2 0 13 1 0
[0785] Embodiment 22
[0786] First, the image can be divided into fixed regions. The fixed region division results can be shown as Figure 2 As shown in the figure, the index value of each area is obtained. For each area, we can consider Fig.18A Alternatively, you can keep the 8 divisions shown. Fig.18A The division of parts shown is as follows: Fig.18B shown.
[0787] For each region, the encoding end device can determine the final division method based on the RDO decision, and transmit the division method of each region to the decoding end device through the code stream.
[0788] For example, Fig.18A Take the last division method in as an example. The areas obtained by 16 fixed division methods can be divided into 64 areas at most.
[0789] In the decoding process, the decoding end device can first perform fixed area division, and then read the specific division method of each area from the bit stream to obtain the final division method of the entire frame.
[0790] For example, Fig.18A For each division method, the area number after division can be as follows Fig.18C shown.
[0791] Exemplarily, the value of J is the maximum index value of the previous region + 1.
[0792] Embodiment 23
[0793] Taking LCU as an example, the smallest unit of fixed area division, when the image resolution is small, there are some areas where only numbers are retained and no image information is contained in the areas.
[0794] For such a situation, after the fixed area division result is determined, it can be determined which specific category has no image information.
[0795] For example, it can be determined based on the number of LCUs contained in the image width and height. If the fixed area is divided into fixed 4*4 areas, each area index is as follows Figure 2 As shown, when the number of LCUs in width or height is less than 4, there will be areas on some columns or rows that do not contain image information. All these areas that do not contain image information are recorded as set G. The size of set G is recorded as N7, where N7 is a positive integer.
[0796] For any index value i among all index values,
[0797] 23.1. If i is equal to any element in the set G, then i = 0;
[0798] 23.2. Otherwise, that is, i is not equal to any element in the set G, then if i is greater than n elements in the set G, then i=ik; k≤N7.
[0799] It should be noted that the above embodiments are merely specific examples of implementation methods of the embodiments of the present application, and are not limitations on the protection scope of the present application. Based on the above embodiments, new embodiments can be obtained by combining the embodiments or modifying the embodiments, which should all fall within the protection scope of the present application.
[0800] In addition, the implementation processes of the encoding end and the decoding end in the above-mentioned embodiments can refer to each other.
[0801] The method provided by the present application is described above. The device provided by the present application is described below:
[0802] See also Fig.19 , Fig.19 is a structural schematic diagram of a filtering device provided in an embodiment of the present application, wherein the filtering device can be applied to a decoding end device, and the device may include:
[0803] A division unit 1910 is used to divide the brightness component of the current image frame into regions;
[0804] A first determining unit 1920 is configured to determine a region category to which the LCU belongs based on a region category identifier of the LCU obtained by parsing the bitstream;
[0805] The second determining unit 1930 is configured to determine the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient obtained by parsing the bitstream;
[0806] The filtering unit 1940 is configured to perform ALF filtering on pixels of the LCU one by one based on the filtering coefficient of the LCU.
[0807] In a possible implementation manner, the first determining unit 1920 determines the region category to which the LCU belongs based on the region category identifier of the LCU parsed from the bitstream, including:
[0808] Based on the region to which the LCU belongs and the region category identifier of the LCU, the region category to which the LCU belongs is determined.
[0809] In a possible implementation manner, the area category identifier of the LCU is used to identify the category of the LCU in the area to which the LCU belongs, and the category of the LCU in the area to which the LCU belongs is determined by classifying each LCU in the area to which the LCU belongs;
[0810] The first determining unit 1920 determines the region category to which the LCU belongs based on the region to which the LCU belongs and the region category identifier of the LCU, including:
[0811] The region category to which the LCU belongs is determined based on the number of categories of each region, the region to which the LCU belongs, and the region category identifier of the LCU.
[0812] In a possible implementation manner, the first determining unit 1920 determines the region category to which the LCU belongs based on the number of categories of each region, the region to which the LCU belongs, and the region category identifier of the LCU, including:
[0813] Determine the total number of categories of the regions before the region to which the LCU belongs based on the number of categories of the regions before the region to which the LCU belongs;
[0814] The category of the region to which the LCU belongs is determined based on the total number of categories of regions before the region to which the LCU belongs and the region category identifier of the LCU.
[0815] In a possible implementation manner, before the second determining unit 1930 determines the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream, the second determining unit 1930 further includes:
[0816] Determine whether to start ALF filtering for the LCU;
[0817] When it is determined to start ALF filtering for the LCU, it is determined to perform the operation of determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream.
[0818] In a possible implementation manner, the second determining unit 1930 determines whether to start ALF filtering for the LCU, including:
[0819] Parsing an LCU coefficient identifier of the LCU from a bitstream; wherein the LCU coefficient identifier is used to identify a filter coefficient used by the LCU in at least one set of filter coefficients used in a merged region to which the LCU belongs;
[0820] When the value of the LCU coefficient identifier of the LCU is not the first value, it is determined to start ALF filtering for the LCU.
[0821] In a possible implementation manner, the second determining unit 1930 determines the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream, including:
[0822] The filter coefficient of the LCU is determined based on the region category to which the LCU belongs, the filter coefficient parsed from the bitstream, and the region coefficient identifier of the merged region to which the LCU belongs parsed from the bitstream; wherein the region coefficient identifier is used to identify the filter coefficient used by the merged region to which the LCU belongs in a preset plurality of groups of filter coefficients.
[0823] In a possible implementation manner, the second determining unit 1930 determines the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient obtained by parsing the bitstream, and the region coefficient identifier of the merged region to which the LCU belongs obtained by parsing the bitstream, including:
[0824] When it is determined based on the area coefficient identifier of the merged area to which the LCU belongs that the merged area uses multiple sets of filter coefficients, the filter coefficient of the LCU is determined based on the area category to which the LCU belongs, the filter coefficient parsed from the bit stream, and the LCU coefficient identifier of the LCU.
[0825] In a possible implementation manner, the second determining unit 1930 determines the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream, including:
[0826] The filter coefficient of the LCU is determined based on the region category to which the LCU belongs, the filter coefficient parsed from the bitstream, and the coefficient selection identifier of the LCU; wherein the coefficient selection identifier is used to identify the filter coefficient selected for use by the LCU from multiple groups of candidate filter coefficients.
[0827] In a possible implementation manner, the second determining unit 1930 determines the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient obtained by parsing the bitstream, and the coefficient selection identifier of the LCU, including:
[0828] When the value of the coefficient selection identifier of the LCU is the first value, a filter coefficient of a previous merged area of the merged area to which the LCU belongs is determined as the filter coefficient of the LCU; the previous merged area of the merged area to which the LCU belongs is a merged area corresponding to a previous adjacent index of the index of the merged area to which the LCU belongs;
[0829] When the value of the coefficient selection identifier of the LCU is the second value, determining the filter coefficient of the merged area to which the LCU belongs as the filter coefficient of the LCU;
[0830] When the value of the coefficient selection identifier of the LCU is the third value, the filter coefficient of the next merged area of the merged area to which the LCU belongs is determined as the filter coefficient of the LCU, and the next merged area of the merged area to which the LCU belongs is the merged area corresponding to the next adjacent index of the index of the merged area to which the LCU belongs.
[0831] In a possible implementation manner, the second determining unit 1930 parses the bitstream to obtain the filter coefficient, including:
[0832] For any merged region, the filter shape of the merged region is parsed from the bitstream;
[0833] Based on the filter shape, the filter coefficients of the merged area are parsed from the bitstream.
[0834] In a possible implementation manner, the second determining unit 1930 determines the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the bitstream, including:
[0835] Determine a filter shape and a filter coefficient of the LCU based on the region category to which the LCU belongs and the filter shape and filter coefficient obtained by parsing the bitstream;
[0836] The performing ALF filtering on pixels of the LCU one by one based on the filter coefficient of the LCU includes:
[0837] ALF filtering is performed on pixels of the LCU one by one based on a filter shape and a filter coefficient of the LCU.
[0838] In a possible implementation manner, the filtering unit 1940 performs ALF filtering on pixels of the LCU one by one based on the filtering coefficient of the LCU, including:
[0839] Based on the filter coefficient of the LCU and the weight coefficients of each reference pixel position corresponding to the merged area to which the LCU belongs obtained by parsing the bitstream, ALF filtering is performed on the pixels of the LCU one by one, wherein the weight coefficient of the reference pixel position is the weighted weight of the pixel value of the reference pixel position when participating in the ALF filtering calculation.
[0840] In a possible implementation manner, for any pixel of the LCU, the pixel value after filtering is determined in the following manner:
[0841]
[0842] Among them, C i is the (i+1)th filter coefficient among the filter coefficients of the merged area to which the LCU belongs, P iis the filter coefficient C i The pixel value at the corresponding reference pixel position, P 28-i The corresponding reference pixel position and P i The corresponding reference pixel position is symmetrical about the pixel position of the current filtering pixel, A i P i The weight coefficient of the pixel value at the corresponding reference pixel position, P 14 is the pixel value of the current filtered pixel, C 14 is the filter coefficient of the current filter pixel, 0<A i <2.
[0843] In a possible implementation manner, the filtering unit 1940 performs ALF filtering on pixels of the LCU one by one based on the filtering coefficient of the LCU, including:
[0844] For any pixel of the LCU, in a process of performing ALF filtering on the pixel, updating the pixel value of the pixel based on the pixel values of the surrounding pixels of the pixel;
[0845] Based on the updated pixel value of the pixel, ALF filtering is performed on the pixel.
[0846] In a possible implementation manner, the filtering unit 1940 updates the pixel value of the pixel based on the pixel values of the surrounding pixels of the pixel, including:
[0847] Determine the maximum and minimum values of the pixel values of each pixel except the center position in the target pixel block; wherein the target pixel block is a 3*3 pixel block with the pixel as the center position;
[0848] When the pixel value of the pixel is greater than the maximum value, updating the pixel value of the pixel to the maximum value;
[0849] When the pixel value of the pixel is less than the minimum value, the pixel value of the pixel is updated to the minimum value.
[0850] See also Fig. 20 , Fig. 20 is a structural schematic diagram of a filtering device provided in an embodiment of the present application, wherein the filtering device can be applied to an encoding / decoding end device, and the device may include:
[0851] The filtering unit 2010 is configured to, during the process of performing ALF filtering on any pixel in the current filtering unit, for any reference pixel, when the reference pixel is not in the current filtering unit:
[0852] In the case where the pixel value of the reference pixel cannot be obtained, the current filtering unit and the pixel closest to the reference pixel in the boundary area are used to replace the reference pixel for filtering; the boundary area includes the left boundary or the right boundary of the current filtering unit, the left boundary of the current filtering unit includes part or all of the areas in the filtering unit adjacent to the left side of the current filtering unit, and the left boundary of the current filtering unit includes part or all of the areas in the filtering unit adjacent to the right side of the current filtering unit;
[0853] Otherwise, use the reference pixel for filtering.
[0854] In a possible implementation manner, the situation where the pixel value of the reference pixel cannot be obtained includes one of the following:
[0855] The reference pixel is outside the image boundary of the current image frame, outside the slice boundary of the current slice and filtering across the slice boundary is not allowed, and outside the upper boundary or the lower boundary of the current filtering unit.
[0856] In a possible implementation manner, when the pixel value of the reference pixel cannot be obtained, before the filtering unit 2010 uses the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering, the method further includes:
[0857] determining whether the reference pixel corresponds to a filter coefficient at a specified position of the filter shape;
[0858] If so, determine to perform the operation of using the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering.
[0859] In a possible implementation manner, after the filtering unit 2010 determines whether the reference pixel corresponds to a specified position of the filter shape, the filtering unit 2010 further includes:
[0860] If the reference pixel does not correspond to the filter coefficient at the specified position of the filter shape, the pixel closest to the reference pixel in the current filtering unit is used to replace the reference pixel for filtering.
[0861] In a possible implementation manner, when the pixel value of the reference pixel cannot be obtained, before the filtering unit 2010 uses the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering, the method further includes:
[0862] Determining whether the current filtering unit allows the use of enhanced adaptive correction filtering;
[0863] If yes, determine to perform the operation of using the current filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering;
[0864] or,
[0865] If the current filtering unit allows the use of enhanced adaptive correction filtering, the pixel closest to the reference pixel in the current filtering unit is used to replace the reference pixel for filtering.
[0866] In a possible implementation manner, the designated position includes a first position, a second position, a third position, and a symmetrical position among the first position, the second position, and the third position in the first filter;
[0867] Among them, the first filter is a centrally symmetrical filter of a 7*7 cross plus a 5*5 square, the first position is the upper left corner position of the first filter, the second position is the adjacent position on the right side of the first position, the third position is the adjacent position below the first position, and the symmetrical position includes an axially symmetrical position and a centrally symmetrical position.
[0868] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to a decoding end device, and the device may include: a determination unit, an acquisition unit and a filtering unit; wherein:
[0869] an acquisition unit, configured to acquire a region coefficient identifier of a merged region to which the current LCU belongs when the determination unit determines to start ALF filtering on the current LCU of the current image frame;
[0870] The acquisition unit is further configured to acquire a filter coefficient of the current LCU based on a region coefficient identifier of the merged region to which the current LCU belongs; wherein the region coefficient identifier is used to identify a filter coefficient used by the merged region to which the LCU belongs in a plurality of preset groups of filter coefficients;
[0871] The filtering unit is configured to perform ALF filtering on pixels of the current LCU one by one based on the filtering coefficient of the current LCU.
[0872] In a possible implementation manner, the determining unit determines to start ALF filtering for the current LCU of the current frame image, including:
[0873] Parsing an LCU coefficient identifier of the current LCU from a bitstream; wherein the LCU coefficient identifier is used to identify a filter coefficient used by the current LCU in at least one set of filter coefficients used in a merged region to which the current LCU belongs;
[0874] When the value of the LCU coefficient identifier of the LCU is not the first value, it is determined to start ALF filtering for the current LCU.
[0875] In a possible implementation manner, the acquiring unit acquires the filter coefficient of the current LCU based on the region coefficient identifier of the merged region to which the current LCU belongs, including:
[0876] When it is determined that the merged area to which the current LCU belongs uses multiple sets of filter coefficients based on the area coefficient identifier of the merged area to which the current LCU belongs, the filter coefficient of the current LCU is determined from the multiple sets of filter coefficients used in the merged area to which the LCU belongs based on the LCU coefficient identifier of the current LCU.
[0877] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to a decoding end device, and the device may include: a determination unit, an acquisition unit and a filtering unit; wherein:
[0878] an acquiring unit, configured to acquire a coefficient selection identifier of the current LCU when the determining unit determines to start ALF filtering on the current LCU of the current frame image;
[0879] A determination unit, configured to determine a filter coefficient of the current LCU based on the merged region to which the current LCU belongs and a coefficient selection identifier of the current LCU; wherein the coefficient selection identifier is used to identify a filter coefficient selected for use by the current LCU from among a plurality of groups of candidate filter coefficients;
[0880] The filtering unit is configured to perform ALF filtering on pixels of the current LCU one by one based on the filtering coefficient of the current LCU.
[0881] In a possible implementation manner, the determining unit determines the filter coefficient of the LCU based on the merged region to which the LCU belongs and the coefficient selection identifier of the LCU, including:
[0882] When the value of the coefficient selection identifier of the current LCU is the first value, the filter coefficient of the previous merged area of the merged area to which the current LCU belongs is determined as the filter coefficient of the current LCU; the previous merged area of the merged area to which the LCU belongs is the merged area corresponding to the previous adjacent index of the index of the merged area to which the LCU belongs;
[0883] When the value of the coefficient selection identifier of the current LCU is the second value, determining the filter coefficient of the merged area to which the current LCU belongs as the filter coefficient of the current LCU;
[0884] When the value of the coefficient selection identifier of the current LCU is the third value, the filter coefficient of the next merged area of the merged area to which the current LCU belongs is determined as the filter coefficient of the current LCU, and the next merged area of the merged area to which the LCU belongs is the merged area corresponding to the next adjacent index of the index of the merged area to which the LCU belongs.
[0885] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to a decoding end device, and the device may include: a determination unit, an acquisition unit and a filtering unit; wherein:
[0886] an acquiring unit, configured to acquire a filter shape of the merging area to which the current LCU belongs based on the merging area to which the current LCU belongs when the determining unit determines to start ALF filtering for the current LCU of the current frame image;
[0887] The acquisition unit is further configured to acquire a filter coefficient of the merged area to which the current LCU belongs based on the filter shape;
[0888] A filtering unit is configured to perform ALF filtering on pixels of the current LCU one by one based on the filter shape and the filter coefficient.
[0889] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to a decoding end device, and the device may include: a determination unit, an acquisition unit and a filtering unit; wherein:
[0890] an acquiring unit, configured to acquire, when the determining unit determines to start ALF filtering for the current LCU of the current frame image, a filter coefficient of the merged area to which the current LCU belongs and a weight coefficient of each reference pixel position based on the area to which the current LCU belongs;
[0891] The filtering unit is used to perform ALF filtering on the pixels of the current LCU one by one based on the filtering coefficient and the weight coefficient of each reference pixel position.
[0892] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to an encoding end device, and the device may include: a division unit, a classification unit, a merging unit, and an encoding unit; wherein:
[0893] A division unit, used for dividing the brightness component of the current image frame into regions;
[0894] A classification unit, for classifying each LCU in any region, and dividing the region into a plurality of region categories based on the categories of each LCU;
[0895] A merging unit, used to merge regions of each region category and determine a filter coefficient for each merged region;
[0896] The coding unit is used to write the filter coefficients of each merged area and the area category identifier of each LCU into the bit stream.
[0897] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to an encoding end device, and the device may include: a determining unit and an encoding unit; wherein:
[0898] A determination unit, configured to determine, for any merged region of the current image frame, a filter coefficient used in the merged region based on the RDO decision;
[0899] The determining unit is further configured to determine a region coefficient identifier of the merged region based on the filter coefficient used by the merged region; wherein the region coefficient identifier is used to identify the filter coefficient used by the merged region in the preset plurality of groups of filter coefficients;
[0900] The encoding unit is used to write the filter coefficients used by each merged area and the area coefficient identifiers of each merged area into the bit stream.
[0901] In a possible implementation manner, the determining unit is further configured to, for any merged area of the current image frame, determine, when the filter coefficients used in the merged area include multiple sets, an LCU coefficient identifier of each LCU based on the filter coefficients used by each LCU in the merged area;
[0902] The encoding unit is further configured to write the LCU coefficient identifier of each LCU into the bitstream.
[0903] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to an encoding end device, and the device may include: a determining unit and an encoding unit; wherein:
[0904] A determination unit, configured to determine, for any merged region of the current image frame, a filter coefficient used by the merged region from a plurality of sets of filter coefficients based on an RDO decision;
[0905] The determining unit is further configured to determine a coefficient selection identifier of each LCU in the merged region based on the filter coefficient used in the merged region; wherein the coefficient selection identifier is used to identify the filter coefficient selected by each LCU from among multiple groups of candidate filter coefficients;
[0906] The coding unit is used to write the filter coefficients used by each merged area and the coefficient selection identifier of each LCU into the bit stream.
[0907] In a possible implementation manner, for any merged region, the multiple groups of filter coefficients include:
[0908] The filter coefficient of the merged area, the filter coefficient of the previous merged area of the merged area, and the filter coefficient of the next merged area of the merged area obtained by training.
[0909] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to an encoding end device, and the device may include: a determining unit and an encoding unit; wherein:
[0910] A determination unit, configured to determine, for any merged region of the current image frame, a filter shape and a filter coefficient used in the merged region based on an RDO decision;
[0911] The encoding unit is used to write the filter shape and filter coefficients used by each merged area into the bit stream.
[0912] An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to an encoding end device, and the device may include:
[0913] A determination unit, configured to determine, for any merged region of the current image frame, a filter coefficient used in the merged region and corresponding weight coefficients of each reference pixel position based on the RDO decision;
[0914] The encoding unit is used to write the filter coefficients used in each merged area and the corresponding weight coefficients of each reference pixel position into the bit stream.
[0915] See also Fig.21 , is a schematic diagram of the hardware structure of a decoding end device provided in an embodiment of the present application. The decoding end device may include a processor 2101 and a machine-readable storage medium 2102 storing machine-executable instructions. The processor 2101 and the machine-readable storage medium 2102 may communicate via a system bus 2103. In addition, by reading and executing the machine-executable instructions corresponding to the filtering control logic in the machine-readable storage medium 2102, the processor 2101 may execute the filtering method of the decoding end device described above.
[0916] The machine-readable storage medium 2102 mentioned herein may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0917] In some embodiments, a machine-readable storage medium is also provided, in which machine-executable instructions are stored, and when the machine-executable instructions are executed by a processor, the filtering method of the decoding end device described above is implemented. For example, the machine-readable storage medium can be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0918] See also Fig. 22 , is a schematic diagram of the hardware structure of an encoding end device provided in an embodiment of the present application. The encoding end device may include a processor 2201 and a machine-readable storage medium 2202 storing machine-executable instructions. The processor 2201 and the machine-readable storage medium 2202 may communicate via a system bus 2203. In addition, by reading and executing the machine-executable instructions corresponding to the filtering control logic in the machine-readable storage medium 2202, the processor 2201 may execute the filtering method of the encoding end device described above.
[0919] The machine-readable storage medium 2202 mentioned herein may be any electronic, magnetic, optical or other physical storage device that may contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0920] In some embodiments, a machine-readable storage medium is further provided, wherein the machine-readable storage medium stores machine-executable instructions, and when the machine-executable instructions are executed by a processor, the filtering method of the encoding end device described above is implemented. For example, the machine-readable storage medium may be a ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, etc.
[0921] In some embodiments, a camera device is also provided, comprising the filtering device in any of the above embodiments.
[0922] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0923] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A filtering method, applied to a decoding end device, characterized in that: The method comprises: Divide the brightness component of the current image frame into regions; Determine the region category to which the adaptive correction filter unit belongs based on the region category identifier of the adaptive correction filter unit obtained by parsing the bitstream; Determine the filter coefficient of the adaptive correction filter unit based on the region category to which the adaptive correction filter unit belongs and the filter coefficient obtained by parsing the bit stream; Performing ALF filtering on pixels of the adaptive correction filter unit one by one based on the filter coefficient of the adaptive correction filter unit; The step of determining the region category to which the adaptive correction filter unit belongs based on the region category identifier of the adaptive correction filter unit obtained by parsing the bitstream includes: Determining the category of the region to which the adaptive correction filtering unit belongs based on the region to which the adaptive correction filtering unit belongs and the region category identifier of the adaptive correction filtering unit; The region category identifier of the adaptive correction filter unit is used to identify the category of the adaptive correction filter unit in the region to which the adaptive correction filter unit belongs, and the category of the adaptive correction filter unit in the region to which the adaptive correction filter unit belongs is determined by classifying each adaptive correction filter unit in the region to which the adaptive correction filter unit belongs; The determining the category of the region to which the adaptive correction filter unit belongs based on the region to which the adaptive correction filter unit belongs and the region category identifier of the adaptive correction filter unit includes: Determine the category of the region to which the adaptive correction filtering unit belongs based on the number of categories of each region, the region to which the adaptive correction filtering unit belongs, and the region category identifier of the adaptive correction filtering unit; The step of determining the category of the region to which the adaptive correction filtering unit belongs based on the number of categories of each region, the region to which the adaptive correction filtering unit belongs, and the region category identifier of the adaptive correction filtering unit includes: Determining the total number of categories of regions before the region to which the adaptive correction filter unit belongs based on the number of categories of regions before the region to which the adaptive correction filter unit belongs; Determine the category of the region to which the adaptive correction filtering unit belongs based on the total number of categories of regions before the region to which the adaptive correction filtering unit belongs and the region category identifier of the adaptive correction filtering unit; The performing ALF filtering on the pixels of the adaptive correction filter unit one by one based on the filter coefficient of the adaptive correction filter unit comprises: In the process of performing ALF filtering on any pixel in the current adaptive correction filtering unit, for any reference pixel, when the reference pixel is not in the current adaptive correction filtering unit: In the case where the pixel value of the reference pixel cannot be obtained, the current adaptive correction filtering unit and the pixel closest to the reference pixel in the boundary area are used to replace the reference pixel for filtering; the boundary area includes the left boundary or the right boundary of the current adaptive correction filtering unit, the left boundary of the current adaptive correction filtering unit includes part or all of the area of the adaptive correction filtering unit adjacent to the left side of the current adaptive correction filtering unit, and the right boundary of the current adaptive correction filtering unit includes part or all of the area of the adaptive correction filtering unit adjacent to the right side of the current adaptive correction filtering unit; Otherwise, use the reference pixel for filtering.
2. A filtering device, applied to a decoding end device, characterized in that: The device comprises: A division unit, used for dividing the brightness component of the current image frame into regions; A first determining unit, configured to determine the region category to which the adaptive correction filter unit belongs based on the region category identifier of the adaptive correction filter unit obtained by parsing the bitstream; A second determination unit, configured to determine a filter coefficient of the adaptive correction filter unit based on the region category to which the adaptive correction filter unit belongs and the filter coefficient obtained by parsing the bit stream; A filtering unit, configured to perform ALF filtering on pixels of the adaptive correction filtering unit one by one based on the filtering coefficient of the adaptive correction filtering unit; The first determining unit determines the region category to which the adaptive correction filter unit belongs based on the region category identifier of the adaptive correction filter unit obtained by parsing the bitstream, including: Determining the category of the region to which the adaptive correction filtering unit belongs based on the region to which the adaptive correction filtering unit belongs and the region category identifier of the adaptive correction filtering unit; The region category identifier of the adaptive correction filter unit is used to identify the category of the adaptive correction filter unit in the region to which the adaptive correction filter unit belongs, and the category of the adaptive correction filter unit in the region to which the adaptive correction filter unit belongs is determined by classifying each adaptive correction filter unit in the region to which the adaptive correction filter unit belongs; The first determining unit determines the category of the region to which the adaptive correction filter unit belongs based on the region to which the adaptive correction filter unit belongs and the region category identifier of the adaptive correction filter unit, including: Determine the category of the region to which the adaptive correction filtering unit belongs based on the number of categories of each region, the region to which the adaptive correction filtering unit belongs, and the region category identifier of the adaptive correction filtering unit; The first determining unit determines the category of the region to which the adaptive correction filter unit belongs based on the number of categories of each region, the region to which the adaptive correction filter unit belongs, and the region category identifier of the adaptive correction filter unit, including: Determining the total number of categories of regions before the region to which the adaptive correction filter unit belongs based on the number of categories of regions before the region to which the adaptive correction filter unit belongs; Determine the category of the region to which the adaptive correction filtering unit belongs based on the total number of categories of regions before the region to which the adaptive correction filtering unit belongs and the region category identifier of the adaptive correction filtering unit; The filtering unit performs ALF filtering on pixels of the adaptive correction filtering unit one by one based on the filtering coefficient of the adaptive correction filtering unit, including: In the process of performing ALF filtering on any pixel in the current adaptive correction filtering unit, for any reference pixel, when the reference pixel is not in the current adaptive correction filtering unit: In the case where the pixel value of the reference pixel cannot be obtained, the current adaptive correction filtering unit and the pixel closest to the reference pixel in the boundary area are used to replace the reference pixel for filtering; the boundary area includes the left boundary or the right boundary of the current adaptive correction filtering unit, the left boundary of the current adaptive correction filtering unit includes part or all of the area of the adaptive correction filtering unit adjacent to the left side of the current adaptive correction filtering unit, and the right boundary of the current adaptive correction filtering unit includes part or all of the area of the adaptive correction filtering unit adjacent to the right side of the current adaptive correction filtering unit; Otherwise, use the reference pixel for filtering.
3. A decoding end device, characterized in that: The invention comprises a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, and the processor is used to execute the machine-executable instructions to implement the method according to claim 1.
