Methods, machines, and equipment for encoding and decoding.

VN100582AActive Publication Date: 2024-01-25HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
VN1202305966
Authority / Receiving Office
VN · VN
Patent Type
Applications
Current Assignee / Owner
Priority Date
2021-02-23
Filing Date
2022-02-22
Publication Date
2024-01-25
Estimated Expiration
2042-02-22

AI Technical Summary

Technical Problem

Existing filtering techniques such as DBF, SAO, and ALF may exhibit filtering artifacts in video coding, resulting in poor filtering effects and low coding performance.

Method used

The original pixel value is adjusted based on the gradient value of the current pixel to determine the adjusted pixel value, thereby improving the filtering effect and encoding performance.

Benefits of technology

Under the condition of meeting the enhanced adjustment mode, the filtering effect and encoding performance are improved by adjusting the pixel values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure VN1202305966_0
    Figure VN1202305966_0
Patent Text Reader

Abstract

The invention relates to a method, machine, and apparatus for encoding and decoding. This method includes: if the current pixel in the current block satisfies the conditions of an enhanced smoothing mode, determining the gradient value of the current pixel based on the initial pixel value of the current pixel and the initial pixel value of the surrounding pixel of the current pixel; based on the gradient value of the current pixel and the initial pixel value of the current pixel, determining the smoothed pixel value of the current pixel. The technical solutions of the invention are capable of improving encoding performance.
Need to check novelty before this filing date? Find Prior Art

Description

Coding and decoding method, device and equipment Technical Field

[0001] The present application relates to the field of coding and decoding technology, and in particular to a coding and decoding method, apparatus and device thereof. Background Art

[0002] To save space, video images are encoded before transmission. A complete video encoding method can include prediction, transformation, quantization, entropy coding, filtering, and other processes. Predictive coding can include intra-frame coding and inter-frame coding. Furthermore, inter-frame coding utilizes the correlation in the temporal domain of the video, using pixels from adjacent encoded images to predict the current pixel, effectively removing temporal redundancy. Intra-frame coding utilizes the correlation in the spatial domain of the video, using pixels from already encoded blocks of the current frame image to predict the current pixel, removing spatial redundancy.

[0003] Common filtering technologies include DBF (DeBlocking Filter), SAO (Sample Adaptive Offset), and ALF (Adaptive Loop Filter). DBF is used to remove block boundary effects caused by block coding. SAO classifies samples based on their pixel values ​​and the gradient values ​​of surrounding blocks, adding different compensation values ​​to the pixel values ​​of each category to make the reconstructed image closer to the original image. ALF filters the reconstructed image using a Wiener filter, making the reconstructed image closer to the original image.

[0004] However, filtering technologies such as DBF, SAO, and ALF all perform classification based on the pixel value of the current pixel, or based on the relationship between the pixel value of the current pixel and the pixel values ​​of surrounding pixels. Different filtering operations are then performed based on different categories, which may result in filter waves. That is, the pixel value after filtering is much larger or much smaller than the pixel value before filtering, and also much larger or much smaller than the original pixel value, resulting in poor filtering effect and poor encoding performance.

[0005] Summary of the Invention

[0006] The present application provides a coding and decoding method, apparatus and device thereof, which can improve coding performance.

[0007] The present application provides a coding and decoding method, the method comprising:

[0008] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0009] The present application provides a decoding device, comprising:

[0010] a memory configured to store video data;

[0011] A decoder configured to:

[0012] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0013] The present application provides an encoding device, comprising:

[0014] a memory configured to store video data;

[0015] An encoder configured to:

[0016] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0017] The present application provides a decoding end device, comprising: 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;

[0018] The processor is configured to execute machine-executable instructions to implement the following steps:

[0019] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0020] The present application provides an encoding end device, comprising: 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;

[0021] The processor is configured to execute machine-executable instructions to implement the following steps:

[0022] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0023] As can be seen from the above technical solution, in the embodiment of the present application, if the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the adjusted pixel value of the current pixel point can be determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point. In other words, the original pixel value of the current pixel point is adjusted based on the gradient value of the current pixel point, so that the adjusted pixel value of the current pixel point is closer to the original pixel, thereby improving encoding performance. In the filtering process, such as DBF, SAO and ALF, if the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, after the original pixel value of the current pixel point is adjusted based on the gradient value of the current pixel point, the filtering effect can be improved and the encoding performance can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] FIG1 is a schematic diagram of a coding and decoding framework in one embodiment of the present application;

[0025] 2A and 2B are schematic diagrams of block division in one embodiment of the present application;

[0026] FIG3 is a schematic diagram of deblocking filtering in one embodiment of the present application;

[0027] FIG4 is a flow chart of an encoding and decoding method in one embodiment of the present application;

[0028] FIG5A is a hardware structure diagram of a decoding end device in one embodiment of the present application;

[0029] FIG5B is a hardware structure diagram of an encoding terminal device in one embodiment of the present application. DETAILED DESCRIPTION

[0030] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, rather than limiting the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items. It should also be understood that although the terms first, second, third, etc. may be used to describe various information in the embodiments of the present application, these information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of the embodiments of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, in addition, the word "if" used can be interpreted as "at the time of...", or "when...", or "in response to determination".

[0031] In order to enable those skilled in the art to better understand the technical solutions of the present application, the technical terms are briefly explained below.

[0032] Video encoding framework: As shown in Figure 1, the video encoding framework can be used to implement the encoding end processing flow of the embodiment of the present application. The schematic diagram of the video decoding framework can be similar to Figure 1 and will not be repeated here. The video decoding framework can be used to implement the decoding end processing flow of the embodiment of the present application. In the video encoding framework and the video decoding framework, it can include but is not limited to: prediction (such as intra-frame prediction and inter-frame prediction, etc.), motion estimation / motion compensation, reference image buffer, in-loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, entropy encoder and other modules. At the encoding end, the processing flow of the encoding end is realized through the cooperation between these modules, and at the decoding end, the processing flow of the decoding end is realized through the cooperation between these modules.

[0033] Loop filtering is used to reduce problems such as image blocking or poor image quality, and can improve image quality. It can include three filters: DBF, SAO, and ALF. DBF is a deblocking filter used to remove block boundary effects caused by block coding. SAO is a sample adaptive compensation filter, which is used to classify based on the pixel value of the sample and the gradient value of the surrounding blocks. Different compensation values ​​are added to the pixel values ​​of each category to make the reconstructed image closer to the original image. ALF is an adaptive loop filter, which uses the Wiener filter to filter the reconstructed image to make the reconstructed image closer to the original image.

[0034] For example, during video encoding and decoding, the prediction process can include intra-frame prediction and inter-frame prediction. Intra-frame prediction takes into account the strong spatial correlation between adjacent blocks and uses the surrounding reconstructed pixels as reference pixels to predict the current uncoded block. Only the residual values ​​need to be subsequently encoded, rather than the original values. This effectively removes redundancy in the spatial domain and greatly improves compression efficiency. Inter-frame prediction utilizes the correlation in the video's temporal domain and uses the pixels of adjacent encoded images to predict the pixels of the current image, thereby removing temporal redundancy in the video.

[0035] For example, in the video encoding and decoding process, transform refers to converting an image described as pixels in the spatial domain into an image in the transform domain, represented by transform coefficients. Since most images contain a large number of flat areas and slowly varying areas, an appropriate transform process can transform the dispersed distribution of image energy in the spatial domain into a relatively concentrated distribution in the transform domain. This removes frequency domain correlation between signals and, in conjunction with the quantization process, effectively compresses the bitstream.

[0036] For example, entropy coding refers to a lossless encoding method based on the principle of information entropy. As the final processing module in video compression, it converts a series of element symbols representing a video sequence into a binary bitstream for transmission or storage. The input symbols may include quantized transform coefficients, motion vector information, prediction mode information, and transform and quantization syntax. The output data of the entropy coding module is the final bitstream after the original video is compressed. Entropy coding effectively removes statistical redundancy in these video element symbols and is one of the key tools for ensuring video coding compression efficiency.

[0037] Exemplarily, loop filtering is used to reduce problems such as image block effects or poor image effects, and is used to improve image quality, and may include but is not limited to DBF, SAO, and ALF. For example, in a video image, the boundaries of image blocks are not continuous, and the compressed and reconstructed image has obvious block effects, which seriously affects the image quality. DBF technology can be used to perform deblocking filtering on the boundaries. Deblocking filtering is performed on the boundaries of all prediction units (PU) and transform units (TU). Deblocking filtering includes filtering decision and filtering operation. During the filtering decision process, boundary strength (such as no filtering, weak filtering, or strong filtering) and filtering parameters are obtained. During the filtering operation, the pixels are corrected according to the boundary strength and filtering parameters. For example, when filtering the boundaries, strong filtering or weak filtering can be used, and taps of different lengths are used for filtering.

[0038] SAO filtering: used to eliminate the ringing effect. The ringing effect is caused by the quantization distortion of high-frequency AC coefficients, which will produce ripples around the edges after decoding. The larger the transform block size, the more obvious the ringing effect. The basic principle of SAO is to compensate for the peak pixels in the reconstructed curve by adding negative values ​​and the valley pixels by adding positive values. SAO is based on CTU (Coding Tree Unit) as the basic unit and can include two major types of compensation: edge offset (EO) and band offset (BO). In addition, parameter fusion technology is also introduced.

[0039] ALF filtering: The optimal filter in the mean squared sense, i.e., the Wiener filter, can be calculated based on the original and distorted signals. ALF filters include, but are not limited to, a 7x7 diamond filter, a 5x5 diamond filter, a centrosymmetric filter consisting of a 7x7 cross and a 3x3 square, or a centrosymmetric filter consisting of a 7x7 cross and a 5x5 square.

[0040] Intra-frame prediction: Leveraging spatial correlations in the video, the current block is predicted using previously coded blocks to remove spatial redundancy. Intra-frame prediction specifies multiple prediction modes, each corresponding to a texture direction (except DC mode). For example, if the image texture is horizontally arranged, the horizontal prediction mode can better predict the image information.

[0041] Inter-frame prediction: Based on temporal correlation in video, since video sequences often have strong temporal correlation, using pixels from adjacent coded images to predict pixels in the current image effectively removes temporal redundancy. The inter-frame prediction portion of video coding standards employs block-based motion compensation technology. The principle is to find the best matching block in the previously coded image for each pixel block in the current image. This process is called motion estimation (ME).

[0042] Motion Vector (MV): In inter-frame prediction, a motion vector can be used to represent the relative displacement between the current block in the current frame and the reference block in the reference frame. Each block has a corresponding motion vector that is transmitted to the decoder. If the motion vector of each block is encoded and transmitted independently, especially for a large number of small blocks, a large number of bits would be consumed. To reduce the number of bits used to encode the motion vector, the spatial correlation between adjacent blocks can be exploited to predict the motion vector of the current block based on the motion vectors of adjacent encoded blocks. The predicted difference is then encoded, effectively reducing the number of bits required to represent the motion vector. When encoding the motion vector of the current block, the motion vector of the current block can be predicted using the motion vectors of adjacent encoded blocks. The difference between the predicted motion vector (MVP) and the true estimated motion vector (MVD) is then encoded.

[0043] Motion Information: Since the motion vector represents the position offset between the current block and a reference block, in order to accurately obtain the information pointing to the block, in addition to the motion vector, the index information of the reference frame image is also required to indicate which reference frame image the current block uses. In video coding technology, for the current frame image, a reference frame image list can usually be established, and the reference frame image index information indicates which reference frame image in the reference frame image list is used by the current block. In addition, many coding technologies also support multiple reference image lists, so an index value can also be used to indicate which reference image list is used. This index value can be called a reference direction. In summary, in video coding technology, motion vectors, reference frame indexes, reference directions and other motion-related information can be collectively referred to as motion information.

[0044] Flag coding: In video encoding, there are many modes. A particular block may use one of these modes. To indicate which mode is used, each block is tagged by encoding a corresponding flag. For example, the encoder determines the flag value through decision-making, then encodes the flag value and transmits it to the decoder. The decoder then parses the flag value to determine whether the corresponding mode is enabled.

[0045] During the encoding process of the flag bit, the encoding of the flag bit can be implemented through high-level syntax. The high-level syntax can be used to indicate whether a certain mode is allowed to be enabled, that is, the high-level syntax is used to allow the enabling of a certain mode or prohibit the enabling of a certain mode.

[0046] Exemplarily, the high-level syntax may be a high-level syntax at a sequence parameter set level, or a high-level syntax at a picture parameter set level, or a high-level syntax at a slice header level, or a high-level syntax at a picture header level, and there is no limitation on this high-level syntax.

[0047] The high-level syntax of the sequence parameter set (SPS) contains flags that determine whether certain modes (tools / methods) are allowed in the entire video sequence (i.e., multiple frames of video images). For example, if the flag is value A (such as a value of 1), the video sequence can enable the mode corresponding to the flag; otherwise, if the flag is value B (such as a value of 0), the video sequence can not enable the mode corresponding to the flag.

[0048] The high-level syntax of the picture parameter set (PPS) contains flags that determine whether certain modes (tools / methods) are allowed in a picture (e.g., a video image). If the flag is value A, the video image allows the corresponding mode; if the flag is value B, the video image does not allow the corresponding mode.

[0049] The high-level syntax of the picture header contains flags that indicate whether certain modes (tools / methods) are allowed in the header. If the flag is value A, the image header allows the corresponding mode; if the flag is value B, the image header does not allow the corresponding mode. For example, the image header stores common information specific to the current image. For example, if an image contains multiple slices, the information in the image header can be shared by all slices.

[0050] The high-level syntax of the slice header contains flags that indicate whether certain modes (tools / methods) are allowed in a slice. If the flag is value A, the slice allows the corresponding mode; if the flag is value B, the slice does not allow the corresponding mode. For example, a frame of an image can contain one or more slices. The high-level syntax of the slice header is the high-level syntax configured for each slice.

[0051] High-level syntax: used to indicate whether certain tools (methods) are allowed to be enabled, i.e., whether certain tools (methods) are allowed to be enabled or prohibited to be enabled through high-level syntax. For example, as described above, the high-level syntax can be a high-level syntax at the sequence parameter set level, a high-level syntax at the picture parameter set level, a high-level syntax at the slice header level, or a high-level syntax at the picture header level. There is no limitation on this high-level syntax, as long as it can achieve the above functions.

[0052] Rate-Distortion Optimized (RDO) is a principle used to evaluate coding efficiency. The smaller the bitrate, the greater the compression ratio, and the higher the PSNR, the better the reconstructed image quality. When selecting a mode, the discriminant formula is essentially a comprehensive evaluation of these two factors. For example, the cost of a mode is: J(mode) = D + λ*R, where D represents distortion, which is typically measured using the SSE metric. SSE is the mean squared sum of the differences between the reconstructed image block and the source image; λ is the Lagrange multiplier, and R is the actual number of bits required to encode the image block in that mode, including the bits required for coding mode information, motion information, and residual information. Using the RDO principle to compare and decide between coding modes generally ensures optimal coding performance.

[0053] Block partitioning technology: A Coding Tree Unit (CTU) is recursively divided into CUs (Coding Units) using a quadtree. Whether to use intra-frame coding or inter-frame coding is determined at the leaf node CU level. The CU can be divided into two or four prediction units (PUs), and the same prediction information is used in the same PU. After the prediction is completed and the residual information is obtained, a CU can be quad-divided into multiple transform units (TUs). For example, the current image block in this application is a PU. The block partitioning technology can also be changed. For example, a hybrid binary tree / ternary tree / quadtree partitioning structure is used to replace the original partitioning mode, cancel the distinction between the concepts of CU, PU, ​​and TU, and support a more flexible partitioning method of CU. The CU can be divided into a square or a rectangle. The CTU is first divided into a quadtree, and then the leaf nodes of the quadtree division can be divided into a binary tree and a ternary tree. As shown in Figure 2A, there are five types of CU partitioning, namely quadtree partitioning, horizontal binary tree partitioning, vertical binary tree partitioning, horizontal ternary tree partitioning and vertical ternary tree partitioning. As shown in Figure 2B, the CU partitioning within the CTU can be any combination of the above five partitioning types. It can be seen from the above that different partitioning methods make the shapes of each PU different, such as rectangles and squares of different sizes.

[0054] DBF filtering (ie deblocking filtering) method: DBF filtering processing includes two processes: filtering decision and filtering operation.

[0055] The filtering decision involves: 1) obtaining the boundary strength (BS value); 2) determining whether to enable or disable filtering; and 3) selecting the filtering strength. For chroma components, only step 1) occurs, and the BS value of the luma component is directly reused. For chroma components, filtering is performed only when the BS value is 2 (i.e., at least one of the blocks on either side of the current block is in intra mode).

[0056] The filtering operations include: 1) strong filtering and weak filtering for the luminance component; 2) filtering for chrominance classification.

[0057] For example, DBF filtering generally performs horizontal boundary filtering (also called horizontal DBF filtering) and vertical boundary filtering (also called vertical DBF filtering) in units of 8*8, and filters a maximum of 3 pixels on both sides of the boundary, and utilizes a maximum of 4 pixels on both sides of the boundary for filtering. Therefore, horizontal DBF filtering and vertical DBF filtering of different blocks do not affect each other, that is, horizontal DBF filtering and vertical DBF filtering can be performed in parallel.

[0058] As shown in Figure 3, for the current block (taking 8*8 as an example), vertical DBF filtering can be performed on the 3 columns of pixels on the left side of the current block and the 3 columns of pixels on the right side of the left block (i.e., the left block of the current block), and then horizontal DBF filtering can be performed on the 3 rows of pixels above the current block and the 3 rows of pixels below the upper block (i.e., the upper block of the current block).

[0059] For example, for pixels that require both vertical DBF filtering and horizontal DBF filtering, vertical DBF filtering is typically performed first, followed by horizontal DBF filtering. Alternatively, horizontal DBF filtering can be performed first, followed by vertical DBF filtering. In subsequent embodiments, performing vertical DBF filtering first, followed by horizontal DBF filtering, is used as an example.

[0060] In a possible implementation, the DBF filtering process may include the following steps:

[0061] Step S11 : Calculate edge condition values ​​in the horizontal and vertical directions in units of 4*4.

[0062] For CU boundaries, and if they are 8*8 boundaries, the edge condition value is 2 (used to indicate that both the luminance component and the chrominance component are filtered). For PU (Prediction Unit) boundaries (such as the 1 / 4, 1 / 2, and 3 / 4 horizontal lines within 2N*hN), and if they are 8*8 boundaries, the edge condition value is 1 (used to indicate that the luminance component is filtered, but the chrominance component is not filtered). For other cases besides the above two cases, the edge condition value is 0.

[0063] Step S12: Complete vertical filtering of all blocks in 4*4 units (filtering is done in 8*8 units, but edge condition values ​​and other information are stored in 4*4 units). When the edge condition value is not 0, perform the following filtering process:

[0064] 1. Luminance component filtering (vertical filtering processes the 4 rows of the vertical boundary, and horizontal filtering processes the 4 columns of the horizontal boundary):

[0065] 1.1. First, determine whether to skip the filtering process. For example, if the blocks on both sides of the boundary are non-intra mode blocks, have no residuals, and have consistent motion, the filtering process will be skipped. Otherwise, the filtering process is required.

[0066] 1.2. If the filtering process is not skipped, the following processing is performed:

[0067] 1.2.1. If the filtering type (df_type) of the current frame is type 1 and ABS(R0 - L0) >= 4 * Alpha, then FS is 0; otherwise, proceed to step 1.2.2 to determine FS. Alpha is a preset value, and ABS() is the absolute value operation.

[0068] 1.2.2. Calculate FL (Flatness Left, the left - hand smoothness, optional values are 0, 2, 3) and FR (Flatness Right, the right - hand smoothness, optional values are 0, 2, 3). FL and FR are used to judge the smoothness inside both sides. Then, determine FS based on FL and FR. For example, the following formula can be used to determine FS: FS = FL + FR.

[0069] 1.2.2.1. If ABS(L1 - L0) < Beta and ABS(L2 - L0) < Beta, then FL is 3; if ABS(L1 - L0) < Beta and ABS(L2 - L0) >= Beta, then FL is 2; if ABS(L1 - L0) >= Beta and ABS(L2 - L0) < Beta, then FL is 1; otherwise, FL is 0. Beta is a preset value, and ABS() is the absolute value operation.

[0070] 1.2.2.2. The calculation method of FR is similar to that of FL, and will not be repeated here.

[0071] 1.2.3. Determine the BS value based on FS (the optional values of FS are 0, 2, 3, 4, 5, 6, and the optional values of BS are 0, 1, 2, 3, 4). For example, after obtaining FS, the BS value can be determined based on the value of FS.

