Method and device for weakening ringing effect
By comparing RDCost in the video encoder and determining the ringing effect with the quantization module and pixel changes, and forcibly selecting the division mode, the problem of ringing effect in the video encoder is solved, and image quality and subjective effect are improved.
Patent Information
- Application Number
- CN202410150863.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-02
- Publication Date
- 2025-08-05
AI Technical Summary
In the prior art, under high quantization levels, the video encoder is prone to ringing effects in areas with severe grayscale changes in the image, affecting the image quality, especially in the subjective effect in the flat area.
By comparing the current block division with the undivided RDCost, the quantization module of the video encoder and the pixel changes in the image block are used to further determine whether the ringing effect occurs, and the partition mode is forced to be selected when the ringing effect is detected to avoid affecting the overall compression rate.
Effectively weakens the ringing effect, improves the subjective quality of the image, is simple to operate and is easy to implement with hardware, does not affect the compression rate, and adapts to image characteristics of different quantization levels.
Smart Images

Figure CN120434407A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of video processing, and in particular relates to a method and device for reducing ringing effect. Background Art
[0002] During image quantization, information is lost due to image processing. This can cause oscillations in flat areas within the image, resulting in sharp fluctuations in the image, similar to the vibrations in the air caused by the striking of a bell. This is known as a ringing effect. This ringing effect often occurs where the image grayscale changes dramatically. This ringing effect severely impacts image quality and viewing experience.
[0003] Applying a ringing effect reduction scheme to the segmentation decision of a video encoder can effectively reduce the ringing effect in the encoder, thereby improving image quality.
[0004] Taking H.265 / HEVC (an efficient video coding protocol, a general scheme for compressing spatial and temporal redundant information in videos) as an example, the independent coding unit CTU in H.265 / HEVC can be of size 64x64, 32x32, or 16x16. The CTU contains multiple sub-coding units CU, which can be of size 64x64, 32x32, 16x16, or 8x8. To adapt to the texture characteristics of the image, H.265 / HEVC can divide the CTU or CU into 4 sub-CUs (i.e., CU quadtree partitioning decision), but it can also be not divided, which is more flexible. Whether to perform quadtree partitioning is usually determined by the video encoder.
[0005] In the partitioning decision of the video encoder, the RDCost scheme is often used for partitioning, that is, the mode or partition with the smallest RDCost is selected as the decision to calculate the cost value in H.265 / HEVC. The formula is RDCost = Distortion + λ*BitRate, where Distortion is usually expressed as the difference between the original pixel value and the pixel value after encoding and decoding, BitRate is usually the number of bits required to encode the current block, and λ is the Lagrange coefficient, which is used to weigh the weight of distortion and bits.
[0006] During the encoding process of the video encoder, if there is a place with a sharp grayscale change in the CU block, quantization may cause the loss of high-frequency information. After the image is restored, ripple-like oscillations will be generated around the area with a sharp grayscale change, such as Figure 1The arrow in the figure shows the part. Ringing is inevitable due to the quantization module in the video encoder. However, blocks prone to ringing can be detected and divided into sub-blocks. This will limit the ringing to sub-blocks. Even if ringing occurs within a sub-block, the smaller the sub-block, the smaller the impact, thus improving subjective quality.
[0007] However, in the prior art, when the quantization level QP of RDCost is larger, the image retains less detail but has a higher compression rate. As λ increases, RDCost tends to choose a non-divided solution with fewer bits. Therefore, when areas with drastic grayscale changes are not divided, ringing effects are likely to occur, affecting subjective quality. Due to the masking effect of the human eye, the human eye is more sensitive to flat areas. When the ringing effect within a block affects flat blocks within the block (a flat block is defined as a block where all pixels within the CU block remain unchanged or have a small change amplitude), oscillating ripples appear in the flat area, which has a greater subjective impact on the video.
[0008] In view of this, the current market urgently needs a solution that can effectively reduce the ringing effect to meet market requirements. Summary of the Invention
[0009] In order to solve the above problems, the purpose of this application is to provide a method and device for reducing the ringing effect.
[0010] Specifically, the technical solution of the present invention provides a coding method for reducing the ringing effect, the method comprising:
[0011] S1. Compare the RDCost of the current block partitioning and non-partitioning modes, pre-judge the partitioning mode, and select the partitioning scheme with the smaller RDCost;
[0012] S2. Use the quantization module of the video encoder to determine whether the current block does not have a ringing effect. If so, the ringing effect detection ends. If not, the pixel changes within the image block itself are used to further determine whether the current block has a ringing effect.
[0013] S3. Further determine the ringing effect of the current block. If the original pixels of the sub-blocks of the current block are flat, but the reconstructed pixels of the sub-blocks of the current block are not flat, it is determined that the block has a ringing effect, and the partitioning mode is forced to be selected, and the ringing effect detection is terminated and exited. If all sub-blocks are traversed and the ringing effect detection is not exited, the partitioning scheme remains unchanged.
[0014] The method of determining whether a ringing effect exists using the quantization module of the video encoder in step S2 further includes: checking the residual coefficients in the quantization coefficients of the luminance component. If the residual coefficients are all 0, the reconstructed pixel is the predicted pixel and there is no ringing effect.
[0015] The method of further determining whether the current block has a ringing effect by using pixel changes in the image block itself in step S2 further includes:
[0016] The intra-block complexity of the current block is calculated using the mean absolute error, and whether the current block may have a ringing effect is determined. The method for calculating the intra-block complexity of the current block further includes:
[0017] Calculate the mean value based on the original pixels of the current block;
[0018] Calculate the mean absolute error based on the original pixel data of the current block and the mean of the current block;
[0019] If the mean absolute error of the current block is less than or equal to the threshold, the ringing effect detection is terminated; otherwise, the process proceeds to step S3.
[0020] The specific method for calculating the intra-block complexity of the current block is:
[0021] Calculate the mean x based on the raw pixels of the current Cu32 or Cu16 block; the calculation formula is:
[0022]
[0023] Again, based on the raw data of the current Cu32 or Cu16 block and the mean x of the current Cu32 or Cu16 block, calculate the mean absolute error MAD. The calculation formula is:
[0024]
[0025] The specific method for determining whether the ringing effect occurs is: if the block mean absolute error MAD is less than or equal to the threshold mad_thrd, the empirical value of which is 30, then exit the ringing effect detection program; otherwise, continue the ringing effect determination.
[0026] The step S3 includes:
[0027] S31 determines the quantization level of the current block, and determines the threshold for determining the flatness of the reconstructed pixel based on the quantization level of the current block;
[0028] S32. Traverse the sub-blocks with the same luminance components of the original pixels and the undivided reconstructed pixels, calculate the variance of the original pixels of the sub-block, and use the variance of the original pixels of the sub-block to determine whether the original pixels of the sub-block are flat; calculate the variance of the reconstructed pixels of the sub-block, and use the variance of the reconstructed pixels of the sub-block and the threshold for determining the flatness of the reconstructed pixels to determine whether the reconstructed pixels of the current sub-block are flat;
[0029] S33. Determine the division mode of the current block. If the original pixels of the current sub-block are flat, but the reconstructed pixels of the sub-block are not flat, it is determined that the block has a ringing effect. At this time, the division mode is forced to be selected and the ringing effect detection program is exited. If the traversal is not complete, return to step S32 to continue the traversal. If the traversal is complete and the ringing effect detection program has not been exited, the original division scheme is maintained.
[0030] The step S32 includes:
[0031] S321. Calculate the original pixel mean of the current sub-block according to the original pixel data of the current sub-block;
[0032] S322. Calculate the original pixel variance based on the original pixel data of the current sub-block and the original pixel mean of the current sub-block;
[0033] S323. Find the sub-block at the same position in the reconstructed pixels, and calculate the mean reconstructed pixel value of the current sub-block based on the reconstructed pixel data of the sub-block at the same position;
[0034] S324. Calculate the reconstructed pixel variance based on the sub-block reconstructed pixel data and the reconstructed pixel mean of the current sub-block;
[0035] S325. If the original pixel variance of the current sub-block is less than the threshold for determining the original pixel flatness, the original pixel of the current sub-block is determined to be flat; if the reconstructed pixel variance of the current sub-block is less than or equal to the threshold for determining the reconstructed pixel flatness, the current sub-block is determined to be flat.
[0036] The step S3 further comprises:
[0037] The step S3 compares the original pixels raw of the 4x4 sub-block with the corresponding reconstructed pixels recon, further comprising:
[0038] S31. Determine the quantization level QP of the current Cu32 or Cu16 block, and determine the threshold recon_thrd for determining the flatness of the reconstructed pixel recon according to the quantization level QP of the current block. The specific formula is:
[0039]
[0040] S32. Traverse the 4x4 sub-blocks with the same luminance components of the original pixels raw and the undivided reconstructed pixels recon, and determine whether the original pixels raw of the 4x4 sub-block are flat by calculating the variance of the original pixels raw of the 4x4 sub-block; and determine whether the reconstructed pixels recon of the 4x4 sub-block are flat by calculating the variance of the reconstructed pixels recon of the 4x4 sub-block; wherein the traversal method is to traverse the current 4x4 sub-block from top to bottom and from left to right; the variance describes the fluctuation of the data in the data sample with respect to the mean, and a higher value indicates a greater fluctuation;
[0041] In S32, the method of calculating whether the original pixel raw and the reconstructed pixel recon are flat further includes:
[0042] S321. Calculate the mean raw_x of the current 4x4 sub-block based on the raw data of the current 4x4 sub-block. The calculation formula is:
[0043]
[0044] S322. Calculate the variance raw_var again based on the raw data of the current 4x4 sub-block and the raw mean raw_x of the current 4x4 sub-block. The calculation formula is:
[0045]
[0046] S323. Find the 4x4 sub-block at the same position in the reconstructed pixels recon, and calculate the reconstructed pixel mean recon_x of the current 4x4 sub-block based on the reconstructed pixel data of the current 4x4 sub-block at the same position; the calculation formula is:
[0047]
[0048] S324. Calculate the reconstructed pixel variance recon_var again based on the 4x4 sub-block reconstructed pixel data recon and the reconstructed pixel mean recon_x of the current 4x4 sub-block. The calculation formula is:
[0049]
[0050] S325. If the original pixel variance of the current 4x4 sub-block, raw_var, is less than the threshold raw_thrd for determining original pixel flatness, where the empirical value is 10, the current 4x4 sub-block, raw, is determined to be flat. If the reconstructed pixel variance of the current 4x4 sub-block, recon_var, is less than or equal to the threshold recon_thrd for determining reconstructed pixel flatness, the current 4x4 sub-block, recon, is determined to be flat.
[0051] S33. Determine the partitioning mode of the current block. If the original pixels raw of the current 4x4 sub-block are flat, but the reconstructed pixels recon of the 4x4 sub-block are not flat, it is determined that a ringing effect has occurred in the block. In this case, the partitioning mode is forcibly selected and the ringing effect detection program is exited. If the traversal is not complete, return to step S32 to continue the traversal. If the traversal is complete and the ringing effect detection program has not been exited, the original partitioning scheme is maintained.
[0052] Specifically, the technical solution of the present invention provides a device for reducing the ringing effect, the device comprising:
[0053] at least one processor; and
[0054] at least one memory in communication with the processor, wherein:
[0055] The memory stores program instructions that can be executed by the processor, and the processor can execute any of the above methods by calling the program instructions.
[0056] Therefore, the advantages of the ringing effect reduction method and device of the present application are:
[0057] 1. The ringing effect determination scheme is simple to operate and easy to implement in hardware;
[0058] 2. The overall partitioning scheme is based on RDCost. Only blocks with ringing effects are forced to change their partitioning, which does not affect the overall compression rate.
[0059] 3. The present invention has high accuracy in determining the ringing effect. The determination method is consistent with the characteristics of the ringing effect, does not introduce other problems, and can effectively improve subjective quality.
[0060] 4. Adjust the flatness threshold of the reconstructed pixel recon according to the block-level quantization level QP, and perform different processing for each level of quantization level QP. For example, if the possibility of ringing effect is small at a low quantization level QP, a higher quantization level recon flatness threshold can be set to achieve the effect of turning it off. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention.
[0062] Figure 1 This is a schematic diagram of the ringing effect in the prior art.
[0063] Figure 2 It is a flowchart of this application.
[0064] Figure 3 This is a schematic diagram of 16x16 ringing effect detection.
[0065] Figure 4 This is a schematic diagram of the encoding process for reducing the ringing effect in this application. DETAILED DESCRIPTION
[0066] In order to more clearly understand the technical content and advantages of the present invention, the present invention is now further described in detail with reference to the accompanying drawings.
[0067] The following uses a specific embodiment in which the size of the independent coding unit CTU is 32x32 to illustrate an encoding method for reducing the ringing effect of the present invention, but the protection scope of the present invention is not limited to the method proposed in the specific embodiment.
[0068] When the size of the independent coding unit CTU is 32x32, the minimum size of the sub-coding unit CU is 8x8, so it is necessary to determine whether to divide at the CU32 and CU16 layers to obtain the division result. The overall division scheme is based on RDCost. If the reconstructed pixel recon block that is not divided has a ringing effect, the division mode is forced to be selected. The video coding method of the present invention is supplemented on the basis of RDCost, and the RDCost judgment is used as a whole, and special processing is performed on blocks that have ringing effects.
[0069] Please refer to Figure 2 As shown, a coding method for reducing the ringing effect of the present invention includes the following steps:
[0070] S1. Compare the RDCost of the current block partitioning and non-partitioning modes, pre-judge the partitioning mode, and select the partitioning scheme with the smaller RDCost;
[0071] S2. Use the quantization module built into the video encoder to first detect whether there is no ringing effect. If so, the ringing effect detection ends. If not, use the dramatic pixel changes within the image block to further determine whether the current block has ringing effects.
[0072] Specifically, since the ringing effect mainly comes from the quantization of the brightness component, it is only necessary to check the brightness component quantization coefficient coeff. In step S2, the method of using the quantization module of the video encoder to find the block with the ringing effect includes: checking the residual coefficient coeff in the brightness component quantization coefficient. If the residual coefficient coeff is all 0, it means that the residual pixel resi of the current block is completely quantized, and the reconstructed pixel recon is the predicted pixel pred. Without the participation of the residual, the ringing effect will not occur at this time, and the ringing effect detection program will be exited. The above-mentioned residual pixel resi refers to the input data of the encoder transformation and quantization module, which is the original pixel raw-prediction pixel pred; the above-mentioned residual coefficient coeff refers to the output result of the residual pixel resi after transformation and quantization; the above-mentioned reconstructed pixel recon refers to the pixel obtained by adding the residual coefficient coeff to the predicted pixel pred after the inverse quantization and inverse transformation of the video encoder.
[0073] In step S2, the method of finding the block with ringing effect by using the drastic change of pixels in the image block itself includes: using the mean absolute error MAD to calculate the intra-block complexity of the current Cu32 or Cu16 block, and determining whether the current block may have a ringing effect. The more complex the original pixels in the block, the less accurate the predicted pixels pred, resulting in a larger residual pixel resi entering the transform quantization part, and a more likely ringing effect. The above-mentioned mean absolute error MAD refers to the average of the absolute values of the deviations of all individual observations from the arithmetic mean. For an image block, the larger the mean absolute error MAD, the more complex the image block. The specific method for calculating the intra-block complexity of the current block is:
[0074] Calculate the mean x based on the raw pixels of the current Cu32 or Cu16 block. The calculation formula is:
[0075]
[0076] Again, based on the raw data of the current Cu32 or Cu16 block and the mean x of the current Cu32 or Cu16 block, calculate the mean absolute error MAD. The calculation formula is:
[0077]
[0078] The specific method for determining whether the ringing effect occurs is: if the block mean absolute error MAD is less than or equal to the threshold mad_thrd (30, an empirical value), then exit the ringing effect detection program; otherwise, continue the ringing effect determination.
[0079] S3. Further determine the ringing effect of the current block: If the original pixels (raw) of the current block's sub-block are flat, but the reconstructed pixels (recon) of the current block's sub-block are not flat, this indicates that the loss of high-frequency coefficients in the complex area during the quantization process has affected the surrounding flat blocks. To ensure accuracy, the original pixels (raw) of the 4x4 sub-block are compared with the corresponding reconstructed pixels (recon). Considering that a higher quantization level (QP) results in more detail loss, the reconstructed pixels (recon) of inherently flat areas are more likely to be flat. Different thresholds are set based on the quantization level (QP) to ensure that the threshold for determining flatness is set as small as possible.
[0080] The above step S3 includes the following steps:
[0081] S31. Determine the quantization level QP of the current Cu32 or Cu16 block, and determine the threshold recon_thrd (an empirical value) for determining whether the reconstructed pixel recon is flat based on the quantization level QP of the current block. The specific formula is:
[0082]
[0083] S32. Traverse the 4x4 sub-blocks containing the same luminance components of the original pixels raw and the undivided reconstructed pixels recon, and determine whether the original pixels raw of the 4x4 sub-block are flat by calculating the variance of the original pixels raw of the 4x4 sub-block; and determine whether the reconstructed pixels recon of the 4x4 sub-block are flat by calculating the variance of the reconstructed pixels recon of the 4x4 sub-block. The traversal is performed from top to bottom and from left to right on the current 4x4 sub-block; the variance describes the fluctuation of the mean of the data in the data sample; a higher value indicates greater fluctuation.
[0084] In the above S32, the method for calculating whether the original pixel raw and the reconstructed pixel recon are flat includes:
[0085] S321. Calculate the mean raw_x of the current 4x4 sub-block based on the raw data of the current 4x4 sub-block. The calculation formula is:
[0086]
[0087] S322. Calculate the variance raw_var again based on the raw data of the current 4x4 sub-block and the raw mean raw_x of the current 4x4 sub-block. The calculation formula is:
[0088]
[0089] S323. Find the 4x4 sub-block at the same position in the reconstructed pixels recon, and calculate the reconstructed pixel mean recon_x of the current 4x4 sub-block based on the reconstructed pixel data of the current 4x4 sub-block at the same position. The calculation formula is:
[0090]
[0091] S324. Calculate the reconstructed pixel variance recon_var again based on the 4x4 sub-block reconstructed pixel data recon and the reconstructed pixel mean recon_x of the current 4x4 sub-block. The calculation formula is:
[0092]
[0093] S325. If the original pixel variance raw_var of the current 4x4 sub-block is less than the threshold raw_thrd (10, an empirical value) for determining the flatness of the original pixels, then the current 4x4 sub-block raw is determined to be flat; if the reconstructed pixel variance recon_var of the current 4x4 sub-block is less than or equal to the threshold recon_thrd for determining the flatness of the reconstructed pixels, then the current 4x4 sub-block recon is determined to be flat.
[0094] S33. Determine the partitioning mode of the current block. If the original pixels raw of the current 4x4 sub-block are flat, but the reconstructed pixels recon of the 4x4 sub-block are not flat, it is determined that a ringing effect has occurred in the block. In this case, the partitioning mode is forcibly selected and the ringing effect detection program is exited. If the traversal is not complete, return to step S32 to continue the traversal. If the traversal is complete and the ringing effect detection program has not been exited, the original partitioning scheme is maintained.
[0095] In summary, if Figure 3 As shown in the figure, 16x16 ringing effect detection, the small blocks represent 4x4, the detection order is from left to right, from top to bottom, the gray blocks are checked sub-blocks, and the dotted blocks are the sub-blocks being checked.
[0096] like Figure 4 As shown in the figure, it is the coding process to reduce the ringing effect:
[0097] Input a 32x32 or 16x16 block; compare RDcost to get the partitioning result; traverse coeff; determine if coeff is not all 0; if not, no ringing effect occurs and the partitioning is based on the original scheme; if so, calculate the intra-block mean; calculate MAD; determine if mad>mad_thrd? If not, no ringing effect occurs and the partitioning is based on the original scheme; if so, determine recon_thrd; determine if the 4x4 sub-block within the loop block is used? If not, no ringing effect occurs and the partitioning is based on the original scheme; if so, calculate the raw mean raw_w and variance raw_var, calculate the recon mean recon_x and variance recon_var; determine if raw_var<raw_thrd&&recon_var> Is recon_thrd true? If not, return to determine whether to loop the 4x4 sub-block within the block; if so, ringing effect occurs, select the partitioning mode.
[0098] The present invention also includes a device for reducing ringing effects, comprising: at least one processor; and at least one memory in communication with the processor. The memory stores program instructions executable by the processor, and the processor invokes the program instructions to execute the aforementioned method for reducing ringing effects.
[0099] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. A coding method for reducing ringing effect, characterized in that: It includes the following steps: S1. Compare the RDCost of the current block partitioning and non-partitioning modes, pre-judge the partitioning mode, and select the partitioning scheme with the smaller RDCost; S2. Use the quantization module of the video encoder to determine whether the current block does not have a ringing effect. If so, the ringing effect detection ends. If not, the pixel changes within the image block itself are used to further determine whether the current block has a ringing effect. S3. Further determine the ringing effect of the current block. If the original pixels of the sub-blocks of the current block are flat, but the reconstructed pixels of the sub-blocks of the current block are not flat, it is determined that the block has a ringing effect, and the partitioning mode is forced to be selected, and the ringing effect detection is terminated and exited. If all sub-blocks are traversed and the ringing effect detection is not exited, the partitioning scheme remains unchanged.
2. The coding method for reducing the ringing effect according to claim 1, characterized in that: The method of determining whether a ringing effect exists using the quantization module of the video encoder in step S2 further includes: checking the residual coefficients in the quantization coefficients of the luminance component. If the residual coefficients are all 0, the reconstructed pixel is the predicted pixel and there is no ringing effect.
3. The coding method for reducing the ringing effect according to claim 1, wherein: The method of further determining whether the current block has a ringing effect by using pixel changes in the image block itself in step S2 further includes: The intra-block complexity of the current block is calculated using the mean absolute error, and whether the current block may have a ringing effect is determined; the method for calculating the intra-block complexity of the current block further includes: calculating a mean value based on original pixels of the current block; Calculate the mean absolute error based on the original pixel data of the current block and the mean of the current block; If the mean absolute error of the current block is less than or equal to the threshold, the ringing effect detection is terminated; otherwise, the process proceeds to step S3.
4. The coding method for reducing the ringing effect according to claim 3, wherein: The specific method for calculating the intra-block complexity of the current block is: Calculate the mean x based on the raw pixels of the current Cu32 or Cu16 block; the calculation formula is: Again, based on the raw data of the current Cu32 or Cu16 block and the mean x of the current Cu32 or Cu16 block, calculate the mean absolute error MAD. The calculation formula is: The specific method for determining whether the ringing effect occurs is: if the block mean absolute error MAD is less than or equal to the threshold mad_thrd, the empirical value of which is 30, then exit the ringing effect detection program; otherwise, continue the ringing effect determination.
5. The coding method for reducing the ringing effect according to claim 1, wherein: The step S3 includes: S31 determines the quantization level of the current block, and determines the threshold for determining the flatness of the reconstructed pixel based on the quantization level of the current block; S32. Traverse the sub-blocks with the same luminance components of the original pixels and the undivided reconstructed pixels, calculate the variance of the original pixels of the sub-block, and use the variance of the original pixels of the sub-block to determine whether the original pixels of the sub-block are flat; calculate the variance of the reconstructed pixels of the sub-block, and use the variance of the reconstructed pixels of the sub-block and the threshold for determining the flatness of the reconstructed pixels to determine whether the reconstructed pixels of the current sub-block are flat; S33. Determine the division mode of the current block. If the original pixels of the current sub-block are flat, but the reconstructed pixels of the sub-block are not flat, it is determined that the block has a ringing effect. At this time, the division mode is forced to be selected and the ringing effect detection program is exited. If the traversal is not complete, return to step S32 to continue the traversal. If the traversal is complete and the ringing effect detection program has not been exited, the original division scheme is maintained.
6. The coding method for reducing the ringing effect according to claim 5, characterized in that: The step S32 includes: S321. Calculate the original pixel mean of the current sub-block according to the original pixel data of the current sub-block; S322. Calculate the original pixel variance based on the original pixel data of the current sub-block and the original pixel mean of the current sub-block; S323. Find the sub-block at the same position in the reconstructed pixels, and calculate the mean reconstructed pixel value of the current sub-block based on the reconstructed pixel data of the sub-block at the same position; S324. Calculate the reconstructed pixel variance based on the sub-block reconstructed pixel data and the reconstructed pixel mean of the current sub-block; S325. If the original pixel variance of the current sub-block is less than the threshold for determining the original pixel flatness, the original pixel of the current sub-block is determined to be flat; if the reconstructed pixel variance of the current sub-block is less than or equal to the threshold for determining the reconstructed pixel flatness, the current sub-block is determined to be flat.
7. The coding method for reducing the ringing effect according to claim 6, characterized in that: The step S3 further comprises: The step S3 compares the original pixels raw of the 4x4 sub-block with the corresponding reconstructed pixels recon, further comprising: S31. Determine the quantization level QP of the current Cu32 or Cu16 block, and determine the threshold recon_thrd for determining the flatness of the reconstructed pixel recon according to the quantization level QP of the current block. The specific formula is: S32. Traverse the 4x4 sub-blocks with the same luminance components of the original pixels raw and the undivided reconstructed pixels recon, and determine whether the original pixels raw of the 4x4 sub-block are flat by calculating the variance of the original pixels raw of the 4x4 sub-block; and determine whether the reconstructed pixels recon of the 4x4 sub-block are flat by calculating the variance of the reconstructed pixels recon of the 4x4 sub-block; wherein the traversal method is to traverse the current 4x4 sub-block from top to bottom and from left to right; the variance describes the fluctuation of the data in the data sample with respect to the mean, and a higher value indicates a greater fluctuation; In S32, the method of calculating whether the original pixel raw and the reconstructed pixel recon are flat further includes: S321. Calculate the mean raw_x of the current 4x4 sub-block based on the raw data of the current 4x4 sub-block. The calculation formula is: S322. Calculate the variance raw_var again based on the raw data of the current 4x4 sub-block and the raw mean raw_x of the current 4x4 sub-block. The calculation formula is: S323. Find the 4x4 sub-block at the same position in the reconstructed pixels recon, and calculate the reconstructed pixel mean recon_x of the current 4x4 sub-block based on the reconstructed pixel data of the current 4x4 sub-block at the same position; the calculation formula is: S324. Calculate the reconstructed pixel variance recon_var again based on the 4x4 sub-block reconstructed pixel data recon and the reconstructed pixel mean recon_x of the current 4x4 sub-block. The calculation formula is: S325. If the original pixel variance of the current 4x4 sub-block, raw_var, is less than the threshold raw_thrd for determining original pixel flatness, where the empirical value is 10, the current 4x4 sub-block, raw, is determined to be flat. If the reconstructed pixel variance of the current 4x4 sub-block, recon_var, is less than or equal to the threshold recon_thrd for determining reconstructed pixel flatness, the current 4x4 sub-block, recon, is determined to be flat. S33. Determine the partitioning mode of the current block. If the original pixels raw of the current 4x4 sub-block are flat, but the reconstructed pixels recon of the 4x4 sub-block are not flat, it is determined that a ringing effect has occurred in the block. In this case, the partitioning mode is forcibly selected and the ringing effect detection program is exited. If the traversal is not complete, return to step S32 to continue the traversal. If the traversal is complete and the ringing effect detection program has not been exited, the original partitioning scheme is maintained.
8. A device for reducing ringing effect, characterized in that It includes: at least one processor; as well as at least one memory in communication with the processor, wherein: The memory stores program instructions that can be executed by the processor, and the processor can execute the method according to any one of claims 1 to 7 by calling the program instructions.