Efficient rounding for deblocking
The present disclosure relates to deblocking filtering which is applicable to smoothing the block boundaries in an image or video coding and decoding. In particular, the deblocking filtering is either strong or weak, wherein the clipping is performed differently in the strong filtering and the weak filtering.
1. An image decoding method comprising:
determining, on a per line basis, (i) whether or not a filter is to be applied to a boundary between a block and a neighboring block adjacent to the block, the block and the neighboring block being included in a reconstructed image corresponding to an encoded image, the neighboring block having a prediction signal different from a prediction signal of the block and a transform coefficient different from a transform coefficient of the block and (ii) a width of the filter when the filter is determined to be applied; and
filtering, on a per line basis, the boundary when the filter is determined to be applied, wherein
in the filtering, when the width of the filter is a first width, sample pixels in a second width are used, the first width being narrower than the second width,
in the filtering, when the width of the filter is a third width, the third width being narrower than the first width, sample pixels in a fourth width are used, the third width being narrower than the fourth width,
in the determining, when determining whether or not the filter is to be applied to a current line, only results of comparing between a value calculated using pixel values and a threshold are used, the pixel values being in the current line and included in the block or the neighboring block, and
in calculating the value using the pixel values, a first difference value between p0 and q0 and a second difference value between p1 and q1 are used, p0 and p1 being pixel values of a first pixel and a second pixel respectively in the current line included in the block, and q0 and q1 being pixel values of a third pixel and a fourth pixel respectively in the current line included in the neighboring block, the first pixel being closest to the boundary, the second pixel being next to the first pixel, the third pixel being closest to the boundary, and the fourth pixel being next to the third pixel.
2. An image decoding apparatus comprising:
processing circuitry, and
storage coupled to the processing circuitry;
wherein the processing circuitry, by using the storage, performs the following:
determining, on a per line basis, (i) whether or not a filter is to be applied to a boundary between a block and a neighboring block adjacent to the block, the block and the neighboring block being included in a reconstructed image corresponding to an encoded image, the neighboring block having a prediction signal different from a prediction signal of the block and a transform coefficient different from a transform coefficient of the block and (ii) a width of the filter when the filter is determined to be applied; and
filtering, on a per line basis, the boundary when the filter is determined to be applied, wherein
in the filtering, when the width of the filter is a first width, sample pixels in a second width are used, the first width being narrower than the second width,
in the filtering, when the width of the filter is a third width, the third width being narrower than the first width, sample pixels in a fourth width are used, the third width being narrower than the fourth width,
in the determining, when determining whether or not the filter is to be applied to a current line, only results of comparing between a value calculated using pixel values and a threshold are used, the pixel values being in the current line and included in the block or the neighboring block, and
in calculating the value using the pixel values, a first difference value between p0 and q0 and a second difference value between p1 and q1 are used, p0 and p1 being pixel values of a first pixel and a second pixel respectively in the current line included in the block, and q0 and q1 being pixel values of a third pixel and a fourth pixel respectively in the current line included in the neighboring block, the first pixel being closest to the boundary, the second pixel being next to the first pixel, the third pixel being closest to the boundary, and the fourth pixel being next to the third pixel.