[0072] 1.2.3.1. If FS is less than or equal to 2 (at most one side is moderately smooth), then BS = 0.

[0073] 1.2.3.2. If FS is 3 (exactly one side is highly smooth), then BS = (ABS(L1 - R1) < Beta)? 1:0, that is, if ABS(L1 - R1) < Beta holds, then BS = 1; otherwise, BS = 0.

[0074] 1.2.3.3. If FS is 4 (i.e., both sides are moderately smooth), then BS = (FL == 2)? 2:1, that is, if FL = 2, then BS = 2; otherwise, if FL is not equal to 2, then BS = 1.

[0075] 1.2.3.4. If FS is 5 (i.e., one side is moderately smooth and the other side is highly smooth), then:

[0076] If the filtering type (df_type) of the current frame is type 1, then BS = (R1 == R0 && L0 == L1 && ABS(R2 – L2) < Alpha)? 3:2; that is, if the pixel value of pixel point R1 is equal to the pixel value of pixel point R0, and the pixel value of pixel point L0 is equal to the pixel value of pixel point L1, and the absolute value of the difference between the pixel value of pixel point R2 and the pixel value of pixel point L2 is less than Alpha (i.e., a pre-configured value), then BS = 3; otherwise, BS = 2.

[0077] Otherwise (i.e., the filtering type (df_type) of the current frame is not type 1), if the filtering type of the current frame is type 0, then BS = (R1 == R0 && L0 == L1)? 3:2; that is, if the pixel value of pixel point R1 is equal to the pixel value of pixel point R0, and the pixel value of pixel point L0 is equal to the pixel value of pixel point L1, then BS = 3; otherwise, BS = 2.

[0078] 1.2.3.5. If FS is 6 (i.e., both sides are highly smoothed), then:

[0079] If the filtering type (df_type) of the current frame is type 1, then BS = (ABS(R0 - R1) <= Beta / 4 && ABS(L0 - L1) <= Beta / 4 && ABS(R0 - L0) < Alpha) && ABS(R0 - R3) <= Beta / 2 && ABS(L0 - L3) <= Beta / 2? 4:3; that is, if ABS(R0 - R1) <= Beta / 4, ABS(L0 - L1) <= Beta / 4, ABS(R0 - L0) < Alpha, ABS(R0 - R3) <= Beta / 2, and ABS(L0 - L3) <= Beta / 2 all hold, then BS = 4; otherwise, BS = 3.

[0080] Otherwise (i.e., the filtering type (df_type) of the current frame is not type 1), if the filtering type of the current frame is type 0, then BS = (ABS(R0 - R1) <= Beta / 4 && ABS(L0 - L1) <= Beta / 4 && ABS(R0 - L0) < Alpha)? 4:3; that is, if ABS(R0 - R1) <= Beta / 4, ABS(L0 - L1) <= Beta / 4, and ABS(R0 - L0) < Alpha all hold, then BS = 4; otherwise, BS = 3.

[0081] 1.2.4. Determine the filter coefficient and the number of filtered pixels based on the BS value. For example, assume that the four pixels on the left or above the boundary are L0-L3 (as shown in Figure 3, with the left side as an example); and the four pixels on the right or below the boundary are R0-R3 (as shown in Figure 3, with the right side as an example). For the luminance component:

[0082] 1.2.4.1. If BS = 4, filter the three pixels on both sides of the boundary:

[0083] For L0 and R0, the filtering coefficients are [3, 8, 10, 8, 3] / 32, that is: in order to determine the pixel value of pixel point L0 after filtering, the pixel values ​​of pixel points L2, L1, L0, R0 and R1 are weighted summed, and the weighted coefficients (that is, filtering coefficients) are 3 / 32, 8 / 32, 10 / 32, 8 / 32 and 3 / 32 respectively. If wj is the filter coefficient, then when j = -2 (the second pixel to the left of the current pixel, i.e., L2), wj = 3 / 32; when j = -1 (the first pixel to the left of the current pixel, i.e., L1), wj = 8 / 32; when j = 0 (the current pixel, i.e., L0), wj = 10 / 32; when j = 1 (the first pixel to the right of the current pixel, i.e., R0), wj = 8 / 32; when j = 2 (the second pixel to the right of the current pixel, R1), wj = 8 / 32. To determine the pixel value of pixel R0 after filtering, the pixel values ​​of pixels R2, R1, R0, L0, and L1 are weighted and summed, with the weighting coefficients being 3 / 32, 8 / 32, 10 / 32, 8 / 32, and 3 / 32, respectively. If wj is the filter coefficient, then when j = -2 (the second pixel to the right of the current pixel, i.e. R2), wj = 3 / 32; when j = -1 (the first pixel to the right of the current pixel, i.e. R1), wj = 8 / 32; when j = 0 (the current pixel, i.e. R0), wj = 10 / 32; when j = 1 (the first pixel to the left of the current pixel, i.e. L0), wj = 8 / 32; when j = 2 (the second pixel to the left of the current pixel, L1), wj = 8 / 32.

[0084] To summarize, L0'=clip(L2*3+L1*8+L0*10+R0*8+R1*3+16)>>5), where L0' is the pixel value of pixel L0 after filtering, L0-L2 are the pixel values ​​of pixels L0-L2 before filtering, and R0-R1 are the pixel values ​​of pixels R0-R1. The same applies below. R0'=clip((R2*3+R1*8+R0*10+L0*8+L1*3+16)>>5)>>5).

[0085] In the above formula, ">>" is a right shift operation, which is used to replace division. That is, ">>5 is equivalent to dividing by 2. 5(i.e. 32). Multiplication ("*") can be replaced by left shifting. For example, a multiplied by 4 can be replaced by left shifting 2 bits, i.e. by a<<2; a multiplied by 10 can be replaced by (a<<3)+(a<<1). "<<" is a left shift operation, which is used to replace multiplication. For example, "a<<2" is equivalent to multiplying by 2. 2 (i.e. 4). Considering that when the division operation is implemented by shifting, the result of the operation is usually rounded directly, that is, when the result of the operation is a non-integer between N and N+1, the result is taken as N, and considering that when the decimal part is greater than 0.5, the accuracy of taking the result as N+1 will be higher, therefore, in order to improve the accuracy of the determined pixel value, when performing the calculation, 1 / 2 of the denominator (i.e. the dividend) can be added to the numerator of the above-mentioned weighted sum to achieve the effect of rounding. Taking the calculation of L0' as an example, shifting right by 5 bits is equivalent to dividing by 25 (i.e. 32), therefore, 16 can be added to the numerator of the above-mentioned weighted sum. clip(x) is a clipping operation. When x exceeds the upper limit of the preset numerical range, the value of x is set to the upper limit of the preset numerical range; when x is lower than the lower limit of the preset numerical range, the value of x is set to the lower limit of the preset data range.

[0086] For L1 and R1, the filter coefficients are [4, 5, 4, 3] / 16. On this basis, L1'=clip((L2*4+L1*5+L0*4+R0*3+8)>>4), R1'=clip((R2*4+R1*5+R0*4+L0*3+8)>>4).

[0087] For L2 and R2, the filter coefficients are [2, 2, 2, 1, 1] / 8, then L2'=clip((L3*2+L2*2+L1*2+L0*1+R0*1+4)>>3), R2'=clip((R3*2+R2*2+R1*2+R0*1+L0*1+4)>>3).

[0088] 1.2.4.2. If BS = 3, filter two pixels on each side of the boundary:

[0089] For L0 and R0, the filter coefficients are [1, 4, 6, 4, 1] / 16, L0'=clip(L2*1+L1*4+L0*6+R0*4+R1*1+8)>>4, R0'=clip(R2*1+R1*4+R0*6+L0*4+L1*1+8)>>4.

[0090] For L1 and R1, the filter coefficients are [3, 8, 4, 1] / 16, then L1'=clip((L2*3+L1*8+L0*4+R0*1+8)>>4), R1'=clip((R2*3+R1*8+R0*4+L0*1+8)>>4).

[0091] 1.2.4.3. If BS = 2, filter one pixel on each side of the boundary:

[0092] For L0 and R0, the filter coefficient is [3, 10, 3] / 16. On this basis, L0'=clip(L1*3+L0*10+R0*3+8)>>4, R0'=clip(R1*3+R0*10+L0*3+8)>>4.

[0093] 1.2.4.4. If BS=1, filter one pixel on each side of the boundary: for L0 and R0, the filter coefficient is [3, 1] / 4, L0'=clip(L0*3+R0*1+2)>>2, R0'=clip(R0*3+L0*1+2)>>2.

[0094] 1.2.4.5. If BS=0, no filtering is performed, that is, the pixels on both sides of the boundary are not filtered.

[0095] 2. When the edge condition value is 2, chroma filtering is performed on the boundary of the 16*16 block. In other words, the chroma component is filtered on the boundary of the 16*16 block. The filtering process of the chroma component is as follows:

[0096] 2.1. First determine whether filtering is required. The process is similar to that of the brightness component and will not be repeated here.

[0097] 2.2. If filtering is required (i.e., the filtering process is not skipped), FL and FR are calculated separately, and FS is obtained based on FL and FR, and BS value is obtained based on FS. This process is similar to the brightness component and will not be repeated here.

[0098] 2.3. Subtract 1 from the obtained BS value of the chrominance component (such as 4, 3, 2, 1, 0, etc.). That is, the optional values ​​of BS can be 3, 2, 1, 0. The chrominance component is filtered based on the BS value. The specific process is as follows:

[0099] If BS=3, filter the two pixels on both sides of the boundary: for L0 and R0, the filter coefficients are [3, 10, 3] / 16, L0'=clip(L1*3+L0*10+R0*3+8)>>4, R0'=clip(R1*3+R0*10+L0*3+8)>>4. For L1 and R1, the filter coefficients are [3, 8, 3, 2] / 16, L1'=clip((L2*3+L1*8+L0*3+R0*2+8)>>4), R1'=clip((R2*3+R1*8+R0*3+L0*2+8)>>4).

[0100] If BS = 2 or BS = 1, one pixel on each side of the boundary is filtered: for L0 and R0, the filtering coefficients are [3, 10, 3] / 16, L0' = clip(L1*3+L0*10+R0*3+8)>>4, R0' = clip(R1*3+R0*10+L0*3+8)>>4. If BS = 0, no filtering is performed, that is, the pixels on both sides of the boundary are not filtered.

[0101] For example, the Alpha and Beta in the above process are related to the QP average of the blocks on both sides of the boundary, that is, the QP average of the current block and the block to the left of the current block (for vertical DBF filtering) or the QP average of the current block and the block above the current block (for horizontal DBF filtering). The values ​​of Alpha and Beta can be obtained by looking up a table, and there is no limitation on this.

[0102] Step S13, complete horizontal filtering of all blocks in 4*4 units (filtering is performed in 8*8 units, but information such as edge condition values ​​are stored in 4*4 units). The implementation method is similar to step S12 and will not be repeated here.

[0103] In related technologies, filtering technologies such as DBF, SAO and ALF are all classified based on the pixel value of the current pixel, or based on the relationship between the pixel value of the current pixel and the pixel values ​​of surrounding pixels. Then, different filtering operations are performed based on different categories. Filter waves may occur, that is, the pixel value after filtering is much larger or much smaller than the pixel value before filtering, and also much larger or much smaller than the original pixel value, resulting in poor filtering effect and poor encoding performance.

[0104] In response to the above findings, this embodiment proposes a coding and decoding method that adjusts the original pixel value of the current pixel based on the gradient value of the current pixel, bringing the adjusted pixel value of the current pixel closer to the original pixel, thereby improving coding performance. During the filtering process, if the current pixel in the current block meets the conditions for enabling the enhanced adjustment mode, the original pixel value of the current pixel is adjusted based on the gradient value of the current pixel, thereby improving the filtering effect and coding performance.

[0105] The following describes the encoding and decoding method in the embodiment of the present application in detail with reference to specific embodiments.

[0106] Embodiment 1: In the embodiment of the present application, a coding and decoding method is proposed. The method can be applied to an encoding end or a decoding end. Referring to FIG4 , which is a flow chart of the coding and decoding method, the method may include:

[0107] Step 401: If the current pixel in the current block meets the enabling condition of the enhancement adjustment mode, the gradient value of the current pixel is determined based on the original pixel value of the current pixel and the original pixel values ​​of the pixels surrounding the current pixel.

[0108] Exemplarily, the gradient value of the current pixel can be determined based on the difference between the original pixel value of the current pixel and the original pixel values ​​of surrounding pixels. That is, the gradient value of the current pixel reflects the difference between the two pixel values.

[0109] Exemplarily, the surrounding pixels of the current pixel may be adjacent pixels of the current pixel or non-adjacent pixels of the current pixel. The surrounding pixels of the current pixel may be pixels located in the current block or pixels located in a block adjacent to the current block. For example, the surrounding pixels of the current pixel may be pixels to the left of the current pixel, pixels to the right of the current pixel, pixels above the current pixel, or pixels below the current pixel. There is no restriction on the positions of the surrounding pixels of the current pixel.

[0110] For example, as shown in Figure 3, if the current pixel is R0 in the current block, the surrounding pixels of the current pixel may be L0 in the adjacent block to the left of the current block. If the current pixel is the pixel in the first row and second column of the current block, the surrounding pixels of the current pixel may be the pixel in the eighth row and second column of the adjacent block above the current block.

[0111] Step 402: Determine an adjusted pixel value for the current pixel based on the gradient value of the current pixel and the original pixel value of the current pixel. For example, the adjusted pixel value for the current pixel may be determined based on the gradient value of the current pixel, the original pixel value of the current pixel, a first adjustment threshold, a second adjustment threshold, a first adjustment offset value, and a second adjustment offset value.

[0112] In one possible implementation, if the gradient value of the current pixel is greater than the first adjustment threshold, the adjusted pixel value of the current pixel is determined based on the original pixel value of the current pixel and the first adjustment offset value, for example, the adjusted pixel value of the current pixel is determined based on the sum of the original pixel value of the current pixel and the first adjustment offset value. If the gradient value of the current pixel is less than the second adjustment threshold, the adjusted pixel value of the current pixel is determined based on the original pixel value of the current pixel and the second adjustment offset value, for example, the adjusted pixel value of the current pixel is determined based on the sum of the original pixel value of the current pixel and the second adjustment offset value. Exemplarily, the first adjustment threshold and the second adjustment threshold may be opposite numbers to each other. Of course, the first adjustment threshold and the second adjustment threshold may not be opposite numbers to each other, and the first adjustment threshold and the second adjustment threshold may be set arbitrarily.

[0113] In one possible implementation, if the current pixel in the current block meets the enabling conditions of the enhanced adjustment mode, a reference pixel corresponding to the current pixel can also be determined from the adjacent blocks of the current block, and the gradient value of the reference pixel can be determined based on the original pixel value of the reference pixel and the original pixel values ​​of the pixels surrounding the reference pixel; based on the gradient value of the reference pixel and the original pixel value of the reference pixel, the adjusted pixel value of the reference pixel can be determined.

[0114] Exemplarily, the reference pixel point can be a pixel point adjacent to the current pixel point in an adjacent block, or a pixel point non-adjacent to the current pixel point in an adjacent block, without limitation. For example, referring to FIG3 , if the current pixel point is R0 in the current block, the reference pixel point can be L0 in the adjacent block on the left side of the current block, or L1, L2, etc. in the adjacent block on the left side of the current block, without limitation. If the current pixel point is R1 in the current block, the reference pixel point can be L0 in the adjacent block on the left side of the current block, or L1, L2, etc. in the adjacent block on the left side of the current block, without limitation. If the current pixel point is the pixel point in the first row and second column of the current block, the reference pixel point can be the pixel point in the eighth row and second column of the adjacent block above the current block, or the pixel point in the seventh row and second column of the adjacent block above the current block, without limitation.

[0115] Exemplarily, the gradient value of a reference pixel may be determined based on the difference between the original pixel value of the reference pixel and the original pixel values ​​of pixels surrounding the reference pixel. That is, the gradient value reflects the difference between the two pixel values.

[0116] Exemplarily, the surrounding pixels of the reference pixel may be adjacent pixels of the reference pixel or non-adjacent pixels of the reference pixel. The surrounding pixels of the reference pixel may be pixels located in the block where the reference pixel is located or pixels located in a block adjacent to the block where the reference pixel is located. The surrounding pixels of the reference pixel may be pixels to the left of the reference pixel, pixels to the right of the reference pixel, pixels above the reference pixel, or pixels below the reference pixel. There is no restriction on the positions of the surrounding pixels of the reference pixel.

[0117] In a possible implementation, the surrounding pixels of the reference pixel may be the current pixel in the current block. Similarly, the surrounding pixels of the current pixel may be reference pixels in a neighboring block of the current block.

[0118] Exemplarily, determining the adjusted pixel value of the reference pixel point based on the gradient value of the reference pixel point and the original pixel value of the reference pixel point may include, but is not limited to: determining the adjusted pixel value of the reference pixel point based on the gradient value of the reference pixel point, the original pixel value of the reference pixel point, a third adjustment threshold (which may be the same as or different from the first adjustment threshold), a fourth adjustment threshold (which may be the same as or different from the second adjustment threshold), a third adjustment offset value (which may be the same as or different from the first adjustment offset value), and a fourth adjustment offset value (which may be the same as or different from the third adjustment offset value).

[0119] For example, if the gradient value of the reference pixel is greater than the third adjustment threshold, the adjusted pixel value of the reference pixel is determined based on the original pixel value of the reference pixel and the third adjustment offset value, for example, the adjusted pixel value of the reference pixel is determined based on the sum of the original pixel value of the reference pixel and the third adjustment offset value. If the gradient value of the reference pixel is less than the fourth adjustment threshold, the adjusted pixel value of the reference pixel is determined based on the original pixel value of the reference pixel and the fourth adjustment offset value, for example, the adjusted pixel value of the reference pixel is determined based on the sum of the original pixel value of the reference pixel and the fourth adjustment offset value.

[0120] For example, the third adjustment threshold and the fourth adjustment threshold may be opposite numbers to each other. Of course, the third adjustment threshold and the fourth adjustment threshold may not be opposite numbers to each other, and the third adjustment threshold and the fourth adjustment threshold may be set arbitrarily.

[0121] In a possible implementation, the first adjustment threshold, the second adjustment threshold, the first adjustment offset value, the second adjustment offset value, the third adjustment threshold, the fourth adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block may be parsed from the high-level syntax. Alternatively, the first adjustment threshold, the first adjustment offset value, the second adjustment offset value, the third adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block may be parsed from the high-level syntax. Alternatively, the first adjustment threshold, the first adjustment offset value, the second adjustment offset value, the third adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block may be parsed from the high-level syntax. Alternatively, the first adjustment threshold, the first adjustment offset value, the second adjustment offset value, the fourth adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block may be parsed from the high-level syntax. Alternatively, the second adjustment threshold, the first adjustment offset value, the second adjustment offset value, the fourth adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block may be parsed from the high-level syntax.

[0122] For example, if the first adjustment threshold and the second adjustment threshold are opposite numbers, the second adjustment threshold can be derived after parsing the first adjustment threshold from the high-level grammar, and the first adjustment threshold can be derived after parsing the second adjustment threshold from the high-level grammar. If the third adjustment threshold and the fourth adjustment threshold are opposite numbers, the fourth adjustment threshold can be derived after parsing the third adjustment threshold from the high-level grammar, and the third adjustment threshold can be derived after parsing the fourth adjustment threshold from the high-level grammar.

[0123] In one possible implementation, the current pixel in the current block satisfies the conditions for enabling the enhanced adjustment mode, which may include, but is not limited to, determining that the current pixel satisfies the conditions for enabling the enhanced adjustment mode if the boundary strength of the boundary to be filtered corresponding to the current pixel in the current block satisfies the conditions for enabling the enhanced adjustment mode. For example, if the boundary strength of the boundary to be filtered corresponding to the current pixel is a preset first value, it can be determined that the boundary strength of the boundary to be filtered satisfies the conditions for enabling the enhanced adjustment mode. Exemplarily, the preset first value may be 0. Of course, the preset first value may also be other values.

[0124] Alternatively, if the feature information corresponding to the current block satisfies the enabling conditions of the enhanced adjustment mode, then it is determined that the current pixel in the current block satisfies the enabling conditions of the enhanced adjustment mode. Exemplarily, the feature information corresponding to the current block satisfies the enabling conditions of the enhanced adjustment mode means that if, based on the feature information corresponding to the current block, it is determined that a filtering operation (such as a deblocking filtering operation) is not initiated on the current block, then it is determined that the feature information corresponding to the current block satisfies the enabling conditions of the enhanced adjustment mode.

