The present description relates to deblocking filtering for reducing blocking artifacts at block boundaries.
Deblocking filters are used in the video coding standards in order to combat blocking artifacts. The blocking artifacts arise because the original video is split into blocks which are processed relatively independently. The blocking artifacts can, for instance, arise due to different intra predictions of the blocks, quantization effects and motion compensation. Two particular variants of deblocking are described below.
H.264 Deblocking
In state of the art video coding, such as H.264, there is a deblocking filter, also denoted loop filter, after prediction and residual reconstruction, but before storage of the reconstruction for later reference when encoding or decoding the subsequent frames. The deblocking filtering consists of several steps such as filter decisions, filtering operations, a clipping function and changes of pixel values. The decision to filter the border or not is made based on evaluation of several conditions. Filter decisions depend on macroblock (MB) type, motion vector (MV) difference between neighboring blocks, whether neighboring blocks have coded residuals and on the local structure of the current and/or neighboring blocks.
Then the amount of filtering for a pixel depends, among others, on the position of that pixel relative to the block border or boundary and on the quantization parameter (QP) value used for residual coding.
The filter decision is based on comparing three pixel differences with three thresholds. The thresholds are adapted to the quantization parameter (QP). For instance, assume a vertical block boundary of a b c d|e f g h where a, b c and d denote the pixel values of the pixels of a row of pixels in the current block with e, f, g and h denoting the corresponding pixel values of the pixels of a corresponding row of pixels in the neighboring block. If the following conditions are fulfilled the filter decision is positive, e.g. abs(d-e)<thr1, abs(c-d)<thr2, and abs(e-f)<thr2, where thr1 and thr2 are adapted based on QP.
There are two filtering modes in H.264. In the first filtering mode, referred to as normal filtering, filtering can be described with a delta value with which filtering changes the current value with. The filtering for the pixels closest to the block boundary is d′=d+delta and e′=e−delta, where delta has been clipped off to a threshold±thr3 to a value that is constrained by the QP. More filtering is thereby allowed for high QP than for low QP. Clipping can be described as delta_clipped=max(−thr3, min(thr3, delta)), where thr3 is controlling the filter strength. A larger value of thr3 means that the filtering is stronger which means that a stronger low-pass filtering effect will happen.
The filter strength can be increased if any of the following two conditions also holds, e.g. abs(b-d)<thr2 and abs(e-g)<thr2. The filter strength is adapted by clipping the delta less, e.g. allow for more variation.
The second filtering mode, referred to as strong filtering, is applied for intra macroblock boundaries only, when the following condition is fulfilled abs(d-e)<thr1/4.
For more information of deblocking filtering in H.264 reference is made to List et al., Adaptive Deblocking Filter, IEEE Transactions on Circuits and Systems for Video Technology, vol. 13, no. 7, July 2003.
Deblocking in HEVC Draft
In the draft HEVC (High Efficiency Video Coding) specification “Test Model under Consideration”, ITU-T SG16 WP3 document, JCTVC-B205, Chapter 6.5 In-loop filter process, the deblocking filter works differently from H.264. The filtering is performed if at least one of the blocks on the side of the boundary is intra, or has non-zero coefficients, or the difference between the motion vector components of the blocks is greater or equal to one integer pixel. For example, when filtering the border between the blocks with a vertical block boundary of
p3ip2ip1ip0i|q0iq1iq2iq3i
with pji denoting the pixel value of pixel number j of row number i in the current block and qji denoting the pixel value of pixel number j of row number i in the neighboring block, i=0 . . . 7, j=0 . . . 3, then the following condition should also be satisfied:
d=|p22−2×p12+p02|+|q22−2×q12+q02|+|p25−2×p15+p05|+|q25−2×q15+q05|<β
where β depends on QP. In the above mentioned HEVC specification, there is a table of β, where β increases with QP.
If the conditions are fulfilled and filtering is done between the current block and the neighboring block, one of two types of filtering is performed, referred to as weak and strong filtering, respectively. The choice between the strong and the weak filtering is done separately for each line depending on the following conditions. For each line i=0 . . . 7, the strong filtering is performed if all the following conditions are true, otherwise, weak filtering is performed:
d<(β>>2)
(|p3i−p0i|+|q0i−q3i|)<(β>>3)
|p0i−q0i|<((5×tC+1)>>1)
where tC and β depend on QP and >> denotes a right shift operator.
Weak Filtering in HEVC Draft
Weak filtering is performed based on the above conditions. The actual filtering works by computing an offset (A), adding it to the original pixel value and clip the sum to a filtered output pixel value in the range of 0-255:
Δ=Clip(−tC,tC,(13×(q0i−p0i)+4×(q1i−p1i)−5×(q2i−p2i)+16)>>5))
p0i=Clip0-255(p0i+Δ)
q0i=Clip0-255(q0i−Δ)
p1i=Clip0-255(p1i+Δ/2)
q1i=Clip0-255(q1i−Δ/2)
where the clip function Clip(A, B, x) is defined as Clip(A, B, x)=A if x<, Clip(A, B, x)=B if x>B and Clip(A, B, x)=x if A≦x≦B and Clip0-255(x) is defined as Clip(0, 255, x).
Strong Filtering in HEVC Draft
Strong filtering mode is performed by the following set of operations:
p0i=Clip0-255((p2i+2×p1i+2×p0i+2×q0i+q1i+4)>>3)
q0i=Clip0-255((p1i+2×p0i+2×q0i+2×q1i+q2i+4)>>3)
p1i=Clip0-255((p2i+p1i+p0i+q0i2)>>2)
q1i=Clip0-255((p0i+q0i+q1i+q2i+2)>>2)
p2i=Clip0-255((2×p3i+3×p2i+p1i+p0i+q0i+4)>>3)
q2i=Clip0-255((p0i+q0i+q1i+3×q2i+2×q3i+4)>>3)
One problem with the deblocking in HEVC is that the weak filter does not have good low-pass characteristics. One can see that the first and the second pixels from the block border are modified by adding or subtracting Δ and Δ/2 respectively. Such a filter cannot remove high frequencies that can appear near the block border and cannot remove ringing. Moreover, the frequency characteristics of the filter in HEVC show slight amplifications of higher frequencies when filtering the second pixel (p1i and q1i) from the block boundary, which can result in worse rate-distortion (RD) performance of the coder. Moreover, the offset for pixel p1i is equal in magnitude to the offset of pixel q1i although the structure of the signal can be different on different sides of the block boundary. Therefore, the HEVC filter does not adapt well to the local structure of the side of the block boundary.
Hence, there is a need for an efficient deblocking filter that can be used to reduce blocking artifacts at block boundaries and that does not have the above mentioned drawbacks.
It is a general objective to combat blocking artifacts at block boundaries between blocks of pixels in a video frame.
This and other objectives are met by embodiments as disclosed herein.
An aspect of the embodiments defines a method of reducing blocking artifacts at a block boundary between a block of pixels and a neighboring block of pixels in a video frame. The method calculates a first offset to be based on (9×(q0−p0)−3×(q1−p1))/16, wherein p0 denotes a pixel value of a pixel closest to the block boundary in a line of pixels in the block, p1 denotes a pixel value of a pixel next closest to the block boundary in the line of pixels, q0 denotes a pixel value of a pixel closest to the block boundary in a corresponding line of pixels in the neighboring block and q1 denotes a pixel value of a pixel next closest to the block boundary in the corresponding line of pixels. The line of pixels and the corresponding line of pixels are perpendicular to the block boundary. The pixel value of the pixel closest to the block boundary in the line of pixels is modified by adding the first offset to the pixel value of this pixel to form a modified pixel value. Correspondingly, the pixel value of the pixel closest to the block boundary but in the corresponding line of pixels is modified by subtracting the first offset from the pixel value of this pixel to form a modified pixel value.
In an optional embodiment of this aspect, the first offset is calculated to be equal to (9×(q0−p0)−3×(q1−p1)+8)>>4, wherein >> denotes a right shift operation.
In an optional embodiment of this aspect, the method further comprises clipping the first offset to be within an interval of −tC and tC by setting the first offset to be equal to −tC if the first offset is smaller than −tC and by setting the first offset to be equal to tC if the first offset is larger than tC, wherein tC is a threshold value that is dependent on a quantization parameter value assigned to the block.
In an optional embodiment of this aspect, the method further comprises clipping the modified pixel value of the pixel closest to said block boundary in the line of pixels to be within an interval of zero and a defined maximum value and clipping the modified pixel value of the pixel closest to the block boundary in the corresponding line of pixels to be within an interval of zero and the defined maximum value. This optional clipping is achieved by setting the modified pixel value to be equal to zero if the modified pixel value is smaller than zero and by setting the modified pixel value to be equal to the defined maximum value if the modified pixel value is larger than the defined maximum value.
In an optional embodiment of this aspect, the method further comprises calculating a second offset to be based on (p2+p0−2×p1+2×Δ)/4, wherein p2 denotes a pixel value of a pixel second next closest to the block boundary in the line of pixels and Δ denotes the first offset. The method also comprises, in this optional embodiment, calculating a third offset to be based on (q2+q0−2×q1−2×Δ)/4, wherein q2 denotes a pixel value of a pixel second next closest to the block boundary in the corresponding line of pixels. The pixel value of the pixel next closest to the block boundary in the line of pixels is then modified by adding the second offset to the pixel value of the pixel next closest to the block boundary in the line of pixels to form a modified pixel value. Correspondingly, the method also comprises, in this optional embodiment, modifying the pixel value of the pixel next closest to the block boundary in the corresponding line of pixels by adding the third offset to the pixel value of the pixel next closest to the block boundary in the corresponding line of pixels to form a modified pixel value.
In an optional embodiment of this aspect, the second offset is calculated to be equal to (((p2+p0+1)>>1)−p1+Δ)>>1, wherein >> denotes a right shift operation and the third offset is calculated to be equal to (((q2+q0+1)>>1)q1−Δ)>>1.
In an optional embodiment of this aspect, the method further comprises clipping the second offset within an interval of −tC2 and tC2 and clipping the third offset within an interval of −tC2 and tC2, wherein tC2 is a threshold value that is dependent on a quantization parameter value assigned to the block. This optional clipping is achieved by setting the second or third offset to be equal to −tC2 if the second or third offset is smaller than −tC2 and by setting the second or third offset to be equal to tC2 if the second or third offset is larger than tC2.
In an optional embodiment of this aspect, the method further comprises clipping the modified pixel value of the pixel next closest to the block boundary in the line of pixels within an interval of zero and a defined maximum value and clipping the modified pixel value of the next pixel closest to the block boundary in the corresponding line of pixels within an interval of zero and the defined maximum value. This optional clipping is achieved by setting the modified pixel value to be equal to zero if the modified pixel value is smaller than zero and by setting the modified pixel value to be equal to the defined maximum value if the modified pixel value is larger than the defined maximum value.
In an optional embodiment of this aspect, the method further comprises calculating a fourth offset to be based on (p3+p1−2×p2+2×Δp1)/4, wherein p3 denotes a pixel value of a pixel third next closest to the block boundary in the line of pixels and Δp1 denotes the second offset. The method also comprises, in this optional embodiment, calculating a fifth offset to be based on (q3+q1−2×q2+2×Δq1)/4, wherein q3 denotes a pixel value of a pixel third closest to the block boundary in the corresponding line of pixels and Δp1 denotes the third offset. The pixel value of the pixel second next closest to the block boundary in the line of pixels is modified by adding the fourth offset to the pixel value of the pixel second next closest to the block boundary in the line of pixels to form a modified pixel value. The method also comprises, in this optional embodiment, modifying the pixel value of the pixel second next closest to the block boundary in the corresponding line of pixels by adding the fifth offset to the pixel value of the pixel second next closest to the block boundary in the corresponding line of pixels to form a modified pixel value.
In an optional embodiment of this aspect, the fourth offset is calculated to be equal to (((p3+p1+1)>>1)−p2+Δ1)>>1, wherein >> denotes a right shift operation and the fifth offset is calculated to be equal to (((q3+q1+1)>>1)−q2+Δq1)>>1.
In an optional embodiment of this aspect a deblocking filter unit calculates the first offset to be based on (9×(q0−p0)−3×(q1−p1))/16. The deblocking filter unit modifies the pixel value of the pixel closest to the block boundary in the line of pixels by adding the first offset to the pixel value of the pixel closest to the block boundary in the line of pixels to form a modified pixel value. The deblocking filter unit also modifies the pixel value of the pixel closest to the block boundary in the corresponding line of pixels by subtracting the first offset from the pixel value of the pixel closest to the block boundary in the corresponding line of pixels to form a modified pixel value.
Another aspect of the embodiments defines a deblocking filter unit for reducing blocking artifacts at a block boundary between a block of pixels and a neighboring block of pixels in a video frame. The deblocking filter unit comprises a first offset calculator configured to calculate a first offset to be based on (9×(q0−p0)−3×(q1−p1))/16, wherein p0 denotes a pixel value of a pixel closest to the block boundary in a line of pixels in the block, p1 denotes a pixel value of a pixel next closest to the block boundary in the line of pixels, q0 denotes a pixel value of a pixel closest to the block boundary in a corresponding line of pixels in the neighboring block and q1 denotes a pixel value of a pixel next closest to the block boundary in the corresponding line of pixels. The line of pixels and the corresponding line of pixels are perpendicular to the block boundary. The deblocking filter unit also comprises a pixel value modifier configured to modify the pixel value of the pixel closest to the block boundary in the line of pixels by adding the first offset to the pixel value of this pixel to form a modified pixel value. The pixel value modifier is also configured to modify the pixel value of the pixel closest to the block boundary but in the corresponding line of pixels by subtracting the first offset from the pixel value of this pixel to form a modified pixel value.
In an optional embodiment of this aspect, the first offset calculator is configured to calculate the first offset to be equal to (9×(q0−p0)−3×(q1−p1)+8)>>4, wherein >> denotes a right shift operation.
In an optional embodiment of this aspect, the deblocking filter unit comprises a first clipping unit configured to clip the first offset to be within an interval of −tC and tC by setting the first offset to be equal to −tC if the first offset is smaller than −tC and by setting the first offset to be equal to tC if the first offset is larger than tC, wherein tC is a threshold value that is dependent on a quantization parameter value assigned to the block.
In an optional embodiment of this aspect, the deblocking filter unit comprises a second clipping unit configured to clip the modified pixel value of the pixel closest to the block boundary in the line of pixels within an interval of zero and a defined maximum value, and clip the modified pixel value of the pixel closest to the block boundary in the corresponding line of pixels within an interval of zero and the defined maximum value. This optional clipping by the optional second clipping unit is achieved by setting the modified pixel value to be equal to zero if the modified pixel value is smaller than zero and by setting the modified pixel value to be equal to the defined maximum value if the modified pixel value is larger than the defined maximum value.
In an optional embodiment of this aspect, the deblocking filter unit comprises a second offset calculator configured to calculate a second offset to be based on (p2+p0−2×p1+2×Δ)/4, wherein p2 denotes a pixel value of a pixel second next closest to the block boundary in the line of pixels and Δ denotes the first offset. The deblocking filter unit also comprises, in this optional embodiment, a third offset calculator configured to calculate a third offset to be based on (q2+q0−2×q1−2×Δ)/4, wherein q2 denotes a pixel value of a pixel second next closest to the block boundary in the corresponding line of pixels. In this optional embodiment the pixel value modifier is configured to modify the pixel value of the pixel next closest to the block boundary in the line of pixels by adding the second offset to the pixel value of the pixel next closest to the block boundary in the line of pixels to form a modified pixel value, and to modify the pixel value of the pixel next closest to the block boundary in the corresponding line of pixels by adding the third offset to the pixel value of the pixel next closest to the block boundary in the corresponding line of pixels to form a modified pixel value.
In an optional embodiment of this aspect, the second offset calculator is configured to calculate the second offset to be equal to (((p2+p0+1)>>1)−p1+Δ)>>1, wherein >> denotes a right shift operation, and the third offset calculator is configured to calculate the third offset to be equal to (((q2+q0+1)>>1)−q1−Δ)>>1.
In an optional embodiment of this aspect, the deblocking filter unit comprises a third clipping unit configured to clip the second offset within an interval of −tC2 and tC2, and clip the third offset within an interval of −tC2 and tC2, wherein tC2 is a threshold value that is dependent on a quantization parameter value assigned to the block. This optional clipping by the optional third clipping unit is achieved by setting the second or third offset to be equal to −tC2 if the second or third offset is smaller than −tC2 and by setting the second or third offset to be equal to tC2 if the second or third offset is larger than tC2.
In an optional embodiment of this aspect, the deblocking filter unit comprises a second clipping unit configured to clip the modified pixel value of the pixel next closest to the block boundary in the line of pixels within an interval of zero and a defined maximum value, and clip the modified pixel value of the next pixel closest to the block boundary in the corresponding line of pixels within an interval of zero and the defined maximum value. This optional clipping by the optional second clipping unit is achieved by setting the modified pixel value to be equal to zero if the modified pixel value is smaller than zero and by setting the modified pixel value to be equal to the defined maximum value if the modified pixel value is larger than the defined maximum value.
In an optional embodiment of this aspect, the deblocking filter unit comprises a fourth offset calculator configured to calculate a fourth offset to be based on (p3+p1−2×p2+2×Δp1)/4, wherein p3 denotes a pixel value of a pixel third next closest to the block boundary in the line of pixels and Δp1 denotes the second offset. The deblocking filter unit also comprises, in this optional embodiment, a fifth offset calculator configured to calculate a fifth offset to be based on (q3+q1−2×q2+2×Δq1)/4, wherein q3 denotes a pixel value of a pixel third closest to the block boundary in the corresponding line of pixels and Δq1 denotes the third offset. In this optional embodiment the pixel value modifier is configured to modify the pixel value of the pixel second next closest to the block boundary in the line of pixels by adding the fourth offset to the pixel value of the pixel second next closest to the block boundary in the line of pixels to form a modified pixel value, and modify the pixel value of the pixel second next closest to the block boundary in the corresponding line of pixels by adding the fifth offset to the pixel value of the pixel second next closest to the block boundary in the corresponding line of pixels to form a modified pixel value.
In an optional embodiment of this aspect, the fourth offset calculator is configured to calculate the fourth offset to be equal to (((p3+p1+1)>>1)−p2+Δp1)>>1, wherein >> denotes a right shift operation, and the fifth offset calculator is configured to calculate the fifth offset to be equal to (((q3+q1+1)>>1)−q2+Δq1)>>1.
Further aspects of the embodiments define an encoder and a decoder, respectively, comprising a deblocking filter unit as defined above.
Furthermore, an aspect of the embodiments defines a user equipment comprising a memory configured to stored encoded video frames, a decoder as defined above configured to decode the encoded video frames into decoded video frames and a media player configured to render the decoded video frames into video data that is displayable on a display.
Another aspect defines a network device being or belonging to a network node in a communication network between a sending unit and a receiving user equipment. The network device comprises an encoder and/or a decoder as defined above.
A further aspect of the embodiments defines a computer program for reducing blocking artifacts at a block boundary between a block of pixels and a neighboring block of pixels in a video frame. The computer program comprises code means which when run on a computer causes the computer to calculate an offset to be based on (9×(q0−p0)−3×(q1−p1))/16, wherein p0 denotes a pixel value of a pixel closest to the block boundary in a line of pixels in the block, p1 denotes a pixel value of a pixel next closest to the block boundary in the line of pixels, q0 denotes a pixel value of a pixel closest to the block boundary in a corresponding line of pixels in the neighboring block and q1 denotes a pixel value of a pixel next closest to the block boundary in the corresponding line of pixels. The line of pixels and the corresponding line of pixels are perpendicular to the block boundary. The computer is also caused to modify the pixel value of the pixel closest to the block boundary in the line of pixels by adding the offset to the pixel value of this pixel. The code means further causes the computer to modify the pixel value of the pixel closest to the block boundary in the corresponding line of pixels by subtracting the offset from the pixel value of this pixel.
Yet another aspect of the embodiments defines a computer program product comprising computer readable code means and a computer program as defined above stored on the computer readable means.
The present embodiments enable efficient reduction in blocking artifacts and also have good low-pass characteristics.
The invention, together with further objects and advantages thereof, may best be understood by making reference to the following description taken together with the accompanying drawings, in which:
Throughout the drawings, the same reference numbers are used for similar or corresponding elements.
The embodiments generally relate to deblocking filtering to combat blocking artifacts over block boundaries in a video frame. The embodiments use a deblocking filter that has good frequency characteristics. The present deblocking filter is configured not to modify the pixel values over a block boundary if these pixel values form a ramp but smooth the pixel values if they instead are in the form of a step. This implies that the deblocking filter will have good lowpass characteristics and can remove high frequencies that can appear near the block boundary.
In the emerging High Efficiency Video Coding (HEVC) standard, coding units (CU), prediction units (PU) and transform units (TU) are used. The prediction units are defined inside a coding unit and contain the intra or inter prediction modes. Transform units are defined inside a coding unit and the largest transform size is 32×32 pixels and the smallest size is 4×4 pixels. The CU size is currently varying from 64×64 pixels (largest) to 4×4 pixels (smallest). In this way, the largest CU can be split into smaller CUs with the “level of granularity” depending on the local characteristics of the frame. That means that the largest CU may be split into smaller CUs of different sizes. The embodiments can also be used in connection with such coding units, which are regarded as being encompassed by the expression “block of pixels” as used herein.
Each pixel in the block has a respective pixel value. Video frames generally have color values assigned to the pixels, where the color values are represented in a defined color formats. One of the common color formats uses one luminance component and two chrominance components for each pixel, although other formats exist, such as using red, green and blue components for each pixel.
Traditionally, luminance component filtering and chrominance component filtering are done separately possibly employing different filtering decisions and different deblocking filters. It is, though, possible that the luminance filtering decisions are used in chroma filtering, like in HEVC. The embodiments can be applied to filter the luminance component, filter the chrominance component or filter both the luminance component and the chrominance component. In a particular embodiment, the embodiments are applied to achieve luminance or luma filtering. Filtering decisions, or parts of filtering decisions for one component, such as luma, can be then used when making the filtering decisions for other components, such as chroma.
Deblocking filtering is conducted over a boundary, edge or border between neighboring blocks. As a consequence, such boundaries can be vertical boundaries 1, see
The method of this embodiment starts in step S1 where a first offset or delta is calculated for a line 12 of pixels 11, 13, 15, 17 in the block 10. According to the embodiments, this first offset is calculated based on (9×(q0−p0)−3×(q1−p1))/16, wherein p0 denotes the pixel value of the pixel 11 closest to the block boundary 1 in the line 12 of pixels 11, 13, 15, 17 in the block 10, p1 denotes the pixel value of the pixel 13 next closest to the block boundary 1 in the line 12 of pixels 11, 13, 15, 17, q0 denotes the pixel value of the pixel 21 closest to the block boundary 1 in a corresponding or opposing line 22 of pixels 21, 23, 25, 27 in a neighboring block 20 and q1 denotes the pixel value of the pixel 23 next closest to the block boundary 1 in the corresponding line 22 of pixels 21, 23, 25, 27.
The line 12 of pixels 11, 13, 15, 17 in the block 10 and the corresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block 20 belong to the same horizontal line of pixels, i.e. row of pixels, extending over a vertical boundary 1, see
According to the embodiments, “line of pixels” and “corresponding line of pixels” are employed to denote a “row of pixels” and a “corresponding row of pixels” in the case of a vertical block boundary as in
A next step S2 modifies the pixel value of the pixel 11 closest to the block boundary 1 in the line 12 of pixels 11, 13, 15, 17 by adding the first offset calculated in step S1 to the pixel value of this pixel 11 to form a modified pixel value p0′. Thus, the modified pixel value p0′ for this pixel 11 is p0′=p0+Δ, wherein Δ denotes the first offset from step S1. Correspondingly, the pixel value of the pixel 21 closest to the block boundary 1 but in the corresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block 20 is modified in step S3 by subtracting the first offset from the pixel value of this pixel 21 to form a modified pixel value q0′. The modified pixel value q0′ is therefore calculated as q0′=q0−Δ.
The modification of the pixel value for the pixel 11 closest to the block boundary 1 in the line 12 of pixels 11, 13, 15, 17 in the block 10 in step S2 and the modification of the pixel value for the pixel 21 closest to the block boundary 1 in the corresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block 20 in step S3 can be performed serially as illustrated in
The method illustrated in
Generally, and which was discussed in the foregoing, deblocking filtering involves filter decisions that determine whether a deblocking filter is to be applied over a horizontal or vertical block boundary for a block. If such a decision is positive the deblocking filter is then possibly applied to all columns (vertical lines) or rows (horizontal lines) of the block. Alternatively, further filtering decisions are taken for each column or row to decide whether deblocking filter is to be applied or not and/or what type of deblocking filter to use for that particular column or row. Therefore, the method as illustrated in
The deblocking filtering will now be further described herein in connection with various implementation embodiments.
Clipping of the first offset can be performed in an embodiment to thereby restrict the value of the first offset to be within an interval of −tC and tC. The threshold value tC is preferably dependent on a quantization parameter (QP) value assigned to the block. In such a case, a table of different threshold values for different QP values could be used. Table 1 listed below is an example of such a table.
The present embodiments are, however, not limited to the particular relationship between tC and QP as shown in Table 1 but could instead determine the tC value for the block based on the QP value for the block in some other way.
Correspondingly, the modified pixel values calculated in steps S2 and S3 of
Step S1 of
Δ=(9×(q0−p0)−3×(q1−p1))/16
p0′=p0+Δ
q0′=q0−Δ
Clipping of the first offset and/or the modified pixel values as illustrated in
In an alternative embodiment, the offset is calculated as a function of (9×(q0−p0)−3×(q1−p1))/16. Such a function could then be defined so that the calculation of the first offset is efficiently performed in hardware. In such a case, it is generally preferred not to have any divisions and/or define the function so that the first offset will be an integer value. In an embodiment, (X+8)>>4 is used as an integer-expression of X/16, where >> denotes a right shift operation. Thus, in a particular embodiment step S1 calculates the first offset to be based on and preferably equal to (9×(q0−p0)−3×(q1−p1)+8)>>4.
In this embodiment, the pixel values are therefore updated by the proposed deblocking filter by using the following calculations:
Δ=(9×(q0−p0)−3×(q1−p1)+8)>>4
p0′=p0+Δ
q0′=q0Δ
or if clipping is used:
Δ=Clip3(−tC,tC,(9×(q0−p0)−3×(q1−p1)+8)>>4)
p0′=Clip(p0+Δ)
q0′=Clip(q0−Δ)
wherein Clip3(A, B, x) is defined as Clip3(A, B, x)=A if x<A, Clip3(A, B, x)=B if x>B and Clip3(A, B, x)=x if A≦x≦B and Clip(x) is defined as Clip(0, M, x).
In alternative embodiments other implementations, such as integer representations of (9×(q0−p0)−3×(q1−p1))/16 and preferably such integer representations that are efficiently implemented in hardware are used.
The above disclosed embodiments define a deblocking filter that generates a first offset for the pixels closest to the block boundary with a formula that produces approximately zero, preferably exactly zero, when applied to a ramp of pixel values and which produces an offset value that smoothes a step in the pixel values when applied to a step of pixel values. For instance, a ramp can be described as linearly increasing or decreasing pixel values, e.g. 10, 20, 30, 40. When calculating the first offset for these pixel values, i.e. p1=10, p0=20, q0=30, q1=40, the first offset will be zero. Correspondingly, a step can be described as a step increase or decrease in pixel values, e.g. 10, 10, 20, 20. When calculating the first offset for these pixel values, i.e. p1=10, p0=10, q0=20, q1=20, the first offset will be 3.75 if Δ=(9×(q0−p0)−3×(q1−p1))/16 or 4 if Δ=(9×(q0−p0)−3×(q1−p1)+8)>>4. The modified pixel values will then be 10, 13.75, 16.25, 30 or 10, 14, 16, 20 and thereby a smoothing of the step is achieved. The first offset is also zero for a flat line, i.e. if the pixel values are equal, p0=p1=q0=q1.
In a particular embodiment, also the pixel values of the pixels next closest to the block boundary can be modified. This is described further herein with reference to
The second offset calculated in step S30 is used in step S32 to modify the pixel value of the pixel 13 next closest to the block boundary 1 in the line 12 of pixels 11, 13, 15, 17. In an embodiment, the second offset is added to the pixel value of this pixel 13 to obtain a modified pixel value. Correspondingly, step S33 modifies the pixel value of the pixel 23 next closest to the block boundary 1 in the corresponding line 22 of pixels 21, 23, 25, 27 by adding the third offset to the pixel value of this pixel 23 to form a modified pixel value. Steps S32 and S33 can be performed in any sequential order or at least partly in parallel.
The proposed deblocking filter is, in this embodiment, a low-pass filter on all the filter positions p0, p1, q0, q1. When applied to a ramp signal, the deblocking filter will not modify it since Δ, Δp, Δq will all be equal to zero, wherein A denotes the second offset and Δq denotes the third offset. When applied to a step signal, i.e. a deblocking artifact, the deblocking filter will smooth it, i.e. reduce the blocking artifact. In clear contrast to the current HEVC filter, the proposed deblocking filter will smooth and thereby attenuate small ripples on the sides of the block boundary.
In the above described embodiment, the filters for the coefficients that stand at the second position from the block boundary (p1, q1) are produced by using a combination of the first offset and a symmetrical low-pass filter. An advantage of this embodiment is that the offsets for the pixels second next closest to the block boundary can have different values that allows for a better local adaptation. In similar to the first offset, the second and third offsets can be clipped to be within an interval of −tC2 and tC2, where the threshold value tC2 is determined based on the QP value assigned to the block. In a particular embodiment the threshold value tC2 is determined based on the threshold value tC used for clipping the first offset in
or with a hardware adapted implementation tC2=tC>>1.
The modified pixel values of the pixels next closest to the block boundary are preferably clipped to be within the interval of 0 and M in similarity to the modified pixel values for the pixels closest to the block boundary. Hence, the method steps of
In an embodiment, the modified pixel values of the pixels 13, 23 next closest to the block boundary 1 are calculated as:
Δp=(p2+p0−2×p1+2×Δ)/4
p1′=p1+Δp
Δq=(q2+q0−2×q1−2×Δ)/4
q1′=q1+Δq
Optionally clipping of the second and third offsets and/or the modified pixel values as disclosed above are used.
In alternative embodiment, the computations of the offsets could be performed to be independent of each other.
Δ=(9×(q0−p0)−3×(q1−p1)+8)>>4
p0′=p0+Δ
q0′=q0−Δ
Δp=(p0+p2−2×p1)/4
p1′=p1+Δp+Δ/2
Δq=(q0+q2−2×q1)/4
q1′=q1−Δq−Δ/2
Mathematically this is equivalent as the previously disclosed embodiment. Optional clipping can also be performed for this embodiment.
In an alternative embodiment, the second and third offsets are calculated based on, such as a function, of (p2+p0−2×p1+2×Δ)/4 and (q2+q0−2×q1−2×Δ)/4, respectively. For instance, such function could be adapted for a hardware implementation and/or be an integer representation of (p2+p0−2×p1+2×Δ)/4 and (q2+q0−2×q1−2×Δ)/4. A particular example of such a hardware implementation that produces integer values is to calculate the second offset to be based on, preferably equal to, (((p2+p0+1)>>1)−p1+Δ)>>1. Correspondingly, the third offset is preferably calculated to be based on, preferably equal to, (((q2+q0+1)>>1)−q1−Δ)>>1.
In such a case, the modified pixel values are calculated as:
Δp=(((p2+p0+1)>>1)−p1+Δ)>>1
p1′=p1+Δp
Δq=(((q2+q0+1)>>1)−q1−Δ)>>1
q1′=q1+Δq
or if clipping is used:
Δp=Clip3(−tC2,tC2,(((p2+p0+1)>>1)−p1+Δ)>>1)
p1′=Clip(p1+Δp)
Δq=Clip3(−tC2,tC2,(((q2+q0+1)>>1)−q1−Δ)>>1)
q1′=Clip(q1+Δq)
An alternative embodiment for calculating the second and third offsets, which is adapted for hardware-implementation, is:
Δp=Clip3(−tC2,tC2,((p2+p0−((p1−Δ)>>1)+2)>>2))
Δq=Clip3(−tC2,tC2,((q2+a0−((q1+Δ)>>1)+2)>>2))
wherein >> denotes a left shift operation.
A further alternative embodiment for calculating the second and third offsets, which is adapted for hardware-implementation, is:
Δp=Clip3(−tC2,tC2,((((p2+p0+1)>>1)−p1+Δ+1)>>1))
Δq=Clip3(−tC2,tC2,((((q2+q0+1)>>1)−q1−Δ+1)>>1))
In another embodiment, one can use a stronger low-pass filter in combination with the first offset. In this case the second offset is calculated based on, such as equal to, (p2+p0−2×p1+Δ)/2 or, in a hardware-adapted implementation, based on, preferably equal to, ((p2+p0+1+Δ)>>1) p1 or alternatively ((p2+p0+Δ−(p1>>1)+1)>>1). The third offset could then be calculated based on, such as equal to, (q2+q0−2×q1−Δ)/2 or, in a hardware-adapted implementation, based on, preferably equal to, ((q2+q0+1−Δ)>>1)−q1 or alternatively ((q2+q0−Δ−(q1>>1)+1)>>1).
A particular embodiment calculates the first, second and third offsets for a line of pixels in the block to thereby modify the pixel values of both the pixels closest to the block boundary and the pixels next closest to the block boundary.
In an alternative embodiment, a decision is first made whether to calculate the second and third offsets and thereby whether to modify the pixel values of the pixels next closest to the block boundary in addition to modifying the pixel values of the pixels closest to the block boundary.
In similarity to the embodiments disclosed in the foregoing calculating second and third offsets in order to modify the pixel values of the pixels next closest to the block boundary, fourth and fifth offsets can be calculated in order to modify the pixel values of the pixels second next closest to the block boundary.
The fourth and fifth offsets can, in an alternative embodiment, be calculated to be based on (p3+p1−2×p2+Δp1)/2 and (q3+q1−2×q2+Δq1)/2 respectively, or alternatively (p3+p1−2×p2+2×Δq1)/4 and (q3+q1−2×q2+2×Δp2)/4.
The next two steps modify pixel values based on the fourth and fifth offset. Thus, step S52 modifies the pixel value of the pixel 15 second next closest to the block boundary 1 in the line 12 of pixel 11, 13, 15, 17 in the block 10 by adding the fourth offset to the pixel value of this pixel 15 to form a modified pixel value. Step S53 correspondingly modifies the pixel value of the pixel 25 second next closest to the block boundary 1 in the corresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block 20 by adding the fifth offset to the pixel value of this pixel 25 to form a modified pixel value. Steps S52 and S53 can be performed sequentially in any order or at least partly in parallel.
This concept can also be generalized for the filters modifying more than three pixels from the block boundary. For example, the fourth pixel 17, 27 from the block boundary 1 can be obtained using a combination of the offsets for the third pixels 15, 25 (or the offset from the second pixels 13, 23 or the offset from the first pixels 11, 21) and a symmetrical low-pass filter. Even longer filters are also possible.
In similarity to the previous embodiments, the fourth and fifth offsets can also be clipped. In such a case, the same interval as for the second and third offsets or half that interval could be used. In an alternative embodiment, the clipping interval is −tC3 to tC3, wherein the threshold value tC3 is determined based on the QP value associated with the block. Also the modified pixel values of the pixels second next closest to the block boundary can be clipped to be within the interval of 0 and M as disclosed in
In a particular embodiment the modification of these pixel values are performed according to below:
Δp2=(p3+p1−2×p2+2×Δp1)/4
p2′=p2+Δp2
Δq2=(q3+q1−2×q2+2×Δq1)/4
q2′=q2+Δq2
wherein Δp2,Δq2 denote the fourth and fifth offsets, respectively. Optionally clipping can be performed as described in the foregoing.
A representation of (p3+p1−2×p2+2×Δp1)/4 and (q3+q1−2×q2+2×Δq1)/4 suitable for hardware implementation can be used in order to get the fourth and fifth offsets as integer values. In a particular embodiment, the fourth offset is calculated to be based on, preferably equal to, (((p3+p1+1)>>1)−p2+Δp1)>>1. Correspondingly, (((q3+q1+1)>>1)−q2+Δq1)>>1 is an integer representation for the fifth offset.
The present embodiments are adapted for combating blocking artifacts in connection with coding and decoding of video frames. The embodiments can therefore be applied to such video coding and decoding standards which divide video frames into blocks of pixels and thereby run a risk of having blocking artifacts over block boundaries. Examples of such standards, to which the present embodiments can be applied, are H.264 and HEVC. In particular HEVC, has the possibility to select between a weak filtering mode and a strong filtering mode. The present embodiments can then advantageously be used in the weak filtering mode in order to calculate offsets that are employed to modify the pixel values in a line of pixels and a corresponding line of pixels over a block boundary. Hence, the decisions whether to perform such deblocking filtering according to the prior art HEVC can advantageously be used for the present embodiments.
A particular aspect relates to a method of reducing blocking artifacts at a block boundary between a block of multiple pixels and a neighboring block of multiple pixels in a video frame. With reference to
This particular aspect can be combined with the embodiments discussed in the foregoing in connection with
The method of reducing blocking artifacts according to the embodiment disclosed in
The deblocking filter unit 100 comprises a first offset calculator 110 configured to calculate a first offset based on (9×(q0−p0)−3×(q1−p1))/16 as previously disclosed herein for a line of pixels in a block of pixels in a video frame. A pixel modifier 120 of the deblocking filter unit 100 is configured to modify the pixel value of a pixel closest to a block boundary in the line of pixels in the block by adding the first offset calculated by the first offset calculator 110 to the pixel value of this pixel to form a modified pixel value. The pixel modifier 120 further modifies the pixel value of a pixel closest to the block boundary but in a corresponding line of pixels in a neighboring block of pixels in the video frame. This modification by the pixel value modifier 120 is achieved by subtracting the first offset calculated by the first offset calculator 110 from the pixel value of this pixel to form a modified pixel value.
Hence, in a particular embodiment the pixel modifier 120 is configured to add the first offset to the pixel value of the pixel closest to the block boundary in the line of pixels to form a modified pixel value. The pixel modifier 120 is further configured to subtract the first offset from the pixel value of the pixel closest to the block boundary in the corresponding line of pixels to form a modified pixel value.
In a particular embodiment, the first offset calculator 110 is configured to calculate the first offset to be f ((9×(q0−p0)−3×(q1−p1))/16), i.e. a function ƒ( ) or representation of (9×(q0−p0)−3×(q1−p1))/16. This function preferably outputs an integer representation of (9×(q0−p0)−3×(q1−p1))/16 and preferably the function is suitable for hardware implementation. The first offset calculator 110 is configured, in an embodiment, to calculate the first offset to be based on, preferably equal to, (9×(q0−p0)−3×(q1−p1)+8)>>4.
An optional second clipping unit 240 is implemented in the deblocking filter unit 200 for clipping the modified pixel values calculated by the pixel value modifier 220. Thus, the second clipping unit 240 limits these modified pixel values to be within an interval of zero and the defined maximum value M.
In a preferred embodiment the deblocking filter unit 200 also comprises a second offset calculator 250 configured to calculate a second offset based on (p2+p0−2×p1+2×Δ)/4 for the line of pixels in the block.
In a particular embodiment, the second offset calculator 250 is configured to calculate the second offset to be g((p2+p0−2×p1+2×Δ)/4), i.e. a function g( ) or representation of (p2+p0−2×p1+2×Δ)/4. This function preferably outputs an integer representation of (p2+p0−2×p1+2×Δ)/4 and preferably the function is suitable for hardware implementation. The second offset calculator 250 is configured, in an embodiment, to calculate the second offset to be based on, preferably equal to, (((p2+p0+1)>>1)−p1+Δ)>>1.
The deblocking filter unit 200 preferably comprises a third offset calculator 260 configured to calculate a third offset based on (q2+q0−2×q1−2×Δ)/4 for the corresponding line of pixels in the neighboring block.
In a particular embodiment, the third offset calculator 260 is configured to calculate the third offset to be h((q2+q0−2×q1−2×Δ)/4), i.e. a function h( ) or representation of (q2+q0−2×q1−2×Δ)/4. This function preferably outputs an integer representation of (q2+q0−2×q1−2×Δ)/4 and preferably function is suitable for hardware implementation. The third offset calculator 260 is configured, in an embodiment, to calculate the third offset to be based on, preferably equal to, (((q2+q0+1)>>1)−q1−Δ)>>1.
The pixel modifier 220 of the deblocking filter unit 200 is then furthermore configured to modify the pixel value of the pixel next closest to the block boundary in the line of pixels in the block. The pixel modifier 220 adds the second offset calculated by the second offset calculator 250 to the pixel value of this pixel. The pixel modifier 220 is additionally configured to modify the pixel value of the pixel next closest to the block boundary but in the corresponding line of pixels in the neighboring block. This modification is achieved by adding the third offset calculated by the third offset calculator 260 to the pixel value of this pixel.
An optional third clipping unit 270 of the deblocking filter unit 200 is configured to clip the second offset calculated by the second offset calculator 250 and the third offset calculated by the third offset calculator 260 to be within an interval of −tC2 and tC2. The threshold value tC2 is preferably dependent on the QP value associated with the block and is advantageous calculated based on the threshold value tC used for clipping the first offset. In an alternative embodiment, the third clipping unit 270 is omitted and any clipping of the second and third offsets is instead performed by the first clipping unit 230.
The second clipping unit 240 preferably not only clips the modified pixel values of the pixels closest to the block boundary but also the modified pixel values of the pixels next closest to the block boundary and calculated using the second and third offsets, respectively. Thus, also these modified pixel values are preferably restricted to be within the interval of zero to the defined maximum value M.
The second offset calculator 250 and the third offset calculator 260 could be configured to calculate the second and third offsets for each line of pixels and each corresponding line of pixels for which deblocking filtering is to be applied over the block boundary between the block and the neighboring block. In an alternative approach the deblocking filter unit 200 performs a selection whether to only calculate the first offset and thereby only modify the pixel values of the pixels closest to the block boundary or to calculate both the first, second and third offsets and thereby modify the pixel values of the pixels closest to and the pixels next closest to the block boundary.
In an optional embodiment, the deblocking filter unit 200 can comprise a fourth offset calculator 280 configured to calculate a fourth offset to be based on (p3+p1−2×p2+2×Δp1)/4.
In a particular embodiment, the fourth offset calculator 280 is configured to calculate the fourth offset to be b((p3+p1−2×p2+2×Δp1)/4), i.e. a function b( ) or representation of (p3+p1−2×p2+2×Δp1)/4. This function preferably outputs an integer representation of (p3+p1−2×p2+2×Δp1)/4 and preferably the function is suitable for hardware implementation. The fourth offset calculator 280 is configured, in an embodiment, to calculate the fourth offset to be based on, preferably equal to, (((p3+p1+1)>>1)−p2+Δp1)>>1.
The deblocking filter 200 could also comprise an optional fifth offset calculator 290 configured to calculate a fifth offset to be based on (q3+q1−2×q2+2×Δq1)/4.
In a particular embodiment, the fifth offset calculator 290 is configured to calculate the fifth offset to be k((q3+q1−2×q2+2×Δq1)/4), i.e. a function k( ) or representation of (q3+q1−2×q2+2×Δq1)/4. This function preferably outputs an integer representation of (q3+q1−2×q2+2×Δq1)/4 and preferably the function is suitable for hardware implementation. The fifth offset calculator 290 is configured, in an embodiment, to calculate the fifth offset to be based on, preferably equal to, (((q3+q1+1)>>1)−q2+Δq1)>>1.
In this embodiment, the pixel value modifier 220 is also configured to modify the pixel value of the pixel second next closest to the block boundary in the line of pixels in the block by adding the fourth offset calculated by the fourth offset calculator 280 to the pixel value of this pixel. The pixel value modifier 220 additionally modifies, in this embodiment, the pixel value of the pixel second next closest to the block boundary in the corresponding line of pixels in the neighboring block by adding the fifth offset calculated by the fifth offset calculator to the pixel value of this pixel.
The second clipping unit 240 preferably processes the modified pixel values to restrict them within the interval of zero and the predefined maximum value M. The third clipping unit 270 can also be used to clip the fourth and fifth offsets in similarity to the second and third offsets. Alternatively, the deblocking filter unit 200 comprises a fourth clipping unit configured to clip the fourth and fifth offsets to be within an interval having end points that are defined based on the QP value of the block and preferably based on the threshold value tC.
A particular aspect relates to a deblocking filter unit for reducing blocking artifacts at a block boundary between a block of multiple pixels and a neighboring block of multiple pixels in a video frame. With reference to
Although the respective unit 110, 120 and 210-290 disclosed in conjunction with
Furthermore, the computer 70 comprises at least one computer program product 73 in the form of a non-volatile memory, for instance an EEPROM (Electrically Erasable Programmable Read-Only Memory), a flash memory or a disk drive. The computer program product 73 comprises a computer program 74, which comprises code means which when run on the computer 70, such as by the processing unit 72, causes the computer 70 to perform the steps of the method described in the foregoing in connection with
The computer program 74 may additionally comprise a first clipping module, a second clipping module, a second offset calculating module, a third offset calculating module and optionally also a third clipping module, a fourth offset calculating module and a fifth offset calculating module to perform the operation of the corresponding units 230-290 in
The computer 70 of
The deblocking filter unit 100, 200 of
A current block of pixels is predicted by performing a motion estimation by a motion estimator 50 from an already provided block of pixels in the same frame or in a previous frame. The result of the motion estimation is a motion or displacement vector associated with the reference block, in the case of inter prediction. The motion vector is utilized by a motion compensator 50 for outputting an inter prediction of the block of pixels.
An intra predictor 49 computes an intra prediction of the current block of pixels. The outputs from the motion estimator/compensator 50 and the intra predictor 49 are input in a selector 51 that either selects intra prediction or inter prediction for the current block of pixels. The output from the selector 51 is input to an error calculator in the form of an adder 41 that also receives the pixel values of the current block of pixels. The adder 41 calculates and outputs a residual error as the difference in pixel values between the block of pixels and its prediction.
The error is transformed in a transformer 42, such as by a discrete cosine transform, and quantized by a quantizer 43 followed by coding in an encoder 44, such as by entropy encoder. In inter coding, also the estimated motion vector is brought to the encoder 44 for generating the coded representation of the current block of pixels.
The transformed and quantized residual error for the current block of pixels is also provided to a inverse quantizer 45 and inverse transformer 46 to retrieve the original residual error. This error is added by an adder 47 to the block prediction output from the motion compensator 50 or the intra predictor 49 to create a reference block of pixels that can be used in the prediction and coding of a next block of pixels. This new reference block is first processed by a deblocking filter unit 100 according to the embodiments in order to perform deblocking filtering to combat any blocking artifact. The processed new reference block is then temporarily stored in a frame buffer 48, where it is available to the intra predictor 49 and the motion estimator/compensator 50.
These residual errors are added in an adder 64 to the pixel values of a reference block of pixels. The reference block is determined by a motion estimator/compensator 67 or intra predictor 66, depending on whether inter or intra prediction is performed. A selector 68 is thereby interconnected to the adder 64 and the motion estimator/compensator 67 and the intra predictor 66. The resulting decoded block of pixels output form the adder 64 is input to a deblocking filter unit 100 according to the embodiments in order to deblocking filter any blocking artifacts. The filtered block of pixels is output form the decoder 60 and is furthermore preferably temporarily provided to a frame buffer 65 and can be used as a reference block of pixels for a subsequent block of pixels to be decoded. The frame buffer 65 is thereby connected to the motion estimator/compensator 67 to make the stored blocks of pixels available to the motion estimator/compensator 67.
The output from the adder 64 is preferably also input to the intra predictor 66 to be used as an unfiltered reference block of pixels.
In the embodiments disclosed in
The encoded video frames are brought from the memory 84 to a decoder 60, such as the decoder illustrated in
In
As illustrated in
The embodiments described above are to be understood as a few illustrative examples of the present invention. It will be understood by those skilled in the art that various modifications, combinations and changes may be made to the embodiments without departing from the scope of the present invention. In particular, different part solutions in the different embodiments can be combined in other configurations, where technically possible. The scope of the present invention is, however, defined by the appended claims.
This application is a continuation of U.S. application Ser. No. 13/955,448, filed on Jul. 31, 2013 (published as U.S. Patent Pub 20140050272), which is a continuation of U.S. application Ser. No. 13/583,437, having a §371 date of Sep. 7, 2012 (now U.S. Pat. No. 8,526,509), which is a 35 U.S.C. §371 National Phase Entry Application from PCT/SE2011/051199, filed Oct. 6, 2011, which claims the benefit of U.S. Provisional App. No. 61/432,751, filed Jan. 14, 2011. The above identified applications and publications are incorporated by reference herein in their entirety.
Number | Date | Country | |
---|---|---|---|
61432751 | Jan 2011 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 13955448 | Jul 2013 | US |
Child | 15008013 | US | |
Parent | 13583437 | Sep 2012 | US |
Child | 13955448 | US |