Reference paper: HEVC deblocking Filter
"HEVC standard Introduction, HEVC Frame prediction paper Notes" series blog, catalogue see: Http://www.cnblogs.com/DwyaneTalk/p/5711333.html
first, the purpose of Deblock filter
In AVC, the image is divided into 16x16 MB, for HEVC is divided into 16x16 to 64x64 LCU,LCU according to the four-fork tree structure divided into cu,cu size from 8x8 to 64x64. Cu can be further divided into Pu and tu, divided into Tu is also in accordance with the four-fork tree structure, HEVC support 4x4 to 32x32 conversion size, larger transform blocks also lead to more serious block effect, ringing effect and so on.
second, the process of Deblock filter
1, the filter condition judgment: The DB process considers the 8x8 block boundary, for each CU, is divided into the 8x8 block, for each boundary of the 8x8 block, the following judgment determines whether the DB, as well as the strength of the db.
A, whether it is a pu or tu boundary, if not do not do the DB, B, the boundary strength of BS (boundary strength), the determination of the boundary strength, such as (for the 8x8 block boundary, Middle Pij and Qij refers to the middle four rows, near the boundary of four columns, Called Four-sample part of a block boundary):
bs = 2: At least one 8x8 block on both sides of the boundary belongs to intra, and if the conditions of bs=2 are met, no bs=1 judgment is made; bs = 1: At least one 8x8 block has a non-0 residual coefficient, and the boundary is the TU boundary; bs = 1 : The absolute difference of the motion vectors of two blocks is greater than an integer pixel; bs = 1: Two frame compensation block reference frames are different or the number of motion vectors is different; bs = 0: remainder; After the BS is determined, for the luminance component: D is only performed when Bs>=1 B (need further judgment C); For chroma components, the DB is required (when a and B are satisfied, no C judgment is required, direct filtering is bs=2). This indicates that the probability of a db is lower when the block with the boundary two times is relatively stable. For chroma components, DB occurs only if there are intra blocks on both sides of the boundary.
C, local adaptive and filter determination: means that when the boundary two times the signal changes below the specified threshold. For the luminance signal, when bs>0, for Four-sample length boundary, also need to satisfy the following formula (only related to 1th, 4 lines) in order to do DB: Belta is a QP-related, QP Piecewise linear functions (see below for specific relationships) can be achieved by looking up a table. The above-measured boundary two times signal value deviates from the Linetype level (how much signal on both sides of the block boundary deviates from a straight lines).
2, strong filtering and general filtering judgment:For luminance boundary: it is divided into ordinary filter and strong filter, in which the common filter is divided into two cases, and for chroma filter, only one case of ordinary filtering is used (only an element near the boundary is filtered). For the luminance component, by the choice of ordinary filtering or strong filtering, wherein i=0, 3 (indicating only the 1th and 4 lines to judge) when for i=0, 3, if (2), (3) and (4) are established, then the strong filtering, otherwise ordinary filtering. The TC is also related to QP, you can get the value of TC by checking the table. The condition (2) ensures that both sides of the edge meet smaller local self-adaptive conditions (3) To ensure the stability of the signal on both sides of the edge, the condition (4) to ensure that the edge two times the pixel value jumps less than a threshold value.
3, the common filter two conditions to determine:The difference between the two different cases of normal filtering is that the number of pixels filtered by the boundary two times is different. The judging conditions are as follows:
When the condition (5) is satisfied, the two pixel positions closest to the boundary in block p on the left side of the boundary are filtered (p1i and p0i,i=0,1,2,3), otherwise only one pixel closest to the boundary is filtered (p0i,i=0,1,2,3) in the P block. The same is the case for conditions (6). In both conditions, the threshold used is also related to Belta, but less than the threshold in the condition (1), which is greater than the threshold in the condition (2), (3), which indicates that the lower the local adaptive boundary, the stronger (or the more filtering element) the filter operation. The overall filter condition and filter type decision-making process is as follows two diagram: The description of the condition (10) is shown in the following
4, the ordinary filter processing process:(assuming a vertical boundary)
Regardless of whether the conditions (5) and (6) are satisfied, it is necessary to filter the one column closest to the boundary, the filter formula is as follows (row coordinates, need to i=0,1,2,3, a total of 4 lines to filter):
The delta is the result of the Sita clip operation, as described later in the clip operation. The above operation is equivalent to filtering the pixels (3,7,9,-3)/16 filter. In addition, for each line of i=0,1,2,3, a separate condition (10) is required before filtering, and only if the condition (10) is satisfied, the line can be filtered:
The condition (10) exists in order to avoid unnecessary filtering of the normal existence of the block boundary, because when the SITA absolute is greater than 10 times times the TC, it is generally not likely due to the block effect, so for the ordinary filter processing process such as:
As shown: In the case of normal filtering, p0 and q0 need to be filtered, but when the condition (5) is met, the P1 is filtered, and when the condition (6) is satisfied, the Q1 is filtered. The P1/Q1 filter operation is as follows: The filter operation is equivalent to the P1/Q1 (8, 19,-1, 9,-3)/32.
5, the processing process of strong filtering:(assuming a vertical boundary) for strong filtering, need to affect more pixels, so the boundary on each side of each row of the 3 pixels to adjust the amount of delta0, Delta1 and Delta2, respectively, the following sita0, Sita1 and sita2 clip operation results. That is, for P0/q0, p1/q1, and p2/q2 for each row (4 rows, i=0,1,2,3), add/Subtract delta0, delta1, and Delta2, respectively. This filter is equivalent to the filtering operation (1, 2, 2, 2, 1)/8, (1, 1, 1, 1)/4 and (2, 3, 1, 1, 1)/8 respectively.
6, Chroma filter operation:
As described in 1, 2, for the chroma 8x8 block boundary, is the PU or tu boundary and bs=2, do not make any other judgment, the variable on each side of each line (i=0,1,2,3) of an element (P0/q0) to filter, the filter size delta is the following SITA clip operation results, The equivalent of (1 4 4-1)/8 filter operation.
7. Clip Operation:The clip operation is for Sita, and the clip process is as follows:
As above, the clip operation is to limit the value of Sita to the range of [-C, C], where the range C for different sita,clip is different. For normal filtering, if the delta is used to adjust the value of the p0/q0, then C=TC (n); If Delta adjusts p1/q1, then C=TC (n)/2. For strong filtering, C=2TC (n). For n in TC (n), when the boundary is two times the inter-frame prediction is (bs=0 or 1), then n=qp; otherwise n=qp+2; In addition, the result of the Chroma component filtering P0 '/q0 ', and the normal filtering result of the luminance component P0 '/q0 ', p1 '/q1 ', The clip operation needs to be performed as follows (where n is bit depth):
8, sequence and frame-level db Adaptive:During the filtering process, the delta controls which boundaries need to be filtered, controls the choice between strong filtering and normal filtering, and also controls which 2 cases of normal filtering are selected. In addition to controlling the choice of strong filtering and normal filtering, the parameter TC also controls the maximum absolute value of the filter compensation amount. Both are obtained through the QP table, and the relationship between them and QP is as follows:
In order to adaptively adjust the filtering strength of different frames or different slice within the sequence, the TC−OFFSET−DIV2 is set in the slice header and PPS (picture parameters set). And beta−offset−div2 the two parameters to adjust the TC and the Belta. When the TC and Belta calculations are performed, the values of TC and Belta are adjusted by adding twice times the tc−offset−div2 and Beta−offset−div2 to the current QP accordingly.
"HEVC profile" Db-deblock Filter