[0125] Exemplarily, before determining whether the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the enhanced adjustment mode enable flag corresponding to the current block can be obtained first. If the enhanced adjustment mode enable flag corresponding to the current block allows the current block to enable the enhanced adjustment mode, then it is determined whether the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, that is, it is determined whether the current pixel point meets the enabling conditions of the enhanced adjustment mode, or does not meet the enabling conditions of the enhanced adjustment mode.

[0126] Alternatively, if the enhancement adjustment mode enable flag corresponding to the current block does not allow the current block to enable the enhancement adjustment mode, it is directly determined that the current pixel in the current block does not meet the enhancement adjustment mode enabling condition.

[0127] For example, for the decoding end, the enhanced adjustment mode enable flag corresponding to the current block can be parsed from the high-level syntax, and then based on the enhanced adjustment mode enable flag, it is determined whether to allow the current block to enable the enhanced adjustment mode.

[0128] For example, if the enhanced adjustment mode enable flag is the first value (such as 1), the enhanced adjustment mode enable flag allows the current block to enable the enhanced adjustment mode. If the enhanced adjustment mode enable flag is the second value (such as 0), the enhanced adjustment mode enable flag does not allow the current block to enable the enhanced adjustment mode.

[0129] In one possible implementation, if the coding method is applied to a prediction process (such as intra-frame prediction or inter-frame prediction), the original pixel value of the current pixel may be a predicted value obtained by intra-frame prediction or inter-frame prediction, and the adjusted pixel value of the current pixel serves as the target pixel value of the current pixel (the final pixel value of the prediction process). If the coding method is applied to a filtering process, the original pixel value of the current pixel may be a predicted value before filtering, and the adjusted pixel value of the current pixel serves as the target pixel value of the current pixel (the final pixel value of the filtering process).

[0130] As can be seen from the above technical solution, in the embodiment of the present application, if the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the adjusted pixel value of the current pixel point can be determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point. In other words, the original pixel value of the current pixel point is adjusted based on the gradient value of the current pixel point, so that the adjusted pixel value of the current pixel point is closer to the original pixel, thereby improving encoding performance. In the filtering process, such as DBF, SAO and ALF, if the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, after the original pixel value of the current pixel point is adjusted based on the gradient value of the current pixel point, the filtering effect can be improved and the encoding performance can be improved.

[0131] In one possible implementation, if the current pixel in the current block meets the activation conditions of the normal filtering mode, deblocking filtering (i.e., DBF filtering) may be performed on the original pixel value of the current pixel to obtain a filtered pixel value of the current pixel. Of course, deblocking filtering is only an example, and other filtering methods may be used to filter the original pixel value of the current pixel. For example, SAO filtering may be performed on the original pixel value of the current pixel to obtain a filtered pixel value of the current pixel. Alternatively, ALF filtering may be performed on the original pixel value of the current pixel to obtain a filtered pixel value of the current pixel.

[0132] Exemplarily, taking deblocking filtering as an example, referring to steps S11 to S13, a process of performing deblocking filtering on the original pixel value of the current pixel to obtain the filtered pixel value of the current pixel is shown, which will not be repeated here.

[0133] Continuing to refer to step S11-step S13, it can be seen from these steps that the filtering process will be skipped only if the blocks on both sides of the boundary are non-intra mode blocks, have no residuals, and have consistent motion. Otherwise, the filtering process needs to be performed. When the filtering process is required, the value of BS can also be obtained. If BS is equal to 0, no filtering is performed, that is, the pixels on both sides of the boundary are not filtered. If BS is greater than 0, the pixels on both sides of the boundary are filtered. In summary, if the blocks on both sides of the boundary are non-intra mode blocks, have no residuals, and have consistent motion, the current pixel in the current block does not meet the activation conditions of the normal filtering mode. If the blocks on both sides of the boundary are non-intra mode blocks, have no residuals, and motion consistency does not hold (that is, the blocks on both sides of the boundary are not non-intra mode blocks, or the blocks on both sides of the boundary have residuals, or the blocks on both sides of the boundary have inconsistent motion), and BS is equal to 0, the current pixel in the current block does not meet the activation conditions of the normal filtering mode. If the blocks on both sides of the boundary are non-intra mode blocks, have no residual, and motion consistency does not hold, and BS is greater than 0, then the current pixel in the current block meets the enabling conditions of the normal filtering mode.

[0134] It should be noted that if the current pixel point in the current block meets the enabling conditions of the normal filtering mode, the current pixel point in the current block does not meet the enabling conditions of the enhanced adjustment mode; if the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the current pixel point in the current block does not meet the enabling conditions of the normal filtering mode.

[0135] On the basis that the current pixel point meets the enabling conditions of the normal filtering mode and the original pixel value of the current pixel point is deblocking filtered to obtain the filtered pixel value of the current pixel point, it is also necessary to determine whether the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode. If the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, the adjusted pixel value of the current pixel point is determined based on the filtered pixel value of the current pixel point and the original pixel value of the current pixel point, that is, the adjusted pixel value of the current pixel point is used as the target pixel value of the current pixel point (the final pixel value of the deblocking filtering process). If the current pixel point in the current block does not meet the enabling conditions of the enhanced filtering mode, the filtered pixel value of the current pixel point is not adjusted, and the filtered pixel value of the current pixel point is used as the target pixel value of the current pixel point (the final pixel value of the deblocking filtering process).

[0136] Exemplarily, if the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, the adjusted pixel value of the current pixel point is determined based on the filtered pixel value of the current pixel point and the original pixel value of the current pixel point, which may include but is not limited to: determining the adjusted pixel value of the current pixel point based on the filtered pixel value of the current pixel point, the original pixel value of the current pixel point, the first filtering threshold, the second filtering threshold, the first filtering offset value and the second filtering offset value.

[0137] Exemplarily, the first filtering threshold and the second filtering threshold may be opposite numbers to each other. Of course, the first filtering threshold and the second filtering threshold may not be opposite numbers to each other, and the first filtering threshold and the second filtering threshold may be set arbitrarily.

[0138] In one possible implementation, if the current pixel in the current block meets the activation conditions of the normal filtering mode, a reference pixel corresponding to the current pixel may be determined from adjacent blocks of the current block, and deblocking filtering (i.e., DBF filtering) may be performed on the original pixel value of the reference pixel to obtain a filtered pixel value of the reference pixel. Of course, deblocking filtering is only an example, and other filtering methods may be used to filter the original pixel value of the reference pixel, for example, performing SAO filtering or ALF filtering on the original pixel value of the reference pixel to obtain a filtered pixel value of the reference pixel.

[0139] Exemplarily, taking deblocking filtering as an example, referring to steps S11 to S13, a process of performing deblocking filtering on the original pixel value of the reference pixel to obtain the filtered pixel value of the reference pixel is shown, which will not be repeated here.

[0140] Illustratively, the reference pixel may be a pixel adjacent to the current pixel in an adjacent block, or a pixel non-adjacent to the current pixel in an adjacent block, and there is no limitation on this.

[0141] On the basis that the current pixel point meets the enabling conditions of the normal filtering mode and the original pixel value of the reference pixel point is deblocking filtered to obtain the filtered pixel value of the reference pixel point, it is also necessary to determine whether the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode. If the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, the adjusted pixel value of the reference pixel point is determined based on the filtered pixel value of the reference pixel point and the original pixel value of the reference pixel point, that is, the adjusted pixel value of the reference pixel point is used as the target pixel value of the reference pixel point (the final pixel value of the deblocking filtering process). If the current pixel point in the current block does not meet the enabling conditions of the enhanced filtering mode, the filtered pixel value of the reference pixel point is not adjusted, and the filtered pixel value of the reference pixel point is used as the target pixel value of the reference pixel point (the final pixel value of the deblocking filtering process).

[0142] Exemplarily, determining the adjusted pixel value of the reference pixel point based on the filtered pixel value of the reference pixel point and the original pixel value of the reference pixel point may include but is not limited to: determining the adjusted pixel value of the reference pixel point based on the filtered pixel value of the reference pixel point, the original pixel value of the reference pixel point, the third filtering threshold, the fourth filtering threshold, the third filtering offset value and the fourth filtering offset value; wherein the third filtering threshold and the fourth filtering threshold may be opposite numbers to each other, and of course, the third filtering threshold and the fourth filtering threshold may not be opposite numbers to each other, and the third filtering threshold and the fourth filtering threshold may be set arbitrarily.

[0143] In a possible implementation, the first filtering threshold, the second filtering threshold, the first filtering offset value, the second filtering offset value, the third filtering threshold, the fourth filtering threshold, the third filtering offset value, and the fourth filtering offset value corresponding to the current block can be parsed from the high-level syntax. Alternatively, the first filtering threshold, the first filtering offset value, the second filtering offset value, the third filtering threshold, the third filtering offset value, and the fourth filtering offset value corresponding to the current block can be parsed from the high-level syntax. Alternatively, the second filtering threshold, the first filtering offset value, the second filtering offset value, the third filtering threshold, the third filtering offset value, and the fourth filtering offset value corresponding to the current block can be parsed from the high-level syntax. Alternatively, the first filtering threshold, the first filtering offset value, the second filtering offset value, the fourth filtering threshold, the third filtering offset value, and the fourth filtering offset value corresponding to the current block can be parsed from the high-level syntax. Alternatively, the second filtering threshold, the first filtering offset value, the second filtering offset value, the fourth filtering threshold, the third filtering offset value, and the fourth filtering offset value corresponding to the current block can be parsed from the high-level syntax.

[0144] For example, if the first and second filtering thresholds are opposite numbers, the second filtering threshold can be derived after parsing the first filtering threshold from the high-level syntax, and the first filtering threshold can be derived after parsing the second filtering threshold from the high-level syntax. If the third and fourth filtering thresholds are opposite numbers, the fourth filtering threshold can be derived after parsing the third filtering threshold from the high-level syntax, and the third filtering threshold can be derived after parsing the fourth filtering threshold from the high-level syntax.

[0145] In one possible implementation, the current pixel in the current block satisfies the enabling condition for the enhanced filtering mode, which may include but is not limited to: if the boundary strength of the boundary to be filtered corresponding to the current pixel in the current block satisfies the enabling condition for the enhanced filtering mode, and the absolute value of the difference between the filtered pixel value of the current pixel and the original pixel value of the current pixel is greater than a preset threshold (the preset threshold is a positive value, and there is no restriction on this preset threshold. For example, if the first filtering threshold and the second filtering threshold are reciprocal numbers, when the first filtering threshold is a positive value, the preset threshold is the same as the first filtering threshold, and when the second filtering threshold is a positive value, the preset threshold is the same as the second filtering threshold. Of course, the preset threshold may also be other values), then it is determined that the current pixel satisfies the enabling condition for the enhanced filtering mode. Exemplarily, the boundary strength of the boundary to be filtered corresponding to the current pixel in the current block satisfies the enabling condition for the enhanced filtering mode, which may include but is not limited to: if the boundary strength of the boundary to be filtered corresponding to the current pixel is a preset second value (different from the preset first value, that is, not 0, such as the preset second value may be greater than 0), then it is determined that the boundary strength of the boundary to be filtered satisfies the enabling condition for the enhanced filtering mode.

[0146] Exemplarily, before determining whether the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, the enhanced filtering mode enable flag corresponding to the current block can be obtained first. If the enhanced filtering mode enable flag corresponding to the current block allows the current block to enable the enhanced filtering mode, then it is determined whether the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, that is, it is determined whether the current pixel point meets the enabling conditions of the enhanced filtering mode, or does not meet the enabling conditions of the enhanced filtering mode.

[0147] Alternatively, if the enhancement filtering mode enable flag corresponding to the current block does not allow the current block to enable the enhancement filtering mode, it is directly determined that the current pixel in the current block does not meet the enabling condition of the enhancement filtering mode.

[0148] For example, for the decoding end, the enhanced filtering mode enable flag corresponding to the current block can be parsed from the high-level syntax, and then based on the enhanced filtering mode enable flag, it is determined whether the current block is allowed to enable the enhanced filtering mode.

[0149] For example, if the enhanced filtering mode enable flag is the first value (such as 1), the enhanced filtering mode enable flag allows the current block to enable the enhanced filtering mode. If the enhanced filtering mode enable flag is the second value (such as 0), the enhanced filtering mode enable flag does not allow the current block to enable the enhanced filtering mode.

[0150] Exemplarily, in the above embodiments, the high-level syntax may include but is not limited to one of the following syntaxes: sequence parameter set SPS level high-level syntax; picture parameter set PPS level high-level syntax; picture header level high-level syntax; frame level high-level syntax; slice header level high-level syntax; coding tree unit CTU level high-level syntax; coding unit CU level high-level syntax.

[0151] Exemplarily, in the above embodiment, the pixel value of the current pixel in the current block may be a luminance component or a chrominance component.

[0152] As can be seen from the above technical solution, if the current pixel in the current block meets the enabling conditions of the enhanced filtering mode, the adjusted pixel value of the current pixel can be determined based on the filtered pixel value of the current pixel and the original pixel value of the current pixel. In other words, the original pixel value of the current pixel is adjusted based on the filtered pixel value of the current pixel, so that the adjusted pixel value of the current pixel is closer to the original pixel, thereby improving encoding performance. In the filtering process, such as DBF, SAO and ALF, if the current pixel in the current block meets the enabling conditions of the enhanced filtering mode, after adjusting the original pixel value of the current pixel based on the filtered pixel value of the current pixel, the filtering effect can be improved, thereby improving encoding performance.

[0153] Embodiment 2: When filtering is required, it is necessary to first determine whether to skip the filtering process. For example, if the blocks on both sides of the boundary (i.e., the current block and the adjacent blocks of the current block, for vertical boundaries, the adjacent blocks to the left of the current block, for horizontal boundaries, the adjacent blocks above the current block) are non-intra mode blocks (i.e., neither the current block nor the adjacent blocks are intra blocks), have no residual (i.e., there is no residual between the current block and the adjacent blocks), and have consistent motion (i.e., the motion of the current block and the adjacent blocks is consistent), the filtering process will be skipped. Otherwise, the filtering process will not be skipped. Based on this, "skipping the filtering process" can be used as an activation condition for the enhanced adjustment mode. That is, if the filtering process is skipped for the current pixel in the current block, the current pixel in the current block meets the activation condition for the enhanced adjustment mode. When the current pixel meets the activation condition for the enhanced adjustment mode, the enhanced adjustment mode can be used to adjust the original pixel value of the current pixel, so that the pixel value is closer to the original pixel.

[0154] Exemplarily, if the characteristic information corresponding to the current block meets the enabling conditions of the enhanced adjustment mode, it is determined that the current pixel in the current block meets the enabling conditions of the enhanced adjustment mode. The characteristic information corresponding to the current block is used to indicate whether the blocks on both sides of the boundary are non-intra mode blocks, whether the blocks on both sides of the boundary have no residuals, and whether the blocks on both sides of the boundary have consistent motion. Based on this, if the characteristic information corresponding to the current block is used to indicate that the blocks on both sides of the boundary are non-intra mode blocks, and is used to indicate that the blocks on both sides of the boundary have no residuals, and is used to indicate that the blocks on both sides of the boundary have consistent motion, then it is explained that the characteristic information corresponding to the current block meets the enabling conditions of the enhanced adjustment mode, and it is determined that the current pixel in the current block meets the enabling conditions of the enhanced adjustment mode, that is, each pixel in the current block meets the enabling conditions of the enhanced adjustment mode. Alternatively, if the characteristic information corresponding to the current block is used to indicate that the blocks on both sides of the boundary are not all non-intra mode blocks, and / or, the characteristic information corresponding to the current block is used to indicate that the blocks on both sides of the boundary have residuals, and / or, the characteristic information corresponding to the current block is used to indicate that the blocks on both sides of the boundary have inconsistent motion, then it means that the characteristic information corresponding to the current block does not meet the enabling conditions of the enhanced adjustment mode, and it is determined that the current pixel point in the current block does not meet the enabling conditions of the enhanced adjustment mode, that is, each pixel point in the current block does not meet the enabling conditions of the enhanced adjustment mode.

[0155] For example, when the current pixel point meets the enabling conditions of the enhanced adjustment mode, the enhanced adjustment mode can be used to adjust the original pixel value of the current pixel point. For example, the gradient value of the current pixel point can be first determined based on the original pixel value of the current pixel point, and the adjusted pixel value of the current pixel point can be determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point. For the process of determining the adjusted pixel value, please refer to the subsequent embodiments and will not be repeated here.

[0156] Example 3: When filtering is required, it is necessary to first determine whether to skip the filtering process. For example, if the blocks on both sides of the boundary are non-intra-mode blocks, have no residuals, and have consistent motion, the filtering process will be skipped. Otherwise, the filtering process will not be skipped. When the filtering process will not be skipped, the BS value can also be determined. If the BS value is greater than 0 (such as the BS value is 1, 2, 3, 4, etc.), the pixels on both sides of the boundary can be filtered. If the BS value is 0, no filtering is performed, that is, the pixels on both sides of the boundary are not filtered. Based on this, "BS value of 0" can be used as the enabling condition for the enhanced adjustment mode, that is, if the BS value of the current pixel point in the current block is 0, the current pixel point in the current block meets the enabling condition for the enhanced adjustment mode; if the BS value of the current pixel point in the current block is greater than 0, the current pixel point in the current block does not meet the enabling condition for the enhanced adjustment mode.

[0157] Exemplarily, if the boundary strength of the boundary to be filtered corresponding to the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, then it is determined that the current pixel point meets the enabling conditions of the enhanced adjustment mode. For example, the boundary strength of the boundary to be filtered corresponding to the current pixel point can be determined first, and if the boundary strength is a preset first value, then it is determined that the boundary strength meets the enabling conditions of the enhanced adjustment mode. The preset first value can be configured based on experience, such as the preset first value is 0. In summary, if the boundary strength of the boundary to be filtered corresponding to the current pixel point is 0, it means that the boundary strength of the boundary to be filtered corresponding to the current pixel point meets the enabling conditions of the enhanced adjustment mode, and it is determined that the current pixel point meets the enabling conditions of the enhanced adjustment mode.

[0158] Alternatively, if the boundary strength of the boundary to be filtered corresponding to the current pixel in the current block does not satisfy the enabling condition for the enhanced adjustment mode, then it is determined that the current pixel does not satisfy the enabling condition for the enhanced adjustment mode. For example, if the boundary strength of the boundary to be filtered corresponding to the current pixel is not a preset first value, then it is determined that the boundary strength does not satisfy the enabling condition for the enhanced adjustment mode, thereby determining that the current pixel in the current block does not satisfy the enabling condition for the enhanced adjustment mode.

[0159] For example, when the current pixel meets the conditions for enabling the enhanced adjustment mode, the enhanced adjustment mode can be used to adjust the original pixel value of the current pixel, thereby making the pixel value closer to the original pixel. For example, the gradient value of the current pixel can be first determined based on the original pixel value of the current pixel, and then the adjusted pixel value of the current pixel can be determined based on the gradient value of the current pixel and the original pixel value of the current pixel. The process of determining the adjusted pixel value will be described in subsequent embodiments.

[0160] Example 4: When filtering is required, it is necessary to first determine whether to skip the filtering process. For example, if the blocks on both sides of the boundary are non-intra-mode blocks, have no residuals, and have consistent motion, the filtering process will be skipped. Otherwise, the filtering process will not be skipped. When the filtering process will not be skipped, the BS value can also be determined. If the BS value is greater than 0 (such as the BS value is 1, 2, 3, 4, etc.), the pixels on both sides of the boundary can be filtered. If the BS value is 0, no filtering is performed, that is, the pixels on both sides of the boundary are not filtered. Based on this, "BS value greater than 0" can be used as the enabling condition for the normal filtering mode, that is, if the BS value of the current pixel point in the current block is greater than 0, the current pixel point in the current block meets the enabling condition for the normal filtering mode; if the BS value of the current pixel point in the current block is equal to 0, the current pixel point in the current block does not meet the enabling condition for the normal filtering mode.

[0161] Exemplarily, if the boundary strength of the boundary to be filtered corresponding to the current pixel point in the current block meets the enabling conditions of the normal filtering mode, then it is determined that the current pixel point meets the enabling conditions of the normal filtering mode. For example, the boundary strength of the boundary to be filtered corresponding to the current pixel point can be determined first. If the boundary strength is a preset second value, then it is determined that the boundary strength meets the enabling conditions of the normal filtering mode. The preset second value can be configured based on experience, such as the preset second value can be greater than 0, such as the preset second value can be 1, 2, 3, 4, etc. In summary, if the boundary strength of the boundary to be filtered corresponding to the current pixel point is greater than 0 (that is, the boundary strength is not 0), it means that the boundary strength of the boundary to be filtered corresponding to the current pixel point meets the enabling conditions of the normal filtering mode, and it is determined that the current pixel point meets the enabling conditions of the normal filtering mode.

