The present invention generally relates to filtering control and in particular to controlling de-blocking filtering over block boundaries in a video frame.
Encoding of video frames may introduce blocking artifacts to the encoded data. Such blocking artifacts are mainly due to discrete cosine transforms in intra and inter frame prediction error coding. Discontinuities at boundaries between blocks can then become visible to a viewer during reconstruction. Another common source of blocking artifacts is motion compensated prediction.
The traditional approach of combating such blocking artifacts is to use de-blocking filtering. In state of the art video coding, such as H.264, loop filtering with an adaptive de-blocking filter is performed after prediction and residual coding, but before storage of the reconstructed frame for later reference when encoding the following frames, see List et al., Adaptive Deblocking Filter, IEEE Transactions on Circuits and Systems for Video Technology, 2003, 13(7): 614-619. The loop filtering consists of filter decision, filtering operation, clipping function and change of pixel values. The decision to filter the border or not is made based on evaluating several conditions. The filter decision depends on macroblock type, motion vector (MV) difference between neighboring blocks, if one of the neighboring blocks has a coded residual and on the local structure of a current block or the neighboring blocks.
Then the amount of filtering depends on the position of the pixel compared to the block boundary and on the quantization parameter used for residual coding for the current block.
In H.264, a filter decision is made based on pixel values between the block boundary of two neighboring blocks. This applies both to the vertical block boundary and horizontal block boundary. The boundary can be illustrated by pixels a, b, c and d in one block and e, f, g and h in another block where the block boundary is between d and e, see below:
The filter decision is based on comparing three pixel differences with different thresholds. The thresholds are adapted to the quantization parameter (QP). If the following conditions are fulfilled the filter decision is positive |d−e|<T1, |c−d|<T2, and |e−f|<T2, where T1 and T2 are adapted based on QP.
There are two filtering modes in H.264. In the first filtering mode (normal filtering), filtering can be described with a delta value (Δ) that the filtering changes the current value. The filtering for the pixels closest to the block boundary is:
d′=d+Δ
c and e′=e−Δc
where Δc has been clipped off to a threshold ±T3 and is constrained by the QP. More filtering is allowed for high QP than for low QP. Clipping can be described as:
Δc=Max(−T3,Min(T3,Δ))
The filter strength can be increased if any of the following two conditions also holds |b−d|<T2 and |e−g|<T2. The filter strength is also adapted by clipping the delta value less, e.g. to allow for more variation.
The second (strong) filtering mode is only applied for an intra macroblock boundary, when the following condition is fulfilled |d−e|<T1/4.
A significant limitation with the adaptive de-blocking filter employed in H.264 is that the second, strong filtering mode can only be applied over macroblock edges if at least one of the blocks is an intra block. The calculation of the filter decisions in H.264 is furthermore computational complex since several filter decisions must be verified for each row or column in the block to determine whether de-blocking filtering should be applied or not.
US 2006/0078048 discloses a simplification applicable to de-blocking filtering in H.264 that reduces the computational complexity as compared to standard filtering decisions of H.264. The decision test for conducting normal filtering or no filtering is performed on one row or column or a subset of the rows or columns crossing the boundary between two macroblocks. This decision then applies to all rows or columns crossing the same boundary. As a consequence, a single filtering decision is calculated per macroblock boundary and this single filtering decision applies to all lines crossing the macroblock boundary.
A significant limitation with the adaptive de-blocking filtering disclosed in US 2006/0078048 is that only normal filtering is conducted, which can lead to visible artifacts over block boundaries since stronger filtering is not possible.
It is a general objective to provide an efficient de-blocking filtering to combat or reduce blocking artifacts.
This and other objectives are met by embodiments as disclosed herein.
An aspect of the embodiments defines a filtering control method applicable to a block of multiple pixels in a video frame. The method involves calculating a block-specific filter decision value for the block based on pixel values in a predefined subset of the lines of pixels in the block and pixel values in a predefined corresponding subset of corresponding lines of pixels in a neighboring block of multiple pixels in the video frame. This block-specific filter decision value is employed to determine whether any de-blocking filtering should be applied to the current block and over the boundary to the neighboring block or if no de-blocking filtering is needed. If de-blocking filtering should be applied to the current block as determined based on a comparison of the calculated block-specific filter decision value and a block-specific threshold, a respective line-specific filter decision value is calculated for each line of pixels in the block with regard to the boundary. Such a line-specific filter decision value is calculated based on at least one pixel value in the current line and at least one pixel value in a corresponding current line in the neighboring block. The line-specific filter decision value is compared to a line-specific threshold and is employed to determine whether a strong de-blocking filter or a weak de-blocking filter is selected for de-blocking filtering of the current line. The weak de-blocking filter has a comparatively lower filtering strength as compared to the strong de-blocking filter.
Another aspect of the embodiments relates to a filtering control device comprising a block-specific decision value calculator configured to calculate a block-specific filter decision value for a block of multiple pixels in a video frame. The block-specific filter decision value is calculated based on pixel values in a predefined subset of the lines of pixels in the block and pixel values in a predefined corresponding subset of the corresponding lines of pixels in a neighboring block of multiple pixels in the video frame. If the calculated block-specific filter decision value is below a block-specific threshold, a line-specific filter decision value calculator calculates a respective line-specific filter decision value for each line of pixels in the block. The line-specific filter decision value of a line is calculated based on at least one pixel value in the line and at least one pixel value in a corresponding line of pixels in the neighboring block. A threshold comparator is configured to compare the line-specific filter decision value with a line-specific threshold. If the line-specific filter decision value is below the line-specific threshold a filter selector selects a strong de-blocking filter to be applied to the current line, otherwise the filter selector instead selects a weak de-blocking filter.
Further aspects of the embodiments relate to an encoder and a decoder comprising a filtering control device and a media terminal comprising a decoder.
The aspects of the embodiments employ a block-specific filter decision to select whether de-blocking filtering should be applied to a boundary of a current block or not. This means that only a single such filter decision value is needed to make this filtering versus no filtering decision. The block-specific filtering decision is then complemented with respective line-specific decisions for each line in the block to select between strong and weak de-blocking filtering. This leads to a more efficient and better de-blocking filtering.
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 adaptive de-blocking filtering or adaptive loop filtering, as it is sometimes denoted, to combat blocking artifacts over block boundaries in a video frame. The embodiments introduce specific filter decisions that are employed to determine whether to apply any de-blocking filtering at all and whether to apply strong filtering or weak filtering to respective pixel lines in the block. The particular filter decisions together with the possibility of using strong or weak filtering enable efficient reduction of blocking artifacts but without an increase in computation complexity.
The embodiments will now be described in more detail with reference to
In the emerging High Efficiency Video Coding (HEVC) standard, coding units (CU) are used. 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 de-blocking filters. The embodiments can be applied to filter the luminance component, filter the chrominance component(s) or filter both the luminance component and the chrominance component(s). In a particular embodiment, the embodiments are applied to achieve luminance or luma filtering.
Adaptive de-blocking 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 block-specific filter decision value is calculated for the block. The block-specific filter decision value is calculated based on pixel values in a predefined subset of the lines of pixels in the block and based on pixel values in a predefined corresponding subset of corresponding lines of pixels in the neighboring block. A line of pixels in the current block and the corresponding line of pixels in the neighboring block belong to the same horizontal line, i.e. row, extending over a vertical boundary or belong to the same vertical line, i.e. column, extending over a horizontal boundary.
The predefined subset and the predefined corresponding subset each comprise at least one line at a predefined position in the block and the neighboring block, respectively. For instance, if the block-specific filter decision value is calculated based on pixel values in a predefined line in the block and a corresponding predefined line in the neighboring block the predefined lines have a defined row number or column number. For instance, the predefined line could correspond to row number j or column number j in the block and the corresponding predefined line would then be row number j or column number j in the neighboring block. This then means that the predefined line of another block to be subsequently filtered would also correspond to row number j or column number j in that another block.
Correspondingly, if the block-specific filter decision value is calculated based on pixel values in multiple predefined lines of pixels and multiple corresponding predefined lines of pixels, the predefined lines could be row numbers j, j+k or column numbers j, j+k, where k is a defined positive integer.
According to the embodiments, the block-specific filter decision value is calculated based on pixel values in the predefined subset of the lines in the block and pixel values in the predefined corresponding subset of corresponding lines in the neighboring block. This means that if the block and neighboring block, for instance, comprises eight row or columns not all of these eight rows or columns are employed in the calculation of the block-specific filter decision value but rather a subset thereof. In particular embodiments, the predefined subset comprises a single predefined line of pixels or a first predefined line of pixels and a second predefined line of pixels. The corresponding set of corresponding lines then comprises a single corresponding predefined line of pixels or a corresponding first predefined line of pixels and a corresponding second predefined line of pixels. The block-specific filter decision value is then calculated based on the pixel value of at least one, preferably multiple pixels in the predefined line(s) of pixels the pixel value of at least one, preferably multiple pixels in the corresponding predefined line(s) of pixels.
A next step S2 compares the block-specific filter decision value (BS FDV) with a block-specific threshold (TBS). If the block-specific filter decision value is below the block-specific threshold, the method continues to step S3. However, if the block-specific filter decision value is not below the block-specific decision value no de-blocking filtering should be applied to the block with regard to the relevant boundary. This means that the method ends or returns to step S1 where a next block of multiple pixels in the video frame is processed, which is schematically illustrated by the line L2.
If the block-specific filter decision value is below the block-specific threshold as determined in step S2, de-blocking filtering should be applied to the block and the relevant boundary. The method then continues to step S3. Step S3 forms, together with steps S4-S6, a loop that is performed for each line of pixels in the block, i.e. each row or column depending on whether the boundary is vertical or horizontal. Step S3 calculates a line-specific filter decision value for a current line in the block. The line-specific filter decision value is calculated based on at least one pixel value in the current line and at least one pixel value in the corresponding line in the neighboring block. In an embodiment, only a single pixel value in the line and a single pixel value in the corresponding line are employed in the calculation. In other embodiments, multiple, i.e. at least two, pixel values in the line and multiple pixel values in the corresponding line are employed. The at least one pixel value in the line is the pixel value of at least one pixel in predefined position(s) in the line relative the boundary. For instance, if a single pixel value is employed this could correspond to the pixel value of the pixel in the line closest to the boundary. Non-limiting examples of employing multiple pixel values include using the pixel values of the two pixels in the line closest to the boundary, of the three pixels in the line closest to the boundary or of the pixel closest to the line and of the pixel third closest to the line. The corresponding or matching positions of pixels are then employed for the corresponding line in the neighboring block.
The calculated line-specific filter decision value (LS FDV) is compared to a line-specific threshold (TLS) in step S4. If the line-specific filter decision value is below the line-specific threshold the method continues to step S5, where a second or strong de-blocking filter is selected to be applied to pixels in the current line of pixels to filter and change the value of at least one pixel value in the current line. However, if the line-specific filter decision value is not below the line-specific threshold in step S4, the method instead continues to step S6, where a first, normal or weak de-blocking filter is instead selected. The weak de-blocking filter is then applicable to pixels in the current line of pixels to filter and change the value of the at least one pixel value in the current line. The strong de-blocking filter selected in step S5 has then a comparatively higher filtering strength as compared to the weak de-blocking filter selected in step S6.
The loop of steps S3 to S5/S6 is repeated for each line in the block, which is schematically illustrated by the line L1. This means that it could be possible that, for a given block, a strong de-blocking filter is selected for all lines, a weak de-blocking filter is selected for all lines or a strong de-blocking filter is selected for some of the lines whereas a weak de-blocking filter is selected for other lines in the block. The different pixel rows or pixel columns can be processed sequentially starting, for instance, with the upper row or the left-most column and then proceeding towards the bottom row or the right-most column in the block. Alternatively, the different pixel lines in the block can be processed in parallel to speed up the filtering control method.
Once all lines of the block have been processed by the loop of steps S3-S5/S6 the method ends or returns to step S1 for starting anew with another block of pixels in the video frame.
The embodiments therefore achieve a non-complex and computational efficient decision whether to apply de-blocking filtering or not for a given block and boundary. This is combined with line-specific decisions between strong and weak de-blocking filtering for those blocks where the block-specific filter decision concluded that de-blocking filtering should be applied.
Various embodiments of the filter decisions will now be described in more detail.
The block-specific filter decision value is preferably representative of how smooth pixel values in a first predefined line of pixels in the block and in a corresponding predefined first line of pixels in a neighboring block in the video frame are in a direction parallel to the filtering direction and how smooth pixel values in a second predefined line of pixels in the block and in a corresponding second predefined line of pixels in the neighboring block are in a direction parallel to the filtering direction.
The block-specific filter decision preferably, thus, represents the smoothness of the pixel values in a direction parallel to the filtering decision. In other words, the block-specific filter decision investigates whether the pixel values in the first/second predefined lines in the block and the pixel values in the corresponding predefined first/second lines of the neighboring block are smooth, i.e. vary little or at least no more than a defined maximum amount, from a direction parallel to the filtering direction over the block boundary. Such smooth pixel values will give a zero or a low block-specific filter decision value and should therefore be subject to de-blocking filtering since the pixel values are smooth with no or very little structures.
In a particular embodiment the block-specific filter decision value is calculated based on pixel values in a first predefined line 14 in the block 10 and a corresponding first predefined line 24 in the neighboring block 20 and in a second predefined line 16 in the block 10 and a corresponding second predefined line 26 in the neighboring block 10. The first and second predefined lines 14, 16 preferably correspond to predefined row numbers in the block 10 (
The two predefined lines are preferably distributed in the block. The first filter decision value could therefore be calculated as |p22−2p12+p02|+q22−2q12+q02|+|p25−2p15+p05|+|q25−2q15+q05|. In this formula and further herein pki denotes the pixel value of a pixel at row number i and column number k in the block 10, see
Alternative embodiments for calculating the block-specific filter decision value include |p22−2p13+p04|+q22−2q13+q04|+|p25−2p14+p03|+|q25−2q14+q03| or |p22−2p13+p04+p25−2p14+p03|+|q22−2q13+q04+q25−2q14+q03|. In these two embodiments, lines in the block 10 and the corresponding lines in the neighboring block 20 are diagonal lines of multiple pixels.
It is anticipated by the embodiments that in some applications more than one block-specific filter decision value is calculated per block. In such a case, de-blocking filtering will only be applied to a block and a boundary if all these block-specific filter decisions are met, i.e. when each calculated block-specific filter decision value is below its respective block-specific threshold.
A further alternative is to calculate the block-specific filter decision value based on pixel values not in two predefined lines and corresponding predefined lines as described above but rather based on pixel values in four predefined lines in the block and four corresponding predefined lines in the neighboring block:
Variants of this embodiment include using row/column number zero, three, four and seven, row/column number one, two, five and six, row/column number zero, three, five and six or row/column number one, two, four and seven. These embodiments can also be applied to only using two predefined lines and two corresponding predefined lines, such as row/column number two and five.
The filtering control method can be applied to various embodiments of calculating the line-specific filter decision value. For instance, the line-specific filter decision value can be calculated based on the pixel value of the pixel 11 closest to the boundary 1 in the line 12 of pixels 11, 13, 15, 17 and the pixel value of the pixel 21 closest to the boundary 1 in the corresponding line 22 of pixels 21, 23, 25, 27 in the neighboring block 20: |p0i−q0i|. An alternative line-specific filter decision value that can be used according to the embodiments is |p3i−p0i|+|q0i−g3i|, i.e. equal to the sum of the absolute difference between the pixel values of the pixel 11 closest to and the pixel 17 fourth closest to the boundary 1 in the line 12 and the absolute difference between the pixel values of the pixel 21 closest to and the pixel 27 fourth closest to the boundary 1 in the corresponding line 22 of the neighboring block 20. A further example of line-specific filter decision is |2p3i−p2i−2p1i+p0i|+|q0i−2q1i−q2i+2q3i.
The line-specific filter decision value calculated in step S3 could be one out of at least two line-specific filter decision values that are calculated for all lines in the block in step S3. For instance, the decision whether to apply strong de-blocking filtering or weak de-blocking filtering could be based on one, two or three different line-specific filter decision values.
A first such line-specific filter decision value could be indicative of how close pixel values in a current line of pixels approximate a flat line and how close pixel values in a corresponding current line of pixels in the neighboring block approximate a flat line. In a particular embodiment, the first line-specific filter decision is calculated as |p3i−p0i|+|q0i−g3i|. This line-specific filter decision can then be complemented by at least one further line-specific filter decision. The reason for this is that any changes to pixel values caused by strong filtering (step S5 in
The second line-specific filter decision value is preferably representative of an absolute difference between the pixel value of the pixel closest to, in the current line, the block boundary and the pixel value of the pixel in the neighboring block closest to, in the corresponding current line, the block boundary. In other words, the second line-specific filter decision value is preferably equal to |p0i−q0i|. Step S4 then compares the first line-specific filter decision value to a first line-specific threshold and compares the second line-specific filter decision value to a second line-specific threshold. If both of the line-specific filter decision values are below their respective associated line-specific threshold the method continues to step S5 of
Embodiments also comprise using another second line-specific filter decision value that can be applied together with the first line-specific filter decision value discussed above. Alternatively, this another second line-specific filter decision value can be employed as a third line-specific filter decision value together with the above-described first and second line-specific filter decision values. This additional line-specific filter decision value is preferably representative of how smooth pixel values in at least one, preferably two, predefined lines of pixels in the block and in at least one, preferably two, corresponding predefined lines of pixels in the neighboring block are in a direction parallel to the filtering direction. In a preferred embodiment this line-specific filter decision value is calculated as |p22−2p12+p02|+|q22−2q12+q02|+|p25−2p15+p05|+|q25−2q15+q05|. This example of line-specific filter decision value is in fact equal to an embodiment of the block-specific filter decision value calculated in step S1. However, even if the filter decision values are equal the block-specific threshold employed in step S2 and the line-specific threshold employed in step S4 for this example of line-specific filter decision value are preferably different.
In a particular embodiment, the block-specific threshold is determined to be TBS=β, where the parameter β is determined based on the quantization parameter (QP) of the block. Table 1 below defines possible values of β for different possible quantization parameter values.
The particular line-specific threshold(s) determined in step S10 based on the quantization parameter depend(s) on the particular line-specific filter decision(s) employed in the filtering control method. For instance, if the line-specific filter decision value is |p3i−p0i|+|q0i−q3i|, TBS=β>>3, where X>>Y denotes right shift of X by 2Y, i.e. X/2Y.
If the line-specific filter decision value is calculated as |p0i−q0i| the line-specific threshold is preferably defined as TBS=a1×tC. The parameter tC represents a clipping threshold selected for the block based on the quantization parameter according to Table 1 above. The parameter al is a multiplier selected to prevent selecting the strong de-blocking filter if strong filtering with the strong de-blocking filter modifies the pixel value of the pixel closest to, in the current line, the block boundary with a value that is larger than a value which weak filtering with the weak de-blocking filter and the clipping threshold will modify the pixel value. Experimental tests have been conducted and verify that a1=2.5 performs well. Additionally, a value of 2.5 implies that the line-specific threshold can be calculated without any divisions as TBS=(tC×5+1)>>1. If the line-specific filter decision value is calculated as |p22−2p12+p02|+|q22−2q12+q02|+|p25−2p15+p05|+|q25−2q15+q05|, the line-specific threshold is preferably TBS=β>>2.
Hence, a single look-up table, such as Table 1, can be used to derive all the threshold values employed for block-specific of line-specific threshold for the embodiments presented above.
In an embodiment, additional conditions or criteria can be used in addition to the block-specific filter decision in order to decide whether a block boundary between a current block A and a neighboring block B should be filtered. Examples of such additional conditions include:
The above presented conditions i) to vi) are preferably alternatives. This means that if any of the conditions i) to vi) are met for a current block A and if the block-specific filter decision is true, de-blocking filtering should be applied over the block boundary and a strong or weak de-blocking filter should be selected for each line of pixels in the block. This also implies that if none of the conditions i) to vi) are met for a current block A, no de-blocking filtering is preferably conducted for block A and the relevant boundary.
The embodiments can be applied in connection with any strong de-blocking filter employed in the art to combat blocking artifacts. In a particular embodiment, the strong de-blocking filtering is performed with the following set of operations:
p0i′=(p2i+2p1i+2p0i+2q0i+q1i+4)>>3
p1i′=(p2i+p1i+p0i+q0i+2)>>2
p2i=(2p3i+3p2i+p1i+p0i+q0i+4)>>3
q0i′=(p1i+2p0i+2q0i+2q1+q2i+4)>>3
p1i′=(p0i++q0i+q1i+q2i+2)>>2
q2i′=(p0i+q0i+q1i+3q2i+2q3i+4)>>3
where i represents the current line in the block. Hence, with reference to the blocks in
The modified pixel values are preferably also clipped to be forced to be within an allowed pixel value range. In a particular embodiment, the clipping operation forces the modified pixel values to be present within the range of [0, 255], allowing 256 different pixel values. This means that if the modified pixel value after filtering is smaller than 0 or larger than 255 it is replaced by 0 or 255, respectively.
If the comparison in step S4 of
The embodiments can be applied in connection with any weak de-blocking filter employed in the art to combat blocking artifacts. In a particular embodiment, the weak de-blocking filtering is performed with the following set of operations:
p0i′=p0i+Δ0
q0i′=q0i−Δ0
The value Δ0 is calculated in a two-step process with the calculation of an initial Δ0i value, followed by clipping of this value before it is applied to the equations above. In a particular embodiment, Δ0i=(p1i−4p0i+4q0i−qi+4)>>3. The impulse response of the weak de-blocking filter is (1, 4, 4−1)/8. The clipping range of Δ0i is determined based on the quantization parameter of the block.
In this embodiment, the values p1i, q1i are modified if additional filter conditions are met otherwise the pixel values are not modified. In an embodiment, p1i is modified if |p2i−p0i|<T, where T represents a threshold and is preferably determined based on the quantization parameter of the block. If this condition is true, p1i′=p1i+Δp1. The value Δp1 is also calculated in a two-step process starting with calculating an initial value Δp1i=(p2i+((p0i+q0i+1)>>1)−2p1i)>>1. The corresponding impulse response is (1, 0, 0.5, 0.5)/2. Δp1 is then determined as Δp1=Min(Max(−tC,Δp1),tC), where tC is determined based on the quantization parameter of the block and could be determined from a look-up table, such as Table 1 above.
Correspondingly, q1i is modified if |q2i−q0i|<T. If this condition is true, q1i′=q1i+Δq1. The value Δq1 is also calculated in a two-step process starting with calculating an initial value Δq1i=(q2i+((q0i+p0i+1)>>1)−2q1i)>>1 with impulse response (0.5, 0.5, 0, 1)/2. Δq1 is then determined as Δq1=Min(Max(−tC,Δq1i),tC).
In an embodiment, the clipping range for Δ0i is determined based on the value tC and the evaluation of the conditions |p2i−p0i|<T and |q2i−q0i|<T. In such a case, a clipping value tC′ is first set equal to tC and is then incremented by one for each of the conditions |p2i−p0i|<T and |q2i−q0i|<T that are met. In an embodiment, Δ0=Min(Max(−tC′,Δ0i),tC′).
In an alternative embodiment, Δp1i=((((((p0i+q0i+1)>>1)+p2i+1)>>1)−p1i)>>1 and Δq1i=(((((p0i+q0i+1)>>1)+q2i+1)>>1)−q1i)>>1. The impulse responses are (2, 4, 1, 1)/8 and (1, 1, 4, 2)/8. This filtering provides better interpolation properties for the pixel values p2i,q2i compared to using a filter with filter taps (1, 0, 0.5, 0.5)/2. This also reduces the risk of unintentionally introducing artificial edges.
In another embodiment, the weak filtering is performed according to the following operations:
Δ=Clip(−tC,tC,(13(q0i−p0i)+4(q1i−p1i)−5(q2i−p2i)>>5))
p0i′=Clip(0,255,(p0i+Δ))
q0i′=Clip(0,255,(q0i+Δ))
p1i′=Clip(0,255,(p1i+Δ/2))
q1i′=Clip(0,255,(q1i−Δ/2))
where Clip(a, b, X)=Min(Max(a,X),b).
A threshold comparator 130 is configured to compare the block-specific filter decision value calculated by the block-specific filter decision value calculator 110 with a block-specific threshold.
If the block-specific filter decision value is below the block specific threshold as determined by the threshold comparator 130 a line-specific filter decision value calculator 120 of the filtering control device 100 calculates a respective line-specific filter decision value for each line of pixels in the block. The line-specific filter decision value is calculated based on at least one pixel value in the line in the block and at least one pixel value in a corresponding line in the neighboring block. The line-specific filter decision value calculator 120 can calculate the line-specific filter decision values according any of the previously described embodiments. The line-specific filter decision value calculator 120 could also calculate two or more, such as three, different line-specific filter decision values for each line as disclosed herein.
The line-specific filter decision values calculated by the line-specific filter decision value calculator 120 are compared to a line-specific threshold by the threshold comparator 130. If the line-specific filter decision value calculator 120 calculates multiple different line-specific filter decision values per line, the threshold comparator 130 uses different line-specific thresholds for the different line-specific filter decision values as described in the foregoing.
The filtering control device 100 additionally comprises a filter selector 140 configured to select a de-blocking filter to filter at least one pixel value in the current line of pixels if block-specific filter decision value is below the block-specific threshold as determined by the threshold comparator 130. The filter selector 140 then selects de-blocking filter between a strong de-blocking filter and a weak de-blocking filter based on the comparison between the line-specific filter decision value(s) for the current line and the line-specific threshold(s). Thus, if the line-specific filter decision value(s) is(are) below its(their) associated line-specific threshold, the filter selector 140 selects a strong de-blocking filter for the current line. Otherwise the filter selector 140 is configured to select a weak de-blocking filter to filter at least one pixel value in the current line of pixels.
In an optional embodiment, the filtering control device 100 comprises a threshold determiner 150 configured to determine the block-specific and line-specific thresholds. In a particular embodiment, the threshold determiner 150 determines the thresholds for the block based on the quantization parameter selected for residual coding of the block. The threshold determiner 150 then advantageously determines the thresholds as discussed above in connection with Table 1.
The filtering control device 100 could be implemented at least partly in software.
The software includes computer program code elements or software code portions effectuating the operation of at least the block-specific filter decision value calculator 110, the line-specific filter decision value calculator 120, the threshold comparator 130, the filter selector 140 and the optional threshold determiner. The program may be stored in whole or part, on or in one or more suitable volatile computer readable media or data storage means, such as RAM, or one or more non-volatile computer readable media or data storage means, such as magnetic disks, CD-ROMs, DVD disks, hard discs, in ROM or flash memory. The data storage means can be a local data storage means or is remotely provided, such as in a data server. The software may thus be loaded into the operating memory of a computer or equivalent processing system for execution by a processor. The computer/processor does not have to be dedicated to only execute the above-described functions but may also execute other software tasks. A non-limiting example of program code used to define the filtering control device 100 include single instruction multiple data (SIMD) code.
Alternatively the filtering control device can be implemented in hardware. There are numerous variants of circuitry elements that can be used and combined to achieve the functions of the units of the filtering control device. Such variants are encompassed by the embodiments. Particular examples of hardware implementation of the filtering control device is implementation in digital signal processor (DSP) hardware and integrated circuit technology, including both general-purpose electronic circuitry and application-specific circuitry.
A current block of pixels is predicted by performing 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 an 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 filtering control device 100 according to the embodiments in order to determine whether de-blocking filtering will be applied and in such a case what type of de-blocking filter to use. 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 filtering control device 100 according to the embodiments in order to de-blocking 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.
The encoded video frames are brought from the memory 72 to a decoder 60, such as the decoder illustrated in
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.
Number | Date | Country | Kind |
---|---|---|---|
PCT/SE2010/051494 | Dec 2010 | SE | national |
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/SE2011/050105 | 2/1/2011 | WO | 00 | 11/1/2012 |
Number | Date | Country | |
---|---|---|---|
61301732 | Feb 2010 | US | |
61305005 | Feb 2010 | US |