[0162] Alternatively, if the boundary strength of the boundary to be filtered corresponding to the current pixel in the current block does not satisfy the activation condition of the normal filtering mode, then it is determined that the current pixel does not satisfy the activation condition of the normal filtering mode. For example, if the boundary strength of the boundary to be filtered corresponding to the current pixel (e.g., 0) is not a preset second value, then it is determined that the boundary strength does not satisfy the activation condition of the normal filtering mode, thereby determining that the current pixel in the current block does not satisfy the activation condition of the normal filtering mode.

[0163] For example, when the current pixel point meets the activation conditions of the normal filtering mode, the original pixel value of the current pixel point can also be deblocked (ie, DBF filtering, this article takes deblocking filtering as an example) to obtain the filtered pixel value of the current pixel point.

[0164] Embodiment 5: Based on the fact that the current pixel in the current block meets the enabling conditions of the normal filtering mode and the original pixel value of the current pixel is deblocked and filtered to obtain the filtered pixel value of the current pixel, it is further possible to determine whether the current pixel in the current block meets the enabling conditions of the enhanced filtering mode. For example, it is determined whether the absolute value of the difference between the filtered pixel value of the current pixel and the original pixel value of the current pixel is greater than a preset threshold. If it is greater than the preset threshold, it is determined that the current pixel in the current block meets the enabling conditions of the enhanced filtering mode. If it is not greater than the preset threshold, it is determined that the current pixel in the current block does not meet the enabling conditions of the enhanced filtering mode. In summary, the fact that the current pixel in the current block meets the enabling conditions of the enhanced filtering mode may include: if the boundary strength of the boundary to be filtered corresponding to the current pixel in the current block meets the enabling conditions of the enhanced filtering mode, and the absolute value of the difference between the filtered pixel value of the current pixel and the original pixel value of the current pixel is greater than the preset threshold, it is determined that the current pixel meets the enabling conditions of the enhanced filtering mode.

[0165] The enabling conditions of the enhanced filtering mode are described below in conjunction with specific embodiments.

[0166] When filtering is required, it is necessary to first determine whether to skip the filtering process. If the filtering process will not be skipped, the BS value can also be determined. If the BS value is greater than 0, the pixels on both sides of the boundary can be filtered. Based on this, "BS value greater than 0" can be used as an enabling condition for the enhanced filtering mode, that is, "BS value greater than 0" can be used as an enabling condition for both the normal filtering mode and the enhanced filtering mode. When the BS value is greater than 0, the original pixel value of the current pixel point needs to be deblocked and filtered to obtain the filtered pixel value of the current pixel point. After obtaining the filtered pixel value of the current pixel point, it can also be determined whether the absolute value of the difference between the filtered pixel value of the current pixel point and the original pixel value of the current pixel point is greater than a preset threshold, and "the absolute value of the difference is greater than the preset threshold" can be used as an enabling condition for the enhanced filtering mode.

[0167] In summary, if the boundary strength of the boundary to be filtered corresponding to the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, and the absolute value of the difference between the filtered pixel value of the current pixel point and the original pixel value of the current pixel point is greater than the preset threshold, then it is determined that the current pixel point meets the enabling conditions of the enhanced filtering mode. Otherwise, it is determined that the current pixel point does not meet the enabling conditions of the enhanced filtering mode. For example, the boundary strength of the boundary to be filtered corresponding to the current pixel point is first determined. If the boundary strength is a preset second value, then it is determined that the boundary strength meets the enabling conditions of the enhanced filtering mode. The preset second value can be configured based on experience, such as the preset second value can be greater than 0, such as the preset second value can be 1, 2, 3, 4, etc.

[0168] For example, when the current pixel meets the enabling conditions of the enhancement filtering mode, the adjusted pixel value of the current pixel can be determined based on the filtered pixel value of the current pixel and the original pixel value of the current pixel, that is, the adjusted pixel value of the current pixel is used as the target pixel value of the current pixel (the final pixel value of the deblocking filtering process). If the current pixel in the current block does not meet the enabling conditions of the enhancement filtering mode, the filtered pixel value of the current pixel is not adjusted, and the filtered pixel value of the current pixel is used as the target pixel value of the current pixel (the final pixel value of the deblocking filtering process).

[0169] It can be seen from the above embodiments 1, 2, 3, 4, and 5 that this document involves an enhanced adjustment mode, a normal filtering mode, and an enhanced filtering mode. The original pixel value of the current pixel point can be processed based on the enhanced adjustment mode, the normal filtering mode, or the enhanced filtering mode to obtain the target pixel value (i.e., the final pixel value) of the current pixel point. For example, if the current pixel point meets the enabling conditions of the enhanced adjustment mode, then in the enhanced adjustment mode, the original pixel value of the current pixel point can be adjusted based on the gradient value of the current pixel point to obtain the adjusted pixel value of the current pixel point, and the adjusted pixel value is used as the target pixel value. For another example, if the current pixel point meets the enabling conditions of the normal filtering mode, but does not meet the enabling conditions of the enhanced filtering mode, then in the normal filtering mode, the original pixel value of the current pixel point can be filtered to obtain the filtered pixel value of the current pixel point, and the filtered pixel value is used as the target pixel value. For another example, if the current pixel point meets the enabling conditions of the normal filtering mode and the enabling conditions of the enhanced filtering mode, then in the enhanced filtering mode, the original pixel value of the current pixel point can be filtered to obtain the filtered pixel value of the current pixel point, and the original pixel value of the current pixel point can be adjusted based on the filtered pixel value of the current pixel point to obtain the adjusted pixel value of the current pixel point, and the adjusted pixel value is used as the target pixel value.

[0170] In one possible implementation, when performing deblocking filtering on the current block, the original pixel value of the current pixel point may be processed using the enhanced adjustment mode, the normal filtering mode, or the enhanced filtering mode. That is, the enhanced adjustment mode, the normal filtering mode, and the enhanced filtering mode all belong to the deblocking filtering mode, that is, the enhanced adjustment mode, the normal filtering mode, and the enhanced filtering mode may be submodes of the deblocking filtering mode. Based on this, in the deblocking filtering mode, it may be determined whether to process the original pixel value of the current pixel point using the enhanced adjustment mode, or to process the original pixel value of the current pixel point using the normal filtering mode, or to process the original pixel value of the current pixel point using the enhanced filtering mode.

[0171] Of course, the enhanced adjustment mode, the normal filtering mode, and the enhanced filtering mode may also belong to other types of filtering modes, such as the SAO filtering mode or the ALF filtering mode, that is, the enhanced adjustment mode, the normal filtering mode, and the enhanced filtering mode may be sub-modes of the SAO filtering mode, or the enhanced adjustment mode, the normal filtering mode, and the enhanced filtering mode may be sub-modes of the ALF filtering mode. Based on this, in the SAO filtering mode or the ALF filtering mode, it can be determined whether to use the enhanced adjustment mode to process the original pixel value of the current pixel point, or to use the normal filtering mode to process the original pixel value of the current pixel point, or to use the enhanced filtering mode to process the original pixel value of the current pixel point.

[0172] Exemplarily, taking the enhanced adjustment mode, the normal filtering mode and the enhanced filtering mode all belonging to the deblocking filtering mode as an example, the normal filtering mode can be called the normal mode of the deblocking filtering mode, that is, after the original pixel value of the current pixel point is deblocked and the filtered pixel value is obtained, the filtered pixel value after the deblocking filtering is no longer adjusted. The enhanced filtering mode can be called the deblocking filtering adjustment mode (deblocking refinement, abbreviated as DBR), that is, after the original pixel value of the current pixel point is deblocked and the filtered pixel value is obtained, the filtered pixel value after the deblocking filtering needs to be adjusted. The enhanced adjustment mode can be called the optional deblocking filtering adjustment mode (alt deblocking refinement, abbreviated as ADBR), that is, without performing deblocking filtering on the original pixel value of the current pixel point, the original pixel value of the current pixel point is directly adjusted.

[0173] Example 6: With respect to Example 1, Example 2, and Example 3, the original pixel value of the current pixel point may be adjusted using the enhanced adjustment mode. When adjusting the original pixel value, the following steps may be used:

[0174] Step S21: Determine a gradient value for the current pixel based on the original pixel value of the current pixel and the original pixel values ​​of the pixels surrounding the current pixel. For example, the gradient value for the current pixel can be determined based on the difference between the original pixel value of the current pixel and the original pixel values ​​of the pixels surrounding the current pixel. This determination method is not limited.

[0175] Step S22: Determine a reference pixel corresponding to the current pixel from among the neighboring blocks of the current block (for a vertical boundary, the neighboring block is the left neighboring block of the current block; for a horizontal boundary, the neighboring block is the top neighboring block of the current block), and determine a gradient value for the reference pixel based on the original pixel value of the reference pixel and the original pixel values ​​of the pixels surrounding the reference pixel. For example, the gradient value of the reference pixel can be determined based on the difference between the original pixel value of the reference pixel and the original pixel values ​​of the pixels surrounding the reference pixel, and this determination method is not limited.

[0176] Exemplarily, the gradient value of the current pixel is determined based on the original pixel value of the current pixel and the original pixel values ​​of the surrounding pixels of the current pixel (if the surrounding pixels are the reference pixel), and the gradient value of the reference pixel is determined based on the original pixel values ​​of the surrounding pixels of the reference pixel (if the surrounding pixels are the current pixel) and the original pixel value of the reference pixel.

[0177] For example, assuming that pi is the original pixel value of the current pixel in the current block, that is, the original pixel value of the pixels surrounding the reference pixel, and qi is the original pixel value of the reference pixel in the adjacent block, that is, the original pixel value of the pixels surrounding the current pixel. In other words, pi and qi are the original pixel values ​​on both sides of the boundary, respectively. Then, the gradient value DPi of the current pixel pi can be determined as follows: DPi = (pi - qi + 2) >> 2, and the gradient value DQi of the reference pixel qi can be determined as follows: DQi = (qi - pi + 2) >> 2. Of course, the above is only an example of determining the gradient value of the current pixel and the gradient value of the reference pixel, and this is not a limitation. Obviously, the gradient value of the current pixel can be determined based on the difference between the original pixel value of the current pixel and the original pixel value of the reference pixel. The gradient value of the reference pixel can be determined based on the difference between the original pixel value of the reference pixel and the original pixel value of the current pixel.

[0178] Taking the current pixel pi as p0 (corresponding to R0 in Figure 3) and the reference pixel qi as q0 (corresponding to L0 in Figure 3) as an example, the gradient value DP0 of the current pixel p0 is determined as follows: DP0 = (p0 - q0 + 2) >> 2, and the gradient value DQ0 of the reference pixel q0 is determined as follows: DQ0 = (q0 - p0 + 2) >> 2. Another way to express DP0 = (p0 - q0 + 2) >> 2 is DP0 = (p0 - q0 + 1) >> 1, and another way to express DQ0 = (q0 - p0 + 2) >> 2 is DQ0 = (q0 - p0 + 1) >> 1.

[0179] Step S23: Determine an adjusted pixel value for the current pixel based on the gradient value of the current pixel and the original pixel value of the current pixel. For example, if the gradient value of the current pixel is greater than a first adjustment threshold, the adjusted pixel value for the current pixel is determined based on the original pixel value of the current pixel and a first adjustment offset value (also referred to as a first adjustment offset). If the gradient value of the current pixel is less than a second adjustment threshold, the adjusted pixel value for the current pixel is determined based on the original pixel value of the current pixel and the second adjustment offset value. Exemplarily, the first adjustment threshold and the second adjustment threshold may be reciprocal values ​​of each other.

[0180] Step S24: Determine an adjusted pixel value for the reference pixel based on the gradient value of the reference pixel and the original pixel value of the reference pixel. For example, if the gradient value of the reference pixel is greater than a third adjustment threshold, the adjusted pixel value for the reference pixel is determined based on the original pixel value of the reference pixel and a third adjustment offset value (also referred to as a third adjustment offset). If the gradient value of the reference pixel is less than a fourth adjustment threshold, the adjusted pixel value for the reference pixel is determined based on the original pixel value of the reference pixel and the fourth adjustment offset value. Exemplarily, the third adjustment threshold and the fourth adjustment threshold may be reciprocal values ​​of each other.

[0181] For example, if the gradient value DPi of the current pixel point pi is greater than alt_dbr_th (alt_dbr_th represents the first adjustment threshold), the adjusted pixel value Pi of the current pixel point pi can be determined as follows: Pi = clip(pi + alt_dbr_offset0), where alt_dbr_offset0 can represent the first adjustment offset value. Alternatively, if the gradient value DPi of the current pixel point pi is less than –alt_dbr_th (–alt_dbr_th represents the second adjustment threshold), the adjusted pixel value Pi of the current pixel point pi can be determined as follows: Pi = clip(pi + alt_dbr_offset1), where alt_dbr_offset1 can represent the second adjustment offset value.

[0182] In the above embodiment, i can be 0, 1, or 2. Taking i as 0 as an example, if DP0>dbr_th, then P0=clip(p0+alt_dbr_offset0); if DP0<–dbr_th, then P0=clip(p0+alt_dbr_offset1).

[0183] For example, if the gradient value DQi of the reference pixel point qi is greater than alt_dbr_th (alt_dbr_th represents the third adjustment threshold. Here, the third adjustment threshold is taken as the same as the first adjustment threshold. In actual applications, the third adjustment threshold and the first adjustment threshold may also be different), then the adjusted pixel value Qi of the reference pixel point qi can be determined as follows: Qi = clip(qi+alt_dbr_offset0), alt_dbr_offset0 can represent the third adjustment offset value. This time, the third adjustment offset value is taken as the same as the first adjustment offset value. In actual applications, the third adjustment offset value and the first adjustment offset value may also be different.

[0184] Alternatively, if the gradient value DQi of the reference pixel point qi is less than –alt_dbr_th (–alt_dbr_th represents the fourth adjustment threshold. Here, the fourth adjustment threshold is taken as the example of being the same as the second adjustment threshold. In actual applications, the fourth adjustment threshold and the second adjustment threshold may also be different), then the adjusted pixel value Qi of the reference pixel point qi can be determined as follows: Qi = clip(qi + alt_dbr_offset1), alt_dbr_offset1 can represent the fourth adjustment offset value. This time, the fourth adjustment offset value is taken as the example of being the same as the second adjustment offset value. In actual applications, the fourth adjustment offset value and the second adjustment offset value may also be different.

[0185] In the above embodiment, i can be 0, 1, or 2. Taking i as 0 as an example, if DQ0>dbr_th, then Q0=clip(q0+alt_dbr_offset0); if DQ0<–dbr_th, then Q0=clip(q0+alt_dbr_offset1).

[0186] In the above embodiment, pi represents the original pixel value of the current pixel, DPi represents the gradient value of the current pixel, Pi represents the adjusted pixel value of the current pixel, qi represents the original pixel value of the reference pixel, DQi represents the gradient value of the reference pixel, and Qi represents the adjusted pixel value of the reference pixel. clip(x) means limiting x to the range [0, 2^(bit_depth)-1] (inclusive), and bit_depth represents the bit depth of the image, which is generally 8, 10, 12, etc.

[0187] In one possible implementation, a decoder may parse the high-level syntax to obtain a first adjustment threshold, a first adjustment offset value, a second adjustment offset value, a third adjustment threshold value, a third adjustment offset value, and a fourth adjustment offset value corresponding to the current block. Because the first adjustment threshold value and the second adjustment threshold value are inversely proportional, and the third adjustment threshold value and the fourth adjustment threshold value are inversely proportional, the decoder may determine the second adjustment threshold value and the fourth adjustment threshold value.

[0188] In another possible implementation, a decoder may parse the high-level syntax to obtain the first adjustment threshold, the first adjustment offset value, the second adjustment offset value, the fourth adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block. Because the first adjustment threshold and the second adjustment threshold are inverse numbers, and the third adjustment threshold and the fourth adjustment threshold are inverse numbers, the decoder may determine the second adjustment threshold and the third adjustment threshold.

[0189] In another possible implementation, a decoder may parse the high-level syntax to obtain the second adjustment threshold, the first adjustment offset value, the second adjustment offset value, the third adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block. Because the first adjustment threshold and the second adjustment threshold are inverse numbers, and the third adjustment threshold and the fourth adjustment threshold are inverse numbers, the decoder may determine the first adjustment threshold and the fourth adjustment threshold.

[0190] In another possible implementation, a decoder may parse the high-level syntax to obtain the second adjustment threshold, the first adjustment offset value, the second adjustment offset value, the fourth adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value corresponding to the current block. Because the first adjustment threshold and the second adjustment threshold are inverses of each other, and the third adjustment threshold and the fourth adjustment threshold are inverses of each other, the decoder may determine the first adjustment threshold and the third adjustment threshold.

[0191] In another possible implementation, for the decoding end, the first adjustment threshold (or the second adjustment threshold, or the third adjustment threshold, or the fourth adjustment threshold, i.e., the other three adjustment thresholds can be derived from one adjustment threshold), the first adjustment offset value (or the third adjustment offset value), and the second adjustment offset value (or the fourth adjustment offset value) corresponding to the current block can be parsed from the high-level syntax. On this basis, since the first adjustment threshold and the second adjustment threshold are reciprocal numbers, the second adjustment threshold can be determined. Since the first adjustment threshold and the third adjustment threshold are the same, the third adjustment threshold can be determined. Since the third adjustment offset value is the same as the first adjustment offset value, the third adjustment offset value can be determined. Since the fourth adjustment offset value is the same as the second adjustment offset value, the fourth adjustment offset value can be determined. Since the third adjustment threshold and the fourth adjustment threshold are reciprocal numbers, the fourth adjustment threshold can be determined.

[0192] Of course, the above methods are just a few examples and are not limited to this. As long as the decoding end can know the first adjustment threshold, the second adjustment threshold, the third adjustment threshold, the fourth adjustment threshold, the first adjustment offset value, the second adjustment offset value, the third adjustment offset value and the fourth adjustment offset value, the above values ​​can be obtained by analysis or deduction.

[0193] In the above embodiment, the high-level syntax may include, but is not limited to, one of the following syntaxes: SPS-level high-level syntax; PPS-level high-level syntax; picture header-level high-level syntax; frame-level high-level syntax; slice header-level high-level syntax; CTU-level high-level syntax; and CU-level high-level syntax. Of course, the above are just a few examples of high-level syntax, and there is no limitation on the type of high-level syntax, as long as the high-level syntax can carry the adjustment threshold and adjustment offset value corresponding to the current block.

[0194] In the above embodiment, the pixel value of the current pixel in the current block may be a luminance component or a chrominance component.

[0195] In one possible implementation, the enhanced adjustment mode enable flag can be used to indicate whether the enhanced adjustment mode is allowed to be enabled. If the enhanced adjustment mode enable flag allows the current block to enable the enhanced adjustment mode, it is necessary to determine whether the current pixel in the current block meets the enabling conditions of the enhanced adjustment mode. If the current pixel meets the enabling conditions of the enhanced adjustment mode, the enhanced adjustment mode is used to adjust the original pixel value of the current pixel. If the enhanced adjustment mode enable flag does not allow the current block to enable the enhanced adjustment mode, it is directly determined that each pixel in the current block does not meet the enabling conditions of the enhanced adjustment mode, and the enhanced adjustment mode will not be used to adjust the original pixel value of the current pixel. On this basis, if the enhanced adjustment mode enable flag corresponding to the current block allows the current block to enable the enhanced adjustment mode, it is determined whether the current pixel in the current block meets the enabling conditions of the enhanced adjustment mode. If the enhanced adjustment mode enable flag corresponding to the current block does not allow the current block to enable the enhanced adjustment mode, it is determined that each pixel in the current block does not meet the enabling conditions of the enhanced adjustment mode.

[0196] For example, the decoder can parse the enhanced adjustment mode enable flag corresponding to the current block from the high-level syntax. For example, if the enhanced adjustment mode enable flag is a first value (e.g., 1), it indicates that the enhanced adjustment mode enable flag allows the current block to enable the enhanced adjustment mode. If the enhanced adjustment mode enable flag is a second value (e.g., 0), it indicates that the enhanced adjustment mode enable flag does not allow the current block to enable the enhanced adjustment mode.

[0197] In the above embodiment, the high-level syntax may include, but is not limited to, one of the following syntaxes: SPS-level high-level syntax; PPS-level high-level syntax; picture header-level high-level syntax; frame-level high-level syntax; slice header-level high-level syntax; CTU-level high-level syntax; and CU-level high-level syntax. Of course, the above are just a few examples of high-level syntax, and there is no limitation on the type of high-level syntax, as long as the high-level syntax can carry the enhanced adjustment mode enable flag corresponding to the current block.

[0198] Example 7: With respect to Example 1 and Example 5, the original pixel value of the current pixel point may be adjusted using an enhanced filtering mode. When adjusting the original pixel value of the current pixel point, the following steps may be used:

[0199] Step S31: Perform deblocking filtering on the original pixel value of the current pixel to obtain a filtered pixel value of the current pixel.

[0200] Step S32: Determine a reference pixel corresponding to the current pixel from the adjacent blocks of the current block (for a vertical boundary, the adjacent block is the left adjacent block of the current block; for a horizontal boundary, the adjacent block is the upper adjacent block of the current block), and perform deblocking filtering on the original pixel value of the reference pixel to obtain a filtered pixel value of the reference pixel.

[0201] Exemplarily, the DBF filtering (i.e., deblocking filtering) method can be used to perform deblocking filtering on the original pixel value of the current pixel to obtain the filtered pixel value of the current pixel, and the DBF filtering method can be used to perform deblocking filtering on the original pixel value of the reference pixel to obtain the filtered pixel value of the reference pixel. Of course, the SAO filtering method can also be used to filter the original pixel value of the current pixel to obtain the filtered pixel value of the current pixel, and the SAO filtering method can be used to filter the original pixel value of the reference pixel to obtain the filtered pixel value of the reference pixel. Alternatively, the ALF filtering method can be used to filter the original pixel value of the current pixel to obtain the filtered pixel value of the current pixel, and the ALF filtering method can be used to filter the original pixel value of the reference pixel to obtain the filtered pixel value of the reference pixel. For the convenience of description, in the subsequent embodiments, the use of the DBF filtering method to perform deblocking filtering on the original pixel values ​​of the current pixel and the reference pixel is taken as an example.

[0202] As shown in Figure 3, based on the position of the current pixel, only the current pixel and the reference pixel can be subjected to horizontal DBF filtering, or only the current pixel and the reference pixel can be subjected to vertical DBF filtering, or the current pixel and the reference pixel can be subjected to vertical DBF filtering first, and then the current pixel and the reference pixel can be subjected to horizontal DBF filtering.

[0203] Step S33: Determine an adjusted pixel value for the current pixel based on the filtered pixel value and the original pixel value of the current pixel. For example, the adjusted pixel value for the current pixel is determined based on the filtered pixel value, the original pixel value, a first filtering threshold, a second filtering threshold, a first filtering offset, and a second filtering offset; wherein the first filtering threshold and the second filtering threshold may be inverses of each other.

[0204] Step S34: Determine an adjusted pixel value for the reference pixel based on the filtered pixel value and the original pixel value of the reference pixel. For example, the adjusted pixel value for the reference pixel is determined based on the filtered pixel value, the original pixel value of the reference pixel, a third filtering threshold, a fourth filtering threshold, a third filtering offset value, and a fourth filtering offset value; wherein the third filtering threshold and the fourth filtering threshold may be inverses of each other.

[0205] Exemplarily, if the current pixel point only meets the enabling conditions of the normal filtering mode and does not meet the enabling conditions of the enhanced filtering mode, steps S31 and S32 are executed, and the filtered pixel value is used as the target pixel value (the final pixel value of the deblocking filtering process). If the current pixel point meets the enabling conditions of the normal filtering mode and the enabling conditions of the enhanced filtering mode, steps S31 to S34 are executed, and the adjusted pixel value is used as the target pixel value (the final pixel value of the deblocking filtering process).

[0206] In step S33 and step S34, the original pixel value of the pixel point can be enhanced and filtered based on the filtered pixel value and the original pixel value without filtering, that is, the original pixel value of the pixel point is enhanced and filtered to obtain the adjusted pixel value after enhancement, so that the adjusted pixel value after enhancement is closer to the real pixel than the filtered pixel value, avoiding the filtered pixel value being much larger or much smaller than the real pixel of the pixel point due to filtering, thereby improving image quality.

[0207] Exemplarily, with respect to step S33, if the difference between the filtered pixel value of the current pixel and the original pixel value of the current pixel is greater than a first filtering threshold, an adjusted pixel value of the current pixel may be determined based on the filtered pixel value of the current pixel, the original pixel value of the current pixel, and the first filtering offset value. If the difference between the filtered pixel value of the current pixel and the original pixel value of the current pixel is less than a second filtering threshold, an adjusted pixel value of the current pixel may be determined based on the filtered pixel value of the current pixel, the original pixel value of the current pixel, and the second filtering offset value.

[0208] For example, let Y1(i) represent the original pixel value of the current pixel, Y2(i) represent the filtered pixel value of the current pixel, Y3(i) represent the adjusted pixel value of the current pixel, and let Y v (i)=(Y1(i)+Y2(i)+1)>>1.

[0209] Based on this, if Y1(i)-Y2(i)>T v , then Y3(i)=Clip(Y v (i)+f0 v ); if Y1(i)-Y2(i)<NT v , then Y3(i)=Clip(Y v (i)+f1 v ). In the above formula, T v Can represent the first filtering threshold, f0 v Can represent the first filter offset value, NT v Can represent the second filtering threshold, f1 v Can represent the second filter offset value, NT vUsually set to -T v , or other values. clip(x) means limiting x to a preset value range, which is generally [0, 2 D -1], D is the image bit depth, which ranges from [0, 255] for 8-bit images and from [0, 1023] for 10-bit images.

[0210] In order to prevent the adjusted pixel value after enhancement processing from exceeding the pixel value range, when the adjusted pixel value is obtained, the adjusted pixel value can be clipped to the preset value range through the Clip operation. When the adjusted pixel value is greater than the upper limit of the preset value range, the adjusted pixel value is set to the upper limit of the preset value range; when the adjusted pixel value is less than the lower limit of the preset value range, the adjusted pixel value is set to the lower limit of the preset value range. For example, taking an 8-bit image as an example, when the adjusted pixel value is less than 0, the adjusted pixel value is set to 0; when the adjusted pixel value is greater than 255, the adjusted pixel value is set to 255.

[0211] Exemplarily, with respect to step S34, if the difference between the filtered pixel value of the reference pixel and the original pixel value of the reference pixel is greater than the third filtering threshold, the adjusted pixel value of the reference pixel can be determined based on the filtered pixel value of the reference pixel, the original pixel value of the reference pixel, and the third filtering offset value. If the difference between the filtered pixel value of the reference pixel and the original pixel value of the reference pixel is less than the fourth filtering threshold, the adjusted pixel value of the reference pixel can be determined based on the filtered pixel value of the reference pixel, the original pixel value of the reference pixel, and the fourth filtering offset value. The method for determining the adjusted pixel value of the reference pixel is similar to the method for determining the adjusted pixel value of the current pixel, and will not be repeated here.

[0212] Exemplarily, the third filter threshold may be the same as or different from the first filter threshold, the third filter offset value may be the same as or different from the first filter offset value, the fourth filter threshold may be the same as or different from the second filter threshold, and the fourth filter offset value may be the same as or different from the second filter offset value.

[0213] In one possible implementation, a decoder can parse the high-level syntax to obtain a first filter threshold, a first filter offset value, a second filter offset value, a third filter threshold, a third filter offset value, and a fourth filter offset value corresponding to the current block. Because the first filter threshold and the second filter threshold are inverses of each other, and the third filter threshold and the fourth filter threshold are inverses of each other, the decoder can determine the second filter threshold and the fourth filter threshold.

[0214] In another possible implementation, a decoder may parse the high-level syntax to obtain the first filter threshold, the first filter offset value, the second filter offset value, the fourth filter threshold, the third filter offset value, and the fourth filter offset value corresponding to the current block. Because the first filter threshold and the second filter threshold are inverses of each other, and the third filter threshold and the fourth filter threshold are inverses of each other, the decoder may determine the second and third filter thresholds.

[0215] In another possible implementation, the decoder can parse the high-level syntax to obtain the second filter threshold, the first filter offset value, the second filter offset value, the third filter threshold, the third filter offset value, and the fourth filter offset value corresponding to the current block. Because the first filter threshold and the second filter threshold are inverses of each other, and the third filter threshold and the fourth filter threshold are inverses of each other, the decoder can determine the first filter threshold and the fourth filter threshold.

[0216] In another possible implementation, the decoder can parse the high-level syntax to obtain the second filter threshold, the first filter offset value, the second filter offset value, the fourth filter threshold, the third filter offset value, and the fourth filter offset value corresponding to the current block. Because the first filter threshold and the second filter threshold are inverses of each other, and the third filter threshold and the fourth filter threshold are inverses of each other, the decoder can determine the first and third filter thresholds.

[0217] In another possible implementation, for the decoding end, the first filter threshold (or the second filter threshold, or the third filter threshold, or the fourth filter threshold, that is, the other three filter thresholds can be derived from one filter threshold), the first filter offset value (or the third filter offset value) and the second filter offset value (or the fourth filter offset value) corresponding to the current block can be parsed from the high-level syntax. On this basis, since the first filter threshold and the second filter threshold are reciprocal numbers, the second filter threshold can be determined. Since the first filter threshold is the same as the third filter threshold, the third filter threshold can be determined. Since the third filter offset value is the same as the first filter offset value, the third filter offset value can be determined. Since the fourth filter offset value is the same as the second filter offset value, the fourth filter offset value can be determined. Since the third filter threshold and the fourth filter threshold are reciprocal numbers, the fourth filter threshold can be determined.

[0218] Of course, the above methods are just a few examples and there is no limitation to this. As long as the decoding end can know the first filtering threshold, the second filtering threshold, the third filtering threshold, the fourth filtering threshold, the first filtering offset value, the second filtering offset value, the third filtering offset value and the fourth filtering offset value, the above values ​​can be obtained through analysis or deduction.

[0219] In the above embodiment, the high-level syntax may include, but is not limited to, one of the following syntaxes: SPS-level high-level syntax; PPS-level high-level syntax; picture header-level high-level syntax; frame-level high-level syntax; slice header-level high-level syntax; CTU-level high-level syntax; and CU-level high-level syntax. Of course, the above are just a few examples of high-level syntax, and there is no limitation on the type of high-level syntax, as long as the high-level syntax can carry the filter threshold and filter offset value corresponding to the current block.

[0220] In the above embodiment, the pixel value of the current pixel in the current block may be a luminance component or a chrominance component.

[0221] In a possible implementation, the enhancement filtering mode enable flag can be used to indicate whether the enhancement filtering mode is allowed to be enabled. If the enhancement filtering mode enable flag allows the current block to enable the enhancement filtering mode, it is necessary to determine whether the current pixel in the current block meets the enabling conditions of the enhancement filtering mode. If the current pixel meets the enabling conditions of the enhancement filtering mode, the enhancement filtering mode is used to adjust the original pixel value of the current pixel. If the enhancement filtering mode enable flag does not allow the current block to enable the enhancement filtering mode, it is directly determined that each pixel in the current block does not meet the enabling conditions of the enhancement filtering mode, and the enhancement filtering mode will not be used to adjust the original pixel value of the current pixel. On this basis, if the enhancement filtering mode enable flag corresponding to the current block allows the current block to enable the enhancement filtering mode, it is determined whether the current pixel in the current block meets the enabling conditions of the enhancement filtering mode. If the enhancement filtering mode enable flag corresponding to the current block does not allow the current block to enable the enhancement filtering mode, it is determined that each pixel in the current block does not meet the enabling conditions of the enhancement filtering mode.

[0222] For example, for the decoding end, the enhanced filtering mode enable flag corresponding to the current block can be parsed from the high-level syntax. For example, if the enhanced filtering mode enable flag is a first value (such as 1), it means that the enhanced filtering mode enable flag allows the current block to enable the enhanced filtering mode. If the enhanced filtering mode enable flag is a second value (such as 0), it means that the enhanced filtering mode enable flag does not allow the current block to enable the enhanced filtering mode.

[0223] In the above embodiment, the high-level syntax may include, but is not limited to, one of the following syntaxes: SPS-level high-level syntax; PPS-level high-level syntax; picture header-level high-level syntax; frame-level high-level syntax; slice header-level high-level syntax; CTU-level high-level syntax; and CU-level high-level syntax. Of course, the above are just a few examples of high-level syntax, and there is no limitation on the type of high-level syntax, as long as the high-level syntax can carry the enhancement filtering mode enable flag corresponding to the current block.

[0224] Example 8: When the activation conditions of the normal filtering mode are met, a DBF filtering method (i.e., a deblocking filtering method) may be used to perform deblocking filtering on the original pixel values ​​of the pixel points. Since DBF filtering is divided into vertical DBF filtering and horizontal DBF filtering, the following steps may be used to perform deblocking filtering on the original pixel values ​​of the pixel points:

[0225] Step 1: The original pixel value Y1(i) is filtered by vertical DBF to obtain the filtered pixel value Y2(i);

[0226] Step 2: The pixel value Y2(i) is filtered by horizontal DBF to obtain the filtered pixel value Y3(i).

[0227] For example, if only vertical DBF filtering is performed on a pixel, only the first step is performed to obtain the filtered pixel value of the pixel. If only horizontal DBF filtering is performed on a pixel, only the second step is performed to obtain the filtered pixel value of the pixel. The pixel value Y2(i) from the second step is replaced with the original pixel value of the pixel. If vertical DBF filtering is performed on a pixel first and then horizontal DBF filtering is performed, the first and second steps are performed sequentially.

[0228] When the enabling conditions of the normal filtering mode and the enabling conditions of the enhanced filtering mode are met, the DBF filtering method (i.e., the deblocking filtering method) can be used to perform deblocking filtering on the original pixel values ​​of the pixel points, and the filtered pixel values ​​after deblocking filtering can be adjusted. Since the DBF filtering is divided into vertical DBF filtering and horizontal DBF filtering, the following steps can be used to perform deblocking filtering on the original pixel values ​​of the pixel points, and adjust the filtered pixel values ​​after deblocking filtering:

[0229] Step 1: The original pixel value Y1(i) is filtered by vertical DBF to obtain the filtered pixel value Y2(i);

[0230] Step 2: Based on Y2(i)-Y1(i), obtain the adjusted pixel value Y3(i);

[0231] Step 3: The pixel value Y3(i) is filtered by horizontal DBF to obtain the filtered pixel value Y4(i);

[0232] Step 4: Based on Y4(i)-Y3(i), obtain the adjusted pixel value Y5(i).

[0233] For example, if only vertical DBF filtering is performed on a pixel, only steps 1 and 2 are executed to obtain the adjusted pixel value of the pixel. If only horizontal DBF filtering is performed on a pixel, only steps 3 and 4 are executed to obtain the adjusted pixel value of the pixel. The pixel value Y3(i) in step 3 is replaced with the original pixel value of the pixel. If vertical DBF filtering is performed on the pixel first and then horizontal DBF filtering is performed on the pixel, steps 1, 2, 3, and 4 are executed in sequence. If horizontal DBF filtering is performed on the pixel first and then vertical DBF filtering is performed on the pixel, the steps are similar and will not be repeated here.

[0234] Exemplarily, the second and fourth steps are a process of adopting the enhanced filtering mode when the enabling conditions of the enhanced filtering mode are met, that is, a process of adjusting the filtered pixel value to obtain the adjusted pixel value.

[0235] In the second step, suppose Y v (i)=(Y1(i)+Y2(i)+1)>>1, if Y1(i)-Y2(i)>T v , then Y3(i)=Clip(Y v (i)+f0 v ), if Y1(i)-Y2(i)<NT v , then Y3(i)=Clip(Y v (i)+f1 v ), otherwise, Y3(i)=Y`2(i) (In one embodiment, in this case, Y`2(i) can also be filtered to obtain Y3(i), such as Y3(i)=Y`2(i)+f2 v ).

[0236] For example, clip(x) means limiting x to a preset image value range, which can generally be [0, 2 D -1], D is the image bit depth, so for an 8-bit image, the image value range can be [0, 255], and for a 10-bit image, the image value range is [0, 1023]. Threshold NT v Usually set to -T v , or other values.

[0237] Similarly, similar to the process of step 2, in step 4, assume that Y h (i)=(Y3(i)+Y`4(i)+1)>>1, if Y4(i)-Y3(i)>T h , then Y5(i)=Clip(Y h (i)+f0 h ), if Y1(i)-Y2(i)<NT h, then Y5(i)=Clip(y h (i)+f1 h ), otherwise, Y5(i)=Y'4(i) (In one embodiment, in this case, Y'4(i) can also be filtered to obtain Y5(i), such as Y5(i)=Y'4(i)+f2 h ), NT h Usually set to -T h , or other values.

[0238] In the above embodiment, Tv and NTv are filtering thresholds, f0v, f1v, and f2v are filtering offsets, and clip(x) represents limiting x to a preset range of values. For example, Tv is the first and third filtering thresholds mentioned above (taking the first and third filtering thresholds as the same as an example), NTv is the second and fourth filtering thresholds mentioned above (taking the second and fourth filtering thresholds as the same as an example), f0v is the first and third filtering offsets mentioned above (taking the first and third filtering offsets as the same as an example), and f1v is the second and fourth filtering offsets mentioned above (taking the second and fourth filtering offsets as the same as an example). NTv = -Tv, meaning that Tv and NTv are reciprocal numbers.

[0239] In the above embodiment, Th and NTh are filter thresholds, f0h, f1h, and f2h are filter offsets, and clip(x) represents limiting x to a preset value range. For example, Th is the first and third filter thresholds mentioned above (taking the first and third filter thresholds as the same as an example), NTh is the second and fourth filter thresholds mentioned above (taking the second and fourth filter thresholds as the same as an example), f0h is the first and third filter offsets mentioned above (taking the first and third filter offsets as the same as an example), and f1h is the second and fourth filter offsets mentioned above (taking the second and fourth filter offsets as the same as an example). NTh = -Th, that is, Th and NTh are reciprocal numbers.

[0240] Example 9: In DBF, filtering based on only one established criterion may result in filtering or under-filtering. For example, if the reconstructed value before DBF is Y1 and the pixel value after DBF filtering is Y2, classification can be performed based on Y2-Y1. The main advantage of classification based on filtering residuals is that some filtered or pseudo-filtered pixel values ​​can be specially enhanced to achieve the effect that these categories of pixels are closer to the original values. The so-called filtering means that Y2 is much larger than (or much smaller than) Y1, so that Y2 is much larger than (or much smaller than) the original pixel value. The so-called pseudo-filtering means that Y2-Y1 is 0 or close to 0, that is, these pixel values ​​remain unchanged after filtering and the filtering effect is not achieved. In response to the above findings, in this embodiment, the pixel value of the pixel point can be adjusted using the enhanced adjustment mode. That is, if the enhanced adjustment mode is enabled for the current pixel point in the current block, the original pixel value of the pixel point can be adjusted using the enhanced adjustment mode, instead of using the normal filtering mode or the enhanced filtering mode to adjust the original pixel value of the pixel point.

[0241] In a possible implementation, the process of adjusting the original pixel value may include the following steps:

[0242] Step 1: The original pixel value Y1(i) is filtered by vertical DBF to obtain the filtered pixel value Y2(i);

[0243] Step 2: Based on Y2(i)-Y1(i), obtain the adjusted pixel value Y3(i);

[0244] Step 3: The pixel value Y3(i) is filtered by horizontal DBF to obtain the filtered pixel value Y4(i);

[0245] Step 4: Based on Y4(i)-Y3(i), obtain the adjusted pixel value Y5(i).

[0246] In the second step, there are two cases: abs(Y2(i)-Y1(i))<threshold and abs(Y2(i)-Y1(i)) is not less than the threshold. If abs(Y2(i)-Y1(i))<threshold, it can be further divided into the following two cases: BS is 0 and BS is greater than 0. Exemplarily, the threshold may be the first filtering threshold or the second filtering threshold of the above embodiment. For example, the first filtering threshold and the second filtering threshold are reciprocal numbers of each other. If the first filtering threshold is a positive value, the threshold may be the first filtering threshold. If the second filtering threshold is a positive value, the threshold may be the second filtering threshold.

[0247] In summary, the adjustment process of the original pixel value can be divided into the following three cases:

[0248] Case 1: BS is 0. In this case, no filtering is performed (i.e., Y2(i) is equal to Y1(i), which is equivalent to not performing vertical DBF filtering on the original pixel value Y1(i), i.e., the first step is not executed). However, the enhanced adjustment mode can be used to adjust the original pixel value Y1(i) to obtain an adjusted pixel value.

[0249] Case 2: BS is greater than 0, but abs(Y2(i)-Y1(i)) is less than the threshold. In this case, filtering can be performed (i.e., vertical DBF filtering is performed on the original pixel value Y1(i), i.e., the first step is executed). Based on the execution of the first step, the enhanced filtering mode can also be used to adjust the filtered pixel value Y2(i) to obtain the adjusted pixel value Y3(i) of the pixel point.

[0250] Case 3: BS is greater than 0, but abs(Y2(i)-Y1(i)) is not less than the threshold. In this case, filtering can be performed (i.e., vertical DBF filtering is performed on the original pixel value Y1(i), i.e., the first step is executed). Based on the execution of the first step, the enhanced filtering mode is no longer used to adjust the filtered pixel value Y2(i), i.e., the second step is not executed. In other words, Y3(i) = Y`2(i).

[0251] In the fourth step, there are two cases: abs(Y4(i)-Y3(i))<threshold and abs(Y4(i)-Y3(i)) is not less than the threshold. If abs(Y4(i)-Y3(i))<threshold, it can also be divided into the following two cases: BS is 0 and BS is greater than 0.

[0252] In summary, the adjustment process of the original pixel value can be divided into the following three cases:

[0253] Case 1: BS is 0. In this case, no filtering is performed (i.e., Y4(i) is equal to Y3(i), which is equivalent to not performing horizontal DBF filtering on the original pixel value Y3(i), and the third step will not be executed). However, the enhanced adjustment mode can be used to adjust the original pixel value Y3(i) to obtain an adjusted pixel value.

[0254] Case 2: BS is greater than 0, but abs(Y4(i)-Y3(i)) is less than the threshold. In this case, filtering can be performed (i.e., horizontal DBF filtering is performed on the original pixel value Y3(i), i.e., the third step is executed). On the basis of executing the third step, the enhanced filtering mode can also be used to adjust the filtered pixel value Y4(i) of the pixel point to obtain the adjusted pixel value Y5(i) of the pixel point.

[0255] Case 3: BS is greater than 0, but abs(Y4(i)-Y3(i)) is not less than the threshold. In this case, filtering can be performed (i.e., horizontal DBF filtering is performed on the original pixel value Y3(i), i.e., step 3 is executed). Based on step 3, the enhanced filtering mode is no longer used to adjust the filtered pixel value Y4(i), i.e., step 4 is not executed. In other words, Y5(i)=Y4(i).

[0256] In summary, if BS is 0, the enhanced adjustment mode is used for processing, that is, no filtering is required. In other words, Y2(i) = Y1(i), and Y4(i) = Y3(i). On this basis, the enhanced adjustment mode can be used to adjust Y1(i), and the enhanced adjustment mode can be used to adjust Y3(i). Therefore, the following steps can be used for DBF filtering:

[0257] Step 1: The original pixel value Y1(i) is filtered by vertical DBF to obtain the filtered pixel value Y2(i).

[0258] Step 2: If BS is 0, Y1(i) is adjusted using the enhanced adjustment mode to obtain the adjusted pixel value Y3(i). If BS is greater than 0 and abs(Y2(i)-Y1(i)) < the threshold, the enhanced filtering mode is enabled, and the adjusted pixel value Y3(i) is obtained based on Y2(i)-Y1(i), see the second step of Example 8. If BS is greater than 0 and abs(Y2(i)-Y1(i)) is not less than the threshold, the normal filtering mode is enabled, and the filtered pixel value Y2(i) is no longer adjusted, that is, Y3(i) = Y`2(i).

[0259] For example, if BS is 0, the first step is not actually performed, that is, there is no need to obtain the filtered pixel value Y2(i).

[0260] Step 3: The pixel value Y3(i) is filtered by horizontal DBF to obtain the filtered pixel value Y4(i).

[0261] Step 4: If BS is 0, Y3(i) is adjusted using the enhanced adjustment mode to obtain the adjusted pixel value y5(i). If BS is greater than 0 and abs(Y4(i)-Y3(i)) < the threshold, the enhanced filtering mode is enabled, and the adjusted pixel value Y5(i) is obtained based on Y4(i)-Y3(i), see step 4 of Example 8. If BS is greater than 0 and abs(Y4(i)-Y3(i)) is not less than the threshold, the normal filtering mode is enabled, and the filtered pixel value Y4(i) is no longer adjusted, that is, Y5(i) = Y4(i).

[0262] For example, if BS is 0, the third step is not actually performed, that is, it is not necessary to obtain the filtered pixel value Y4(i).

[0263] In another possible implementation, if BS is greater than 0, filtering is performed. However, if abs(Y2(i)-Y1(i)) is less than the threshold after filtering, enhanced filtering mode is used. That is, DBF filtering can be performed using the following steps:

[0264] Step 1: The original pixel value Y1(i) is filtered by vertical DBF to obtain the filtered pixel value Y2(i).

[0265] Step 2: If BS is greater than 0, but after vertical DBF filtering of Y1(i), abs(Y2(i)-Y1(i)) < the threshold, then the adjusted pixel value Y3(i) is obtained by applying the enhancement filtering mode. For example, Y3(i) is obtained by adding the compensation value to Y1(i). Otherwise, if abs(Y2(i)-Y1(i)) is not less than the threshold, then Y3(i) = Y`2(i).

[0266] Step 3: The pixel value Y3(i) is filtered by horizontal DBF to obtain the filtered pixel value Y4(i).

[0267] Step 4: If BS is greater than 0, but after horizontal DBF filtering of Y3(i), abs(Y4(i)-Y3(i)) < the threshold, then the enhanced filtering mode is used to obtain the adjusted pixel value Y5(i). For example, Y5(i) is obtained by adding the compensation value to Y3(i). Otherwise, if abs(Y4(i)-Y3(i)) is not less than the threshold, then Y5(i) = Y4(i).

[0268] Example 10: With respect to Example 9, if BS is 0, Y1(i) is adjusted using the enhanced adjustment mode to obtain the adjusted pixel value Y3(i). The specific adjustment process is described in the following steps. If BS is 0, Y3(i) is adjusted using the enhanced adjustment mode to obtain the adjusted pixel value Y5(i). This process is similar to the process for obtaining the adjusted pixel value Y3(i) and is not further described here.

[0269] First, determine the gradient value of Y1(i). Y1(i) can be the original pixel value of the current pixel or the original pixel value of the reference pixel. For vertical boundaries, the horizontal gradient value DY1(i) of Y1(i) can be calculated; for horizontal boundaries, the vertical gradient value DY1(i) of Y1(i) can be calculated. For example, assuming that pi and qi are the original pixel values ​​of the current pixel and the original pixel values ​​of the reference pixel (corresponding to Y1(i)), respectively, then calculate the gradient value DP0 of the original pixel value pi of the current pixel: DP0 = (pi-qi+2)>>2, and calculate the gradient value DQ0 of the original pixel value qi of the reference pixel: DQ0 = (qi-pi+2)>>2.

[0270] Then, based on the size of DY1(i), compensation adjustment is performed to obtain Y3(i). For example, the adjusted pixel value Pi corresponding to the original pixel value pi of the current pixel point is determined as follows: if DPi>alt_dbr_th, then Pi=clip(pi+alt_dbr_offset0); if DPi<alt_dbr_th, then Pi=clip(pi+alt_dbr_offset1), i is 0, 1, 2, etc. The adjusted pixel value Qi corresponding to the original pixel value qi of the reference pixel point is determined as follows: if DQi>alt_dbr_th, then Qi=clip(qi+alt_dbr_offset0); if DQi<-alt_dbr_th, then Qi=clip(qi+alt_dbr_offset1), i is 0, 1, 2.

[0271] In the above formula, alt_dbr_th represents the first adjustment threshold and the third adjustment threshold (taking the third adjustment threshold and the first adjustment threshold as an example), alt_dbr_offset0 represents the first adjustment offset value and the third adjustment offset value (taking the third adjustment offset value and the first adjustment offset value as an example), alt_dbr_offset1 represents the second adjustment offset value and the fourth adjustment offset value (taking the fourth adjustment offset value and the second adjustment offset value as an example), -alt_dbr_th represents the second adjustment threshold and the fourth adjustment threshold (taking the fourth adjustment threshold and the second adjustment threshold as an example), and -alt_dbr_th and alt_dbr_th are reciprocals of each other.

[0272] Embodiment 11: Enabling the enhanced mode of adjustment is controlled through high-level syntax (e.g., SPS-level high-level syntax). For example, the adbr_enable_flag flag is encoded / decoded in the sequence header. Specifically, the encoder encodes the adbr_enable_flag flag in the sequence header, and the decoder decodes the adbr_enable_flag flag from the sequence header. adbr_enable_flag is a binary variable. A value of '1' indicates that the enhanced mode of adjustment can be used, and a value of '0' indicates that the enhanced mode of adjustment should not be used. The value of AdbrEnableFlag is equal to adbr_enable_flag. If adbr_enable_flag is not present in the bitstream, the value of AdbrEnableFlag is 0.

[0273] To sum up, for the decoding end, the enhanced adjustment mode enable flag (i.e., AdbrEnableFlag) corresponding to the current block can be parsed from the high-level syntax. If the enhanced adjustment mode enable flag is 1, it means that the enhanced adjustment mode enable flag allows the current block to enable the enhanced adjustment mode. If the enhanced adjustment mode enable flag is 0, it means that the enhanced adjustment mode enable flag does not allow the current block to enable the enhanced adjustment mode.

[0274] Embodiment 12: The activation of the enhanced filtering mode and the activation of the enhanced adjustment mode are simultaneously controlled by high-level syntax (such as SPS-level high-level syntax). For example, the encoding / decoding flag dbr_enable_flag is encoded / decoded in the sequence header, that is, the encoder encodes the flag dbr_enable_flag in the sequence header, and the decoder decodes the flag dbr_enable_flag from the sequence header.

[0275] dbr_enable_flag is a binary variable. A value of '1' indicates that the enhanced filtering mode and enhanced adjustment mode are allowed, and a value of '0' indicates that the enhanced filtering mode and enhanced adjustment mode are not allowed. The value of DbrEnableFlag is equal to dbr_enable_flag. If dbr_enable_flag does not exist in the bitstream, the value of DbrEnableFlag is 0.

[0276] To sum up, for the decoding end, the enhanced filtering mode enable flag and enhanced adjustment mode enable flag corresponding to the current block can be parsed from the high-level syntax (that is, DbrEnableFlag, that is, DbrEnableFlag serves as both the enhanced filtering mode enable flag and the enhanced adjustment mode enable flag). If DbrEnableFlag is 1, it means that the current block is allowed to enable the enhanced filtering mode and the enhanced adjustment mode. If DbrEnableFlag is 0, it means that the current block is not allowed to enable the enhanced filtering mode and the enhanced adjustment mode.

[0277] Example 13: A representation of a high-level syntax (such as a picture header high-level syntax) can be seen in Table 1. For example, the syntax shown in Table 1 is encoded / decoded in the picture header. That is, the encoder encodes the syntax shown in Table 1 in the picture header, and the decoder decodes the syntax shown in Table 1 from the picture header.

[0278] Table 1

[0279]

[0280]

[0281] In Table 1, the meanings of the relevant syntax are as follows:

[0282] Picture-level deblocking filter vertical adjustment enable flag picture_dbr_v_enable_flag. picture_dbr_v_enable_flag is a binary variable. A value of '1' indicates that deblocking filter vertical adjustment is allowed for the current picture, and a value of '0' indicates that deblocking filter vertical adjustment is not allowed for the current picture. The value of PictureDbrVEnableFlag is equal to the value of picture_dbr_v_enable_flag. If picture_dbr_v_enable_flag does not exist in the bitstream, the value of PictureDbrVEnableFlag is 0.

[0283] For example, for the enhanced adjustment mode, PictureDbrVEnableFlag corresponds to the enhanced adjustment mode enable flag and is the enhanced adjustment mode enable flag for vertical DBF filtering. That is, when vertical DBF filtering is required, PictureDbrVEnableFlag indicates whether the enhanced adjustment mode is enabled or not.

[0284] For example, for the enhanced filtering mode, PictureDbrVEnableFlag corresponds to the enhanced filtering mode enable flag and is the enhanced filtering mode enable flag for vertical DBF filtering. That is, when vertical DBF filtering is required, PictureDbrVEnableFlag indicates whether the enhanced filtering mode is enabled or not.

[0285] To sum up, PictureDbrVEnableFlag can represent the enhanced adjustment mode enable flag for vertical DBF filtering and the enhanced filtering mode enable flag for vertical DBF filtering, that is, the enhanced adjustment mode enable flag and the enhanced filtering mode enable flag share the same flag, that is, the current image allows the enhanced adjustment mode and the enhanced filtering mode to be enabled at the same time, or the current image does not allow the enhanced adjustment mode and the enhanced filtering mode to be enabled at the same time.

[0286] Deblocking filter vertical adjustment threshold dbr_v_threshold_minus1, dbr_v_threshold_minus1 is used to determine the threshold for vertical adjustment of the deblocking filter of the current image, and the value range is 0-1. The value of DbrVThreshold is equal to the value of dbr_v_threshold_minus1 plus 1. If dbr_v_threshold_minus1 does not exist in the bitstream, the value of DbrVThreshold is 0.

[0287] For example, in enhanced adjustment mode, DbrVThreshold corresponds to the first adjustment threshold (assuming the third adjustment threshold is the same as the first adjustment threshold) and is the first adjustment threshold for vertical DBF filtering. That is, when vertical DBF filtering is required, DbrVThreshold represents the first adjustment threshold in the above embodiment. Furthermore, the second adjustment threshold in the above embodiment (assuming the fourth adjustment threshold is the same as the second adjustment threshold) is the reciprocal of the first adjustment threshold. Therefore, the second adjustment threshold can also be determined based on DbrVThreshold.

[0288] For example, in enhanced filtering mode, DbrVThreshold corresponds to the first filtering threshold (assuming the third filtering threshold is the same as the first filtering threshold) and is the first filtering threshold for vertical DBF filtering. That is, when vertical DBF filtering is required, DbrVThreshold represents the first filtering threshold in the above embodiment. Furthermore, the second filtering threshold in the above embodiment (assuming the fourth filtering threshold is the same as the second filtering threshold) is the reciprocal of the first filtering threshold. Therefore, the second filtering threshold can also be determined based on DbrVThreshold.

[0289] In summary, DbrVThreshold may represent the first adjustment threshold and the first filtering threshold for vertical DBF filtering. That is, the first adjustment threshold and the first filtering threshold are the same and have the same value.

[0290] Deblocking filter vertical adjustment offset 0 (dbr_v_offset0_minus1) is used to determine the deblocking filter vertical adjustment offset 0 of the current image. The value range is 0-3. The value of DbrVOffset0 is equal to the negative of the value of dbr_v_offset0_minus1 plus 1. If dbr_v_offset0_minus1 does not exist in the bitstream, the value of DbrVOffset0 is 0.

[0291] Exemplarily, for the enhanced filtering mode, DbrVOffset0 corresponds to the first filtering offset value (taking the third filtering offset value as the same as the first filtering offset value as an example), which is the first filtering offset value for vertical DBF filtering, that is, when vertical DBF filtering is required, DbrVOffset0 represents the first filtering offset value of the above embodiment.

[0292] Deblocking filter vertical adjustment offset value 1 (dbr_v_offset1_minus1) is used to determine the deblocking filter vertical adjustment offset value 1 of the current image. The value range is 0-3. The value of DbrVOffset1 is equal to the value of dbr_v_offset1_minus1 plus 1. If dbr_v_offset1_minus1 does not exist in the bitstream, the value of DbrVOffset1 is 0.

[0293] Exemplarily, for the enhanced filtering mode, DbrVOffset1 corresponds to the second filter offset value (taking the fourth filter offset value as the same as the second filter offset value as an example), which is the second filter offset value for vertical DBF filtering, that is, when vertical DBF filtering is required, DbrVOffset1 represents the second filter offset value of the above embodiment.

[0294] Enhanced deblocking filter vertical adjustment offset value 0 (dbr_v_alt_offset0_minus1), dbr_v_alt_offset0_minus1 is used to determine the vertical adjustment offset value 0 when the deblocking filter BS of the current image is 0. The value range of dbr_v_alt_offset0_minus1 can be 0-3. The value of DbrVAltOffset0 can be equal to the negative value of the value of dbr_v_alt_offset0_minus1 plus 1 and then taken the opposite. If dbr_v_alt_offset0_minus1 does not exist in the bitstream, the value of DbrVAltOffset0 is 0.

[0295] Exemplarily, for the enhanced adjustment mode, DbrVAltOffset0 corresponds to the first adjustment offset value (taking the third adjustment offset value as the same as the first adjustment offset value as an example), which is the first adjustment offset value for vertical DBF filtering, that is, when performing vertical DBF filtering, DbrVAltOffset0 represents the first adjustment offset value of the above embodiment.

[0296] Enhanced deblocking filter vertical adjustment offset value 1 (dbr_v_alt_offset1_minus1), dbr_v_alt_offset1_minus1 is used to determine the vertical adjustment offset value 1 when the deblocking filter BS of the current image is 0. The value range of dbr_v_alt_offset1_minus1 can be 0-3. The value of DbrVAltOffset1 is equal to the value of dbr_v_alt_offset1_minus1 plus 1. If dbr_v_alt_offset1_minus1 does not exist in the bitstream, the value of DbrVAltOffset1 is 0.

[0297] Exemplarily, for the enhanced adjustment mode, DbrVAltOffset1 corresponds to the second adjustment offset value (taking the fourth adjustment offset value as the same as the second adjustment offset value as an example), which is the second adjustment offset value for vertical DBF filtering, that is, when performing vertical DBF filtering, DbrVAltOffset1 represents the second adjustment offset value of the above embodiment.

[0298] Picture-level deblocking filter level adjustment enable flag picture_dbr_h_enable_flag. picture_dbr_h_enable_flag is a binary variable. A value of '1' indicates that deblocking filter level adjustment is allowed for the current picture, and a value of '0' indicates that deblocking filter level adjustment is not allowed for the current picture. The value of PhDbrHEnableFlag is equal to the value of picture_dbr_h_enable_flag. If picture_dbr_h_enable_flag does not exist in the bitstream, the value of PhDbrHEnableFlag is 0.

[0299] For example, for the enhanced adjustment mode, PhDbrHEnableFlag corresponds to the enhanced adjustment mode enable flag and is the enhanced adjustment mode enable flag for horizontal DBF filtering. That is, when horizontal DBF filtering is required, PhDbrHEnableFlag indicates whether the enhanced adjustment mode is enabled or not.

[0300] For example, for the enhanced filtering mode, PhDbrHEnableFlag corresponds to the enhanced filtering mode enable flag and is the enhanced filtering mode enable flag for horizontal DBF filtering. That is, when horizontal DBF filtering is required, PhDbrHEnableFlag indicates whether the enhanced filtering mode is enabled or not.

[0301] To sum up, PhDbrHEnableFlag can represent the enhanced adjustment mode enable flag for horizontal DBF filtering and the enhanced filtering mode enable flag for horizontal DBF filtering, that is, the enhanced adjustment mode enable flag and the enhanced filtering mode enable flag share the same flag, that is, the current image allows the enhanced adjustment mode and the enhanced filtering mode to be enabled at the same time, or the current image does not allow the enhanced adjustment mode and the enhanced filtering mode to be enabled at the same time.

[0302] The deblocking filter level adjustment threshold dbr_h_threshold_minus1 is used to determine the threshold for deblocking filter level adjustment of the current image, and its value range is 0 to 1. The value of DbrHThreshold is equal to the value of dbr_h_threshold_minus1 plus 1. If dbr_h_threshold_minus1 does not exist in the bitstream, the value of DbrHThreshold is 0.

[0303] For example, in enhanced adjustment mode, DbrHThreshold corresponds to the first adjustment threshold (assuming the third adjustment threshold is the same as the first adjustment threshold) and is the first adjustment threshold for horizontal DBF filtering. That is, when horizontal DBF filtering is required, DbrHThreshold represents the first adjustment threshold in the above embodiment. Furthermore, the second adjustment threshold in the above embodiment (assuming the fourth adjustment threshold is the same as the second adjustment threshold) is the reciprocal of the first adjustment threshold. Therefore, the second adjustment threshold can also be determined based on DbrHThreshold.

[0304] For example, in enhanced filtering mode, DbrHThreshold corresponds to the first filtering threshold (assuming the third filtering threshold is the same as the first filtering threshold) and is the first filtering threshold for horizontal DBF filtering. That is, when horizontal DBF filtering is required, DbrHThreshold represents the first filtering threshold in the above embodiment. Furthermore, the second filtering threshold in the above embodiment (assuming the fourth filtering threshold is the same as the second filtering threshold) is the reciprocal of the first filtering threshold. Therefore, the second filtering threshold can also be determined based on DbrHThreshold.

[0305] In summary, DbrHThreshold may represent the first adjustment threshold and the first filtering threshold for horizontal DBF filtering. That is, the first adjustment threshold and the first filtering threshold are the same and have the same value.

[0306] Deblocking filter horizontal adjustment offset 0 (dbr_h_offset0_minus1) is used to determine the deblocking filter horizontal adjustment offset 0 for the current image. The value range is 0-3. The value of DbrHOffset0 is equal to the negative of the value of dbr_h_offset0_minus1 plus 1. If dbr_h_offset0_minus1 does not exist in the bitstream, the value of DbrHOffset0 is 0.

[0307] Exemplarily, for the enhanced filtering mode, DbrHOffset0 corresponds to the first filtering offset value (taking the third filtering offset value as the same as the first filtering offset value as an example), which is the first filtering offset value for horizontal DBF filtering, that is, when horizontal DBF filtering is required, DbrHOffset0 represents the first filtering offset value of the above embodiment.

[0308] Deblocking filter horizontal adjustment offset value 1 (dbr_h_offset1_minus1) is used to determine the deblocking filter horizontal adjustment offset value 1 of the current image. The value range is 0-3. The value of DbrHOffset1 is equal to the value of dbr_h_offset1_minus1 plus 1. If dbr_h_offset1_minus1 does not exist in the bitstream, the value of DbrHOffset1 is 0.

[0309] Exemplarily, for the enhanced filtering mode, DbrHOffset1 corresponds to the second filter offset value (taking the fourth filter offset value as the same as the second filter offset value as an example), which is the second filter offset value for horizontal DBF filtering, that is, when horizontal DBF filtering is required, DbrHOffset1 represents the second filter offset value of the above embodiment.

[0310] Enhanced deblocking filter horizontal adjustment offset value 0 (dbr_h_alt_offset0_minus1), dbr_h_alt_offset0_minus1 is used to determine the horizontal adjustment offset value 0 when the deblocking filter BS of the current image is 0. The value of dbr_h_alt_offset0_minus1 can range from 0 to 3. The value of DbrHAltOffset0 can be equal to the negative value of dbr_h_alt_offset0_minus1 plus 1 and then taking the opposite value. If dbr_h_alt_offset0_minus1 does not exist in the bitstream, the value of DbrHAltOffset0 is 0.

[0311] Exemplarily, for the enhanced adjustment mode, DbrHAltOffset0 corresponds to the first adjustment offset value (taking the third adjustment offset value as the same as the first adjustment offset value as an example), which is the first adjustment offset value for horizontal DBF filtering, that is, when performing horizontal DBF filtering, DbrHAltOffset0 represents the first adjustment offset value of the above embodiment.

[0312] Enhanced deblocking filter horizontal adjustment offset value 1 (dbr_h_alt_offset1_minus1), dbr_h_alt_offset1_minus1 is used to determine the horizontal adjustment offset value 1 when the deblocking filter BS of the current image is 0. The value of dbr_h_alt_offset1_minus1 can range from 0 to 3. The value of DbrHAltOffset1 is equal to the value of dbr_h_alt_offset1_minus1 plus 1. If dbr_h_alt_offset1_minus1 does not exist in the bitstream, the value of DbrHAltOffset1 is 0.

[0313] Exemplarily, for the enhanced adjustment mode, DbrHAltOffset1 corresponds to the second adjustment offset value (taking the fourth adjustment offset value and the second adjustment offset value as an example), which is the second adjustment offset value for horizontal DBF filtering, that is, when performing horizontal DBF filtering, DbrHAltOffset1 represents the second adjustment offset value of the above embodiment.

[0314] Example 14: A representation of a high-level syntax (such as a picture header high-level syntax) can be seen in Table 2. For example, the syntax shown in Table 2 is encoded / decoded in the picture header. That is, the encoder encodes the syntax shown in Table 2 in the picture header, and the decoder decodes the syntax shown in Table 2 from the picture header.

[0315] Table 2

[0316]

[0317] In Table 2, the meanings of the relevant syntax are as follows:

[0318] The picture-level enhanced vertical adjustment enable flag, picture_alt_dbr_v_enable_flag, is a binary variable. A value of '1' indicates that enhanced vertical adjustment is enabled for the current picture, and a value of '0' indicates that enhanced vertical adjustment is not enabled for the current picture. The value of PictureAltDbrVEnableFlag can be equal to the value of picture_alt_dbr_v_enable_flag. If picture_alt_dbr_v_enable_flag is not present in the bitstream, the value of PhAltDbrVEnableFlag is 0.

[0319] For example, for the enhanced adjustment mode, PictureAltDbrVEnableFlag corresponds to the enhanced adjustment mode enable flag, which is the enhanced adjustment mode enable flag for vertical DBF filtering. That is, when vertical DBF filtering is required, PictureAltDbrVEnableFlag indicates whether the enhanced adjustment mode is allowed to be enabled, or whether the enhanced adjustment mode is not allowed to be enabled.

[0320] Different from the PictureDbrVEnableFlag in Example 13, the PictureAltDbrVEnableFlag is only a flag bit for enabling the enhanced adjustment mode of vertical DBF filtering, rather than a flag bit for enabling the enhanced filtering mode of vertical DBF filtering.

[0321] The picture-level enhanced level adjustment enable flag, picture_alt_dbr_h_enable_flag, is a binary variable. A value of '1' indicates that enhanced level adjustment is enabled for the current picture, and a value of '0' indicates that enhanced level adjustment is not enabled for the current picture. The value of PictureAltDbrHEnableFlag can be equal to the value of picture_alt_dbr_h_enable_flag. If picture_alt_dbr_h_enable_flag does not exist in the bitstream, the value of PictureAltDbrHEnableFlag is 0.

[0322] Exemplarily, for the enhanced adjustment mode, PhAltDbrHEnableFlag corresponds to the enhanced adjustment mode enable flag, which is the enhanced adjustment mode enable flag for horizontal DBF filtering. That is, when horizontal DBF filtering is required, PhAltDbrHEnableFlag indicates whether the enhanced adjustment mode is allowed to be enabled, or whether the enhanced adjustment mode is not allowed to be enabled.

[0323] Different from the PictureDbrHEnableFlag in Example 13, PhAltDbrHEnableFlag is only an enhancement adjustment mode enable flag for horizontal DBF filtering, rather than an enhancement filtering mode enable flag for horizontal DBF filtering.

[0324] The meanings of other grammars in Table 2 are the same as those in Table 1 and will not be repeated here.

[0325] Embodiment 15: With respect to Embodiment 11, encoding and decoding of adbr_enable_flag can be performed only when the deblocking filter mode is enabled. That is, it can be determined first whether the deblocking filter mode is enabled. If so, the adbr_enable_flag flag is encoded / decoded in the sequence header; if not, the adbr_enable_flag flag is not encoded / decoded in the sequence header. In summary, the enhanced adjustment mode (adbr_enable_flag is used to control the activation of the enhanced adjustment mode) is a submode of the deblocking filter mode and can be enabled only when the deblocking filter mode is enabled.

[0326] For Example 12, the encoding and decoding of dbr_enable_flag can be performed only when the deblocking filter mode is enabled. That is, it can be determined first whether the deblocking filter mode is enabled. If so, the encoding / decoding flag dbr_enable_flag is set in the sequence header. If not, the encoding / decoding flag dbr_enable_flag is not set in the sequence header. In summary, the enhanced filtering mode (dbr_enable_flag is used to control the enabling of the enhanced filtering mode) is a sub-mode of the deblocking filter mode, and the enhanced filtering mode is allowed to be enabled only when the deblocking filter mode is enabled.

[0327] For Example 13, the encoding and decoding of the high-level syntax shown in Table 1 (used to control the activation of the enhancement filtering mode and the activation of the enhancement adjustment mode) can be performed only when the deblocking filtering mode is enabled. That is, it can be determined first whether the deblocking filtering mode is enabled. If so, the high-level syntax shown in Table 1 will be encoded / decoded in the image header. If not, the high-level syntax shown in Table 1 will not be encoded / decoded in the image header.

[0328] For Example 14, the encoding and decoding of the high-level syntax shown in Table 2 (used to control the activation of the enhancement filtering mode and the activation of the enhancement adjustment mode) can be performed only when the deblocking filtering mode is enabled. That is, it can be determined first whether the deblocking filtering mode is enabled. If so, the high-level syntax shown in Table 2 will be encoded / decoded in the image header. If not, the high-level syntax shown in Table 2 will not be encoded / decoded in the image header.

[0329] Embodiment 16: For the deblocking filtering process of the luminance component (ie, the current block is the luminance component), for example, the luminance component is adjusted using the enhanced adjustment mode, or the luminance component is adjusted using the enhanced filtering mode.

[0330] Derivation process of DBR parameters of luminance component:

[0331] If the current boundary to be filtered is a vertical boundary and the value of PictureDbrVEnableFlag is 1, or if the current boundary to be filtered is a horizontal boundary and the value of PictureDbrHEnableFlag is 1, the value of PictureDbrEnableFlag is 1; otherwise, PictureDbrEnableFlag is 0. Also, if the current boundary to be filtered is a vertical boundary and the value of PictureAltDbrVEnableFlag is 1, or if the current boundary to be filtered is a horizontal boundary and the value of PictureAltDbrHEnableFlag is 1, the value of PictureAltDbrEnableFlag is 1; otherwise, PictureAltDbrEnableFlag is 0.

[0332] Derive dbr_th, dbr_offset0, dbr_offset1, alt_dbr_offset0, and alt_dbr_offset1 as follows:

[0333] For vertical boundaries, dbr_th=DbrVThreshold, dbr_offset0=DbrVOffset0, dbr_offset1=DbrVOffset1, alt_dbr_offset0=DbrVAltOffset0, alt_dbr_offset1=DbrVAltOffset1.

[0334] For the horizontal boundary, dbr_th=DbrHThreshold, dbr_offset0=DbrHOffset0, dbr_offset1=DbrHOffset1, alt_dbr_offset0=DbrHAltOffset0, alt_dbr_offset1=DbrHAltOffset1.

[0335] (1) Boundary filtering process when the BS of the luminance component is equal to 4 (processed using enhanced filtering mode):

[0336] When the BS value is 4, the filtering calculation process for p0, p1, p2 and q0, q1, q2 is as follows:

[0337] P0=(p2*3+p1*8+p0*10+q0*8+q1*3+16)>>5;

[0338] P1=(p2*4+p1*5+p0*4+q0*3+8)>>4;

[0339] P2 = (p3 * 2 + p2 * 2 + p1 * 2 + p0 * 1 + q0 * 1 + 4) >> 3;

[0340] Q0 = (p1 * 3 + p0 * 8 + q0 * 10 + q1 * 8 + q2 × 3 + 16) >> 5

[0341] Q1 = (p0 * 3 + q0 * 4 + q1 * 5 + q2 * 4 + 8) >> 4;

[0342] Q2 = (p0 * 1 + q0 * 1 + q1 * 2 + q2 * 2 + q3 * 2 + 4) >> 3.

[0343] P0, P1, P2 and Q0, Q1, Q2 are all the values after filtering (i.e., filtered pixel values).

[0344] After obtaining P0, P1, P2 and Q0, Q1, Q2, if PhDbrEnableFlag is 1, then:

[0345] If pi > Pi + dbr_th, then Pi' = clip((Pi + pi + 1) >> 1 + dbr_offset0); otherwise, if pi < Pi – dbr_th, then Pi' = clip((Pi + pi + 1) >> 1 + dbr_offset1), where i = 0, 1, 2.

[0346] If qi > Qi + dbr_th, then Qi' = clip((Qi + qi + 1) >> 1 + dbr_offset0); otherwise, if qi < Qi – dbr_th, then Qi' = clip((Qi + qi + 1) >> 1 + dbr_offset1), where i = 0, 1, 2.

[0347] In the above formulas, pi can represent the original pixel value, qi can represent the original pixel value, Pi can represent the filtered pixel value, Qi can represent the filtered pixel value, Pi' can represent the adjusted pixel value, and Qi' can represent the adjusted pixel value.

[0348] (2) Boundary filtering process when the BS of the luminance component is equal to 3 (processed in enhanced filtering mode):

[0349] When the value of BS is 3, the filtering calculation process for p0, p1 and q0, q1 is as follows:

[0350] P0 = (p2 + (p1 << 2) + (p0 << 2) + (p0 << 1) + (q0 << 2) + q1 + 8) >> 4;

[0351] P1 = ((p2 << 1) + p2 + (p1 << 3) + (p0 << 2) + q0 + 8) >> 4;

[0352] Q0 = (p1 + (p0 << 2) + (q0 << 2) + (q0 << 1) + (q1 << 2) + q2 + 8) >> 4;

[0353] Q1 = ((q2 << 1) + q2 + (q1 << 3) + (q0 << 2) + p0 + 8) >> 4;

[0354] P0, P1 and Q0, Q1 are all the values after filtering (i.e., filtered pixel values).

[0355] After obtaining P0, P1 and Q0, Q1, if PhDbrEnableFlag is 1, then:

[0356] If pi > Pi + dbr_th, then Pi' = clip((Pi + pi + 1) >> 1 + dbr_offset0); otherwise, if pi < Pi - dbr_th, then Pi' = clip((Pi + pi + 1) >> 1 + dbr_offset1), where i = 0, 1.

[0357] If qi > Qi + dbr_th, then Qi' = clip((Qi + qi + 1) >> 1 + dbr_offset0); otherwise, if qi < Qi - dbr_th, then Qi' = clip((Qi + qi + 1) >> 1 + dbr_offset1), where i = 0, 1.

[0358] In the above formulas, pi can represent the original pixel value, qi can represent the original pixel value, Pi can represent the filtered pixel value, Qi can represent the filtered pixel value, Pi' can represent the adjusted pixel value, and Qi' can represent the adjusted pixel value.

[0359] (3) Boundary filtering process when the BS of the luminance component is equal to 2 (processed in the enhanced filtering mode):

[0360] When the value of BS is 2, the filtering calculation process for p0 and q0 is as follows:

[0361] P0 = ((p1 << 1) + p1 + (p0 << 3) + (p0 << 1) + (q0 << 1) + q0 + 8) >> 4;

[0362] Q0 = ((p0 << 1) + p0 + (q0 << 3) + (q0 << 1) + (q1 << 1) + q1 + 8) >> 4;

[0363] P0 and Q0 are both the values after filtering (i.e., filtered pixel values).

[0364] After obtaining P0 and Q0, if the PhDbrEnableFlag is 1, then:

[0365] If pi > Pi + dbr_th, then Pi’ = clip((Pi + pi + 1) >> 1 + dbr_offset0); otherwise, if pi < Pi – dbr_th, then Pi’ = clip((Pi + pi + 1) >> 1 + dbr_offset1), where i = 0.

[0366] If qi > Qi + dbr_th, then Qi’ = clip((Qi + qi + 1) >> 1 + dbr_offset0); otherwise, if qi < Qi – dbr_th, then Qi’ = clip((Qi + qi + 1) >> 1 + dbr_offset1), where i = 0.

[0367] In the above formulas, pi can represent the original pixel value, qi can represent the original pixel value, Pi can represent the filtered pixel value, Qi can represent the filtered pixel value, Pi’ can represent the adjusted pixel value, and Qi’ can represent the adjusted pixel value.

[0368] (4) Boundary filtering process when the BS of the luminance component is equal to 1 (processed in the enhanced filtering mode):

[0369] When the value of BS is 1, the filtering calculation process for p0 and q0 is as follows:

[0370] P0 = ((p0 << 1) + p0 + q0 + 2) >> 2;

[0371] Q0 = ((q0 << 1) + q0 + p0 + 2) >> 2.

[0372] Both P0 and Q0 are the filtered values (i.e., the filtered pixel values).

[0373] After obtaining P0 and Q0, if the PhDbrEnableFlag is 1, then:

[0374] If pi > Pi + dbr_th, then Pi’ = clip((Pi + pi + 1) >> 1 + dbr_offset0); otherwise, if pi < Pi – dbr_th, then Pi’ = clip((Pi + pi + 1) >> 1 + dbr_offset1), where i = 0.

[0375] If qi > Qi + dbr_th, then Qi’ = clip((Qi + qi + 1) >> 1 + dbr_offset0); otherwise, if qi < Qi – dbr_th, then Qi’ = clip((Qi + qi + 1) >> 1 + dbr_offset1), where i = 0.

[0376] In the above formula, pi may represent an original pixel value, qi may represent an original pixel value, Pi may represent a filtered pixel value, Qi may represent a filtered pixel value, Pi' may represent an adjusted pixel value, and Qi' may represent an adjusted pixel value.

[0377] (5) Mode 1 of the boundary filtering process when the BS of the luminance component is equal to 0 (processing using the enhanced adjustment mode):

[0378] When the value of BS is 0, the filtering calculation process for pi and qi is as follows:

[0379] Determine the gradient value DPi of pi and the gradient value DQi of qi. For example, DPi = (pi - qi + 2) >> 2, DQi = (qi - pi + 2) >> 2. Alternatively, DPi = (pi - qi + 1) >> 1, DQi = (qi - pi + 1) >> 1.

[0380] After obtaining DPi and DQi, if PhAltDbrEnableFlag is 1, then:

[0381] If DPi>dbr_th, then Pi=clip(pi+alt_dbr_offset0); otherwise, if DPi<–dbr_th, then Pi=clip(pi+alt_dbr_offset1);

[0382] If DQi>dbr_th, then Qi=clip(qi+alt_dbr_offset0); otherwise, if DQi<–dbr_th, then Qi=clip(qi+alt_dbr_offset1).

[0383] The above i can be 0, or 0, 1, 2, etc., and there is no limitation on this.

[0384] In the above formula, pi may represent the original pixel value, qi may represent the original pixel value, DPi may represent the gradient value, DQi may represent the gradient value, Pi may represent the adjusted pixel value, and Qi may represent the adjusted pixel value.

[0385] (6) Mode 2 of the boundary filtering process when the BS of the luminance component is equal to 0 (processing using the enhanced adjustment mode):

[0386] When the value of BS is 0, the filtering calculation process for pi and qi is as follows:

[0387] Determine the gradient value DPi of pi and the gradient value DQi of qi, such as DPi = (pi - qi + 1)>>1, DQi = (qi - pi + 1)>>1.

[0388] After obtaining DPi and DQi, if PhAltDbrEnableFlag is 1, then:

[0389] If DPi > 2 * dbr_th, then Pi = clip(pi + alt_dbr_offset0); otherwise, if DPi < -2 * dbr_th, then Pi = clip(pi + alt_dbr_offset1);

[0390] If DQi > 2 * dbr_th, then Qi = clip(qi + alt_dbr_offset0); otherwise, if DQi < -2 * dbr_th, then Qi = clip(qi + alt_dbr_offset1).

[0391] The above 2 * dbr_th and -2 * dbr_th can be the adjustment thresholds in the above embodiments.

[0392] The above i can be 0, or can be 0, 1, 2, etc., and there is no limit to this.

[0393] In the above formula, pi can represent the original pixel value, qi can represent the original pixel value, DPi can represent the gradient value, DQi can represent the gradient value, Pi can represent the adjusted pixel value, and Qi can represent the adjusted pixel value.

[0394] (7) Method 3 of the boundary filtering process when the BS of the luminance component is equal to 0 (processing using the enhanced adjustment mode):

[0395] When the value of BS is 0, the filtering calculation process for pi and qi is as follows:

[0396] Determine the gradient value DPi of pi and the gradient value DQi of qi. For example, the gradient value DPi and the gradient value DQi can be determined in the following way: DPi = ((pi << 1) + pi + qi + 2) >> 2, DQi = ((qi << 1) + qi + pi + 2) >> 2.

[0397] After obtaining DPi and DQi, if PhAltDbrEnableFlag is 1, then:

[0398] [[ID=3l]]If pi > DPi + dbr_th, then Pi = clip(pi + alt_dbr_offset0); otherwise, if pi < DPi - dbr_th, then Pi = clip(pi + alt_dbr_offset1);

[0399] If qi > DQi + dbr_th, then Qi = clip(qi + alt_dbr_offset0); otherwise, if qi < DQi – dbr_th, then Qi = clip(qi + alt_dbr_offset1).

[0400] In a possible implementation, the above expression can be equivalently expressed as follows:

[0401] Determine the gradient value DPi of pi and the gradient value DQi of qi. For example, the gradient values DPi and DQi can be determined in the following way: DPi = pi – (((pi << 1) + pi + qi + 2) >> 2), DQi = qi - (((qi << 1) + qi + pi + 2) >> 2).

[0402] After obtaining DPi and DQi, if PhAltDbrEnableFlag is 1, then:

[0403] If DPi > dbr_th, then Pi = clip(pi + alt_dbr_offset0); otherwise, if DPi < –dbr_th, then Pi = clip(pi + alt_dbr_offset1);

[0404] If DQi > dbr_th, then Qi = clip(qi + alt_dbr_offset0); otherwise, if DQi < –dbr_th, then Qi = clip(qi + alt_dbr_offset1).

[0405] The above i can be 0, or it can be 0, 1, 2, etc., and there is no limit to this.

[0406] In the above formula, pi can represent the original pixel value, qi can represent the original pixel value, DPi can represent the gradient value, DQi can represent the gradient value, Pi can represent the adjusted pixel value, and Qi can represent the adjusted pixel value.

[0407] In the above embodiment, clip(x) means restricting x within [0, 2^(bit_depth) - 1] (this interval can include 0 and 2^(bit_depth) - 1). bit_depth represents the bit depth of the image, generally 8, 10, 12, etc.

[0408] (8) Method 4 of the boundary filtering process when the BS of the luminance component is equal to 0 (processing采用增强调整模式进行处理):

[0409] When the value of BS is 0, the filtering calculation process for pi and qi is as follows: [[ID=,32]]

[0410] Determine the gradient value DPi of pi and the gradient value DQi of qi. For example, the gradient values DPi and DQi can be determined in the following way: DPi = (qi - pi + 2) >> 2, DQi = (pi - qi + 2) >> 2.

[0411] After obtaining DPi and DQi, if PhAltDbrEnableFlag is 1, then:

[0412] If DPi < dbr_th, then Pi = clip(pi + dbr_alt_offset0); otherwise, if DPi > -dbr_th, then Pi = clip(pi + dbr_alt_offset1).

[0413] If DQi < dbr_th, then Qi = clip(qi + alt_dbr_offset0); otherwise, if DQi > -dbr_th, then Qi = clip(qi + dbr_alt_offset1).

[0414] The above i can be 0, or it can be 0, 1, 2, etc., and there is no restriction on this.

[0415] In the above formulas, pi can represent the original pixel value, qi can represent the original pixel value, DPi can represent the gradient value, DQi can represent the gradient value, Pi can represent the adjusted pixel value, and Qi can represent the adjusted pixel value.

[0416] (9) Method 5 of the boundary filtering process when the BS of the luminance component is equal to 0 (processing in the enhanced adjustment mode):

[0417] When the value of BS is 0, the filtering calculation process for pi and qi is as follows:

[0418] Determine the gradient value DPi of pi and the gradient value DQi of qi. For example, the gradient values DPi and DQi can be determined in the following way: DPi = pi - (((pi << 1) + pi + qi + 2) >> 2), that is, DPi = (pi - qi - 2) >> 2, DQi = qi - (((qi << 1) + qi + pi + 2) >> 2), that is, DQi = (qi - pi - 2) >> 2.

[0419] After obtaining DPi and DQi, if PhAltDbrEnableFlag is 1, then:

[0420] If DPi > dbr_th, then Pi = clip(pi + dbr_alt_offset0); otherwise, if DPi < -dbr_th, then Pi = clip(pi + dbr_alt_offset1).

[0421] If DQi>dbr_th, then Qi=clip(qi+dbr_alt_offset0); otherwise, if DQi<–dbr_th, then Qi=clip(qi+dbr_alt_offset1).

[0422] The above i can be 0, or 0, 1, 2, etc., and there is no limitation on this.

[0423] In the above formula, pi may represent the original pixel value, qi may represent the original pixel value, DPi may represent the gradient value, DQi may represent the gradient value, Pi may represent the adjusted pixel value, and Qi may represent the adjusted pixel value.

[0424] Example 17: For Example 11 and Example 12, the SPS-level high-level syntax can be replaced with the PPS-level high-level syntax, or the picture header-level high-level syntax, or the frame-level high-level syntax, or the slice header-level high-level syntax, or the CTU-level high-level syntax, or the CU-level high-level syntax. There is no restriction on the type of this high-level syntax, that is, the dbr_enable_flag or adbr_enable_flag can be transmitted through various types of high-level syntax. For Example 13 and Example 14, the image header high-level syntax can be replaced with SPS-level high-level syntax, or PPS-level high-level syntax, or frame-level high-level syntax, or slice header-level high-level syntax, or CTU-level high-level syntax, or CU-level high-level syntax. There is no restriction on the type of this high-level syntax, that is, the contents of Table 1 or Table 2 can be transmitted through various types of high-level syntax, that is, the enhanced adjustment mode enable flag, enhanced filtering mode enable flag, first adjustment threshold, first filtering threshold, first filtering offset value, second filtering offset value, first adjustment offset value, second adjustment offset value and other parameters are transmitted through various types of high-level syntax. The specific implementation method is similar to the implementation method of Example 13 and Example 14, and will not be repeated here.

[0425] For Example 13 and Example 14, the image header high-level syntax may be replaced with a CTU-level high-level syntax, and the DBR-related parameters may be transmitted via the CTU-level high-level syntax. The DBR-related parameters may include parameters such as a first adjustment threshold, a first filtering threshold, a first filtering offset value, a second filtering offset value, a first adjustment offset value, and a second adjustment offset value. See Example 13 and Example 14. Alternatively, the image header high-level syntax may be replaced with a CU-level high-level syntax, and the DBR-related parameters may be transmitted via the CU-level high-level syntax. The DBR-related parameters may include parameters such as a first adjustment threshold, a first filtering threshold, a first filtering offset value, a second filtering offset value, a first adjustment offset value, and a second adjustment offset value. See Example 13 and Example 14.

[0426] Example 18: For Example 16, this is a deblocking filtering process for the luminance component. The luminance component can also be replaced by the chrominance component, that is, the deblocking filtering process is performed on the chrominance component (that is, the current block is the chrominance component). The deblocking filtering process of the chrominance component is similar to the deblocking filtering process of the luminance component. See Example 16, which will not be repeated here.

[0427] For example, the above-mentioned embodiments 1 to 18 can be implemented separately or in any combination, such as embodiment 1 and embodiment 2 can be combined, embodiment 1 and embodiment 3 can be combined, embodiment 1 and embodiment 4 can be combined, embodiment 1 and embodiment 5 can be combined, embodiment 1 and at least one embodiment from embodiment 8 to embodiment 18 can be combined; at least two embodiments from embodiment 8 to embodiment 18 can be combined in any combination; embodiment 2 and at least one embodiment from embodiment 8 to embodiment 18 can be combined; embodiment 3 and at least one embodiment from embodiment 8 to embodiment 18 can be combined; embodiment 4 and at least one embodiment from embodiment 8 to embodiment 18 can be combined; embodiment 5 and at least one embodiment from embodiment 8 to embodiment 18 can be combined; embodiment 6 and at least one embodiment from embodiment 8 to embodiment 18 can be combined; embodiment 7 and at least one embodiment from embodiment 8 to embodiment 18 can be combined. Of course, the above are just a few examples of combinations, and any at least two embodiments between embodiment 1 to embodiment 18 can be combined to implement the relevant process.

[0428] Illustratively, in the above embodiments, the content of the encoding end can also be applied to the decoding end, that is, the decoding end can be processed in the same way, and the content of the decoding end can also be applied to the encoding end, that is, the encoding end can be processed in the same way.

[0429] Example 19: Based on the same application concept as the above method, a decoding device is also proposed in the embodiment of the present application. The decoding device is applied to the decoding end, and the decoding device includes: a memory, which is configured to store video data; a decoder, which is configured to implement the encoding and decoding methods in the above embodiments 1 to 18, that is, the processing flow of the decoding end.

[0430] For example, in one possible implementation, a decoder is configured to implement:

[0431] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0432] Based on the same application concept as the above method, an encoding device is also proposed in an embodiment of the present application, and the encoding device is applied to the encoding end. The encoding device includes: a memory, which is configured to store video data; an encoder, which is configured to implement the encoding and decoding methods in the above embodiments 1 to 18, that is, the processing flow of the encoding end.

[0433] For example, in one possible implementation, the encoder is configured to implement:

[0434] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0435] Based on the same application concept as the above method, the decoding end device (also called a video decoder) provided in the embodiment of the present application, from the hardware level, its hardware architecture diagram can be specifically shown in Figure 5A. It includes: a processor 511 and a machine-readable storage medium 512, wherein: the machine-readable storage medium 512 stores machine-executable instructions that can be executed by the processor 511; the processor 511 is used to execute the machine-executable instructions to implement the method disclosed in the above embodiments 1-18 of this application. For example, the processor 511 is used to execute the machine-executable instructions to implement the following steps:

[0436] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0437] Based on the same application concept as the above method, the encoding end device (also referred to as a video encoder) provided in the embodiment of the present application, from a hardware perspective, its hardware architecture diagram can be specifically shown in Figure 5B. It includes: a processor 521 and a machine-readable storage medium 522, wherein: the machine-readable storage medium 522 stores machine-executable instructions that can be executed by the processor 521; the processor 521 is used to execute the machine-executable instructions to implement the method disclosed in the above embodiments 1-18 of this application. For example, the processor 521 is used to execute the machine-executable instructions to implement the following steps:

[0438] If the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, the gradient value of the current pixel point is determined based on the original pixel value of the current pixel point and the original pixel values ​​of the pixels surrounding the current pixel point; and the adjusted pixel value of the current pixel point is determined based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0439] Based on the same application concept as the above method, an embodiment of the present application further provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method disclosed in the above examples of the present application, such as the encoding and decoding methods in the above embodiments, can be implemented. The above-mentioned machine-readable storage medium can be any electronic, magnetic, optical or other physical storage device, which can contain or store information, such as executable instructions, data, and the like. For example, the machine-readable storage medium can be: RAM (Random Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as a hard disk drive), solid-state drive, any type of storage disk (such as a CD, DVD, etc.), or similar storage medium, or a combination thereof.

[0440] Based on the same application concept as the above method, an embodiment of the present application further provides a computer application, which, when executed by a processor, can implement the encoding and decoding method disclosed in the above example of the present application.

[0441] Based on the same application concept as the above method, the embodiment of the present application further provides a coding and decoding device, which can be applied to an encoding end or a decoding end. The coding and decoding device may include:

[0442] a determination module for determining, if a current pixel point in a current block satisfies an enabling condition of an enhanced adjustment mode, a gradient value of the current pixel point based on an original pixel value of the current pixel point and original pixel values ​​of pixels surrounding the current pixel point; and a processing module for determining an adjusted pixel value of the current pixel point based on the gradient value of the current pixel point and the original pixel value of the current pixel point.

[0443] Exemplarily, when the processing module determines the adjusted pixel value of the current pixel point based on the gradient value of the current pixel point and the original pixel value of the current pixel point, it is specifically configured to:

[0444] An adjusted pixel value of the current pixel is determined based on the gradient value of the current pixel, the original pixel value of the current pixel, a first adjustment threshold, a second adjustment threshold, a first adjustment offset value, and a second adjustment offset value.

[0445] Exemplarily, the processing module, when determining the adjusted pixel value of the current pixel based on the gradient value of the current pixel, the original pixel value of the current pixel, the first adjustment threshold, the second adjustment threshold, the first adjustment offset value, and the second adjustment offset value, is specifically configured to: if the gradient value of the current pixel is greater than the first adjustment threshold, determine the adjusted pixel value of the current pixel based on the original pixel value of the current pixel and the first adjustment offset value;

[0446] If the gradient value of the current pixel is less than the second adjustment threshold, the adjusted pixel value of the current pixel is determined based on the original pixel value of the current pixel and the second adjustment offset value.

[0447] In a possible implementation, if the current pixel in the current block meets the enabling conditions of the enhanced adjustment mode, the determination module is further used to determine a reference pixel corresponding to the current pixel from the adjacent blocks of the current block, and determine the gradient value of the reference pixel based on the original pixel value of the reference pixel and the original pixel values ​​of the pixels surrounding the reference pixel; the processing module is further used to determine the adjusted pixel value of the reference pixel based on the gradient value of the reference pixel and the original pixel value of the reference pixel.

[0448] Exemplarily, when the processing module determines the adjusted pixel value of the reference pixel based on the gradient value of the reference pixel and the original pixel value of the reference pixel, it is specifically configured to:

[0449] An adjusted pixel value of the reference pixel is determined based on the gradient value of the reference pixel, the original pixel value of the reference pixel, a third adjustment threshold, a fourth adjustment threshold, a third adjustment offset value, and a fourth adjustment offset value.

[0450] Exemplarily, the processing module, when determining the adjusted pixel value of the reference pixel based on the gradient value of the reference pixel, the original pixel value of the reference pixel, the third adjustment threshold, the fourth adjustment threshold, the third adjustment offset value, and the fourth adjustment offset value, is specifically configured to: if the gradient value of the reference pixel is greater than the third adjustment threshold, determine the adjusted pixel value of the reference pixel based on the original pixel value of the reference pixel and the third adjustment offset value;

[0451] If the gradient value of the reference pixel is less than a fourth adjustment threshold, an adjusted pixel value of the reference pixel is determined based on the original pixel value of the reference pixel and a fourth adjustment offset value.

[0452] In a possible embodiment, when the determination module determines that the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, it is specifically used to: if the boundary strength of the boundary to be filtered corresponding to the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode, then determine that the current pixel point meets the enabling conditions of the enhanced adjustment mode; or, if the feature information corresponding to the current block meets the enabling conditions of the enhanced adjustment mode, then determine that the current pixel point in the current block meets the enabling conditions of the enhanced adjustment mode.

[0453] Exemplarily, the processing module is also used to perform deblocking filtering on the original pixel value of the current pixel point to obtain the filtered pixel value of the current pixel point if the current pixel point in the current block meets the enabling conditions of the normal filtering mode; if the current pixel point in the current block meets the enabling conditions of the enhanced filtering mode, determine the adjusted pixel value of the current pixel point based on the filtered pixel value of the current pixel point and the original pixel value of the current pixel point.

[0454] Exemplarily, when the processing module determines the adjusted pixel value of the current pixel point based on the filtered pixel value of the current pixel point and the original pixel value of the current pixel point, it is specifically used to: determine the adjusted pixel value of the current pixel point based on the filtered pixel value of the current pixel point, the original pixel value of the current pixel point, the first filtering threshold, the second filtering threshold, the first filtering offset value and the second filtering offset value; the first filtering threshold and the second filtering threshold are reciprocal numbers of each other.

[0455] Exemplarily, if the current pixel in the current block meets the activation condition of the normal filtering mode, the processing module is further configured to determine a reference pixel corresponding to the current pixel from an adjacent block of the current block; perform deblocking filtering on the original pixel value of the reference pixel to obtain a filtered pixel value of the reference pixel;

[0456] If the current pixel in the current block meets the enabling condition of the enhancement filtering mode, the adjusted pixel value of the reference pixel is determined based on the filtered pixel value of the reference pixel and the original pixel value of the reference pixel.

[0457] Exemplarily, when the processing module determines the adjusted pixel value of the reference pixel point based on the filtered pixel value of the reference pixel point and the original pixel value of the reference pixel point, it is specifically used to: determine the adjusted pixel value of the reference pixel point based on the filtered pixel value of the reference pixel point, the original pixel value of the reference pixel point, the third filtering threshold, the fourth filtering threshold, the third filtering offset value and the fourth filtering offset value; the third filtering threshold and the fourth filtering threshold are reciprocal numbers of each other.

[0458] The systems, devices, modules or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver device, a game console, a tablet computer, a wearable device, or a combination of any of these devices. For the convenience of description, the above devices are described separately according to their functions. Of course, when implementing this application, the functions of each unit can be implemented in the same or multiple software and / or hardware.

[0459] Those skilled in the art will appreciate that embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Embodiments of the present application may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0460] The present application is described with reference to the flow chart and / or block diagram of the method, device (system) and computer program product according to the embodiment of the present application. It should be understood that each flow process and / or box in the flow chart and / or block diagram and the combination of the flow process and / or box in the flow chart and / or block diagram can be realized by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processing machine or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for realizing the function specified in one flow chart flow or multiple flows and / or one box or multiple boxes of the block diagram.

[0461] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device that implements the functions specified in one or more flow charts and / or one or more blocks in the block diagram. These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are performed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more flow charts and / or one or more blocks in the block diagram. The above description is merely an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included within the scope of the claims of the present application.

Claims

1. A decoding method, characterized in that, the method includes: If the current pixel point in the current block meets the enabling condition of the enhanced adjustment mode, determine the gradient value of the current pixel point based on the original pixel value of the current pixel point and the original pixel values of the surrounding pixel points of the current pixel point; Determine the adjusted pixel value of the current pixel point based on the gradient value of the current pixel point and the original pixel value of the current pixel point; wherein, the current pixel point in the current block meets the enabling condition of the enhanced adjustment mode, including: If the boundary strength of the boundary to be filtered corresponding to the current pixel point in the current block meets the enabling condition of the enhanced adjustment mode, determine that the current pixel point meets the enabling condition of the enhanced adjustment mode.

2. The method according to claim 1, characterized in that, the boundary strength of the boundary to be filtered corresponding to the current pixel point in the current block meets the enabling condition of the enhanced adjustment mode, including: If the boundary strength of the boundary to be filtered corresponding to the current pixel point is a preset first value, determine that the boundary strength of the boundary to be filtered meets the enabling condition of the enhanced adjustment mode.

3. The method according to claim 2, characterized in that, the preset first value is 0.

4. The method according to claim 1, characterized in that, the determining the adjusted pixel value of the current pixel point based on the gradient value of the current pixel point and the original pixel value of the current pixel point includes: Determine the adjusted pixel value of the current pixel point based on the gradient value of the current pixel point, the original pixel value of the current pixel point, a first adjustment threshold, a second adjustment threshold, a first adjustment offset value, and a second adjustment offset value; wherein, if the gradient value of the current pixel point is greater than the first adjustment threshold, determine the adjusted pixel value of the current pixel point based on the original pixel value of the current pixel point and the first adjustment offset value; If the gradient value of the current pixel point is less than the second adjustment threshold, determine the adjusted pixel value of the current pixel point based on the original pixel value of the current pixel point and the second adjustment offset value.

5. The method according to claim 1, characterized in that, If the current pixel point in the current block meets the enabling condition of the enhanced adjustment mode, the method further includes: Determine a reference pixel point corresponding to the current pixel point from the adjacent blocks of the current block, and determine the gradient value of the reference pixel point based on the original pixel value of the reference pixel point and the original pixel values of the surrounding pixel points of the reference pixel point; Determine the adjusted pixel value of the reference pixel point based on the gradient value of the reference pixel point, the original pixel value of the reference pixel point, a third adjustment threshold, a fourth adjustment threshold, a third adjustment offset value, and a fourth adjustment offset value; wherein, if the gradient value of the reference pixel point is greater than the third adjustment threshold, determine the adjusted pixel value of the reference pixel point based on the original pixel value of the reference pixel point and the third adjustment offset value; if the gradient value of the reference pixel point is less than the fourth adjustment threshold, determine the adjusted pixel value of the reference pixel point based on the original pixel value of the reference pixel point and the fourth adjustment offset value.

6. The method according to claim 4 or 5, wherein, the method further comprises: parsing from the high-level syntax a first adjustment threshold, a first adjustment offset value, a second adjustment offset value, a third adjustment threshold, a third adjustment offset value, and a fourth adjustment offset value corresponding to the current block.

7. The method according to any one of claims 1-5, wherein, before determining that the current pixel point in the current block meets the enabling condition of the enhancement adjustment mode, the method further comprises: if the enhancement adjustment mode enabling flag bit corresponding to the current block allows the current block to enable the enhancement adjustment mode, determining whether the current pixel point in the current block meets the enabling condition of the enhancement adjustment mode; wherein, the method further comprises: parsing from the high-level syntax the enhancement adjustment mode enabling flag bit corresponding to the current block.

8. An encoding method, wherein, the method comprises: if the current pixel point in the current block meets the enabling condition of the enhancement adjustment mode, determining a gradient value of the current pixel point based on an original pixel value of the current pixel point and original pixel values of surrounding pixel points of the current pixel point; determining an adjusted pixel value of the current pixel point based on the gradient value of the current pixel point and the original pixel value of the current pixel point; wherein, the current pixel point in the current block meets the enabling condition of the enhancement adjustment mode, including: if a boundary strength of a boundary to be filtered corresponding to the current pixel point in the current block meets the enabling condition of the enhancement adjustment mode, determining that the current pixel point meets the enabling condition of the enhancement adjustment mode.

9. A decoding device, wherein, the decoding device comprises: a memory configured to store video data; a decoder configured to implement the method according to any one of claims 1-7.

10. An encoding device, wherein, the encoding device comprises: a memory configured to store video data; an encoder configured to implement the method according to claim 8.

11. A decoding terminal device, wherein, comprises: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; the processor is configured to execute the machine-executable instructions to implement the method according to any one of claims 1-7.

12. An encoding terminal device, wherein, comprises: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; the processor is configured to execute the machine-executable instructions to implement the method according to claim 8.

13. A machine-readable storage medium, wherein, the machine-readable storage medium stores machine-executable instructions executable by a processor; wherein, the processor is configured to execute the machine-executable instructions to implement the method according to any one of claims 1-8.