Deblocking filter selection in video or image coding
By adding the gradient check of sample p6 or q6 in the long filter decision of VVC, the problem of deblocking filtering ignoring natural structures in the existing technology is solved, the image quality is improved, and image quality damage is avoided.
Patent Information
- Application Number
- CN202080062477.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-09-04
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2040-09-04
AI Technical Summary
Existing video coding technology fails to effectively detect and retain the natural structure in the image when performing deblocking filtering, resulting in long filter decisions that ignore samples p6 or q6, which may damage the natural texture and affect the image quality.
Add a gradient check that includes at least sample p6 or q6 in VVC's long filter decision, modify the dpq threshold to beta >> 4, and combine or replace a gradient check that includes p6 and/or q6 to avoid errors when natural structures are present Use long filters.
Improved image quality, avoiding the removal or blurring of narrow lines, ensuring the natural structure of the image is preserved.
Smart Images

Figure CN114342380B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to video and / or image encoding and decoding. Background Art
[0002] A video sequence consists of a series of images, where each image consists of one or more components. Each component can be described as a two-dimensional rectangular array of sample values. Images in a video sequence are usually composed of three components; a luma component Y and two chroma components Cb and Cr, where the sample values in the luma component Y are luma values and the sample values in the chroma components are chroma values. Other examples include Y'Cb Cr, Yuv, and ICTCP. In ICTCP, I is the "intensity brightness" component. For the rest of this document, we will refer to any luma component Y', Y, or I as Y or simply luma. The size of the chroma components is generally half of the luma component in each dimension. For example, the size of the luma component of an HD image will be 1920x1080, and the size of the chroma components will be 960x540 each. Components are sometimes referred to as color components.
[0003] A "block" is a two-dimensional array of samples. In video coding, each component is segmented into one or more blocks, and the coded video bitstream is a series of blocks. In video coding, an image is usually segmented into units covering a specific area of the image. Each unit consists of all blocks from all components that make up that specific area, and each block belongs entirely to one unit. Macroblocks in H.264 and Coding Units (CUs) in HEVC are examples of units.
[0004] In HEVC, each image is divided into coding tree units (CTUs). A CTU consists of an NxN block of luma samples and two MxM corresponding chroma blocks. CTUs in HEVC are similar to macroblocks in H.264 and earlier standards, but the CTU size is configurable compared to macroblocks. However, in most cases, the CTU size in HEVC is set to 64x64 luma samples. Each CTU can be recursively quadtree-partitioned. The root of the quadtree is then associated with the CTU. The quadtree is partitioned until a leaf is reached, which is called a coding unit (CU). A CU in HEVC always consists of luma blocks of equal height and width. The partitioning of each CTU is communicated in the bitstream. The CU is also the root node of two other trees, the prediction tree, which has prediction units (PUs) as nodes, and the transform tree, which has transform units (TUs) as nodes. Some decoding processes in HEVC are done at the CU level, some at the PU level, and some at the TU level. The boundaries between PUs and the boundaries between TUs are filtered by a deblocking filter to reduce the discontinuity between TUs and PUs. In HEVC, there are two types of prediction for PUs, namely intra prediction and inter prediction, where intra prediction uses only predictions from previously decoded samples of the current image for prediction, and inter prediction uses predictions from at least one previously decoded image.
[0005] In HEVC, deblocking is applied to vertical boundaries first and then to horizontal boundaries. The boundaries are either TU boundaries or PU boundaries. To enable parallel-friendly deblocking, deblocking is performed on an 8x8 grid of samples.
[0006] For each boundary, a deblocking filter strength parameter (bs) is set. If the value of bs is greater than 0, deblocking can be applied. The greater the boundary strength, the stronger the filtering applied. First, check: if any block at the PU boundary between blocks is an intra-predicted block, then (set bs = 2), or if both blocks use inter-prediction but they use different reference frames or have significantly different motion vectors, then (set bs = 1). Also check: if the TU boundary between blocks has non-zero transform coefficients (code block flag CBF equals 1) in at least one block, then (set bs = 1). This first check sets the boundary strength (bs) greater than 0 to indicate that deblocking should be applied. The greater the boundary strength, the stronger the filtering applied. To reduce / avoid removing natural structures during deblocking, the following check is then applied for luminance: there is no natural structure on each side of the boundary. In HEVC, the following inequality is used to calculate the gradient on each side of the boundary: abs(p0 - 2*p1 + p2) + abs(q0 - 2*q1 + q2) < beta, where beta (also denoted as "β") is a parameter based on the block-based quantization parameter, p0, p1 to p2 are samples on one side of the block boundary, and q0, q1 to q2 are samples on the other side of the block boundary. This condition is checked at two positions along the boundary, and if it is satisfied at both positions, deblocking is performed on the luminance samples for this 4-sample portion of the boundary. If any of the neighboring blocks is intra-coded, the chrominance boundary can always be filtered.
[0007] In the current draft of the VVC specification (VVC draft 6 JVET - O2001 - v14), the coding tree unit (CTU) is similar to the CTU in HEVC, except that the size of the CTU in H.266 is 128x128 luminance samples. In VVC, the CTU can be split more flexibly such that the resulting CUs can consist of rectangular luminance blocks. In VCC, there is no prediction tree or transform tree as in HEVC. However, a CU in VVC can be divided into multiple TUs or into multiple prediction sub-blocks.
[0008] In the current draft of the VCC specification (VVC draft 6JVET-O2001-v14), for a CU, deblocking is first applied to a 4x4 grid on vertical boundaries (CU / implicit TU / prediction subblock boundaries), and then on horizontal boundaries (CU / implicit TU / prediction subblocks). The prediction subblock boundaries inside the CU are filtered on an 8x8 grid. Deblocking is based on HEVC deblocking but also has a longer deblocking filter, if for luma, the size orthogonal to the block boundary is equal to or greater than 32 on at least one side and greater than 4 on the other side, then modify up to 7 samples (read up to 8 samples), if for luma, the size orthogonal to the block boundary is less than 32 on one side, then modify up to 3 samples and read up to 4 samples on that side, and if for chroma, on both sides of the boundary of the chroma samples are equal to or greater than 8, then modify up to 3 chroma samples and read up to 4 chroma samples, otherwise modify up to one sample and read up to two samples on the corresponding side of the boundary.
[0009] The VVC specification (JVET-O2001-v14) specifies the long filters and decisions in the deblocking filter process in section 8.8.3.
[0010] For the segmentation of rows, deblocking decisions are calculated for rows 0 and 4.
[0011] Figure 3 The boundary between a first block 302 (denoted as "P-block") and a second block 304 (denoted as "Q-block") is shown for four rows (rows 0 to 3) and for eight samples (samples 0 to 7) per row and block.
[0012] The following is an excerpt from the VCC specification (JVET-O2001-v14). This excerpt is intended to help you make filter decisions.
[0013] --Begin excerpt--
[0014] 8.8.3.6.1 Decision process for luminance block edges
[0015] The following sequential steps apply: ...
[0017] 1. The variables dp0, dp3, dq0, and dq3 are derived as follows:
[0018] dp0=Abs(p 2,0 -2*p 1,0 +p 0,0 ) (8-1077)
[0019] dp3=Abs(p 2,3 -2*p 1,3 +p 0,3 ) (8-1078)
[0020] dq0=Abs(q 2,0 -2*q 1,0 +q 0,0 ) (8-1079)
[0021] dq3=Abs(q 2,3 -2*q 1,3 +q 0,3 ) (8-1080)
[0022] 2. When maxFilterLengthP and maxFilterLengthQ are both equal to or greater than 3, the variables sp0, sq0, spq0, sp3, sq3, and spq3 are derived as follows:
[0023] sp0=Abs(p 3,0 -p 0,0 ) (8-1081)
[0024] sq0=Abs(q 0,0 -q 3,0 ) (8-1082)
[0025] spq0=Abs(p 0,0 -q 0,0 ) (8-1083)
[0026] sp3=Abs(p 3,3 -p 0,3 ) (8-1084)
[0027] sq3=Abs(q 0,3 -q 3,3 ) (8-1085)
[0028] spq3=Abs(p 0,3 -q 0,3 ) (8-1086)
[0029] 3. Set the variables sidePisLargeBlk and sideQisLargeBlk equal to 0.
[0030] 4. When maxFilterLengthP is greater than 3, set sidePisLargeBlk equal to 1:
[0031] 5. When maxFilterLengthQ is greater than 3, set sideQisLargeBlk equal to 1:
[0032] 6. When edgeType is equal to EDGE_HOR and (yCb+yBl)%CtbSizeY is equal to 0, set sidePisLargeBlk equal to 0.
[0033] 7. Initialize variables dSam0 and dSam3 to 0.
[0034] 8. When sidePisLargeBlk or sideQisLargeBlk is greater than 0, the following applies:
[0035] a. Export variables dp0L, dp3L, and maxFilterLengthP and modify them as follows:
[0036] – If sidePisLargeBlk is equal to 1, the following applies:
[0037] dp0L=(dp0+Abs(p 5,0 -2*p 4,0 +p 3,0 )+1)>>1 (8-1087)
[0038] dp3L=(dp3+Abs(p 5,3 -2*p 4,3 +p 3,3 )+1)>>1 (8-1088)
[0039] – Otherwise, the following applies:
[0040] dp0L=dp0 (8-1089)
[0041] dp3L=dp3 (8-1090)
[0042] maxFilterLengthP = 3 (8-1091)
[0043] b. The variables dq0L and dq3L are derived as follows:
[0044] – If sideQisLargeBlk is equal to 1, the following applies:
[0045] dq0L=(dq0+Abs(q 5,0 -2*q 4,0 +q 3,0 )+1)>>1 (8-1092)
[0046] dq3L=(dq3+Abs(q 5,3 -2*q 4,3 +q 3,3 )+1)>>1 (8-1093)
[0047] – Otherwise, the following applies:
[0048] dq0L=dq0 (8-1094)
[0049] dq3L=dq3 (8-1095)
[0050] c. The variables dpq0L, dpq3L and dL are derived as follows:
[0051] dpq0L=dp0L+dq0L (8-1096)
[0052] dpq3L=dp3L+dq3L (8-1097)
[0053] dL=dpq0L+dpq3L (8-1098)
[0054] d. When dL is less than β, the following steps apply:
[0055] i. Set the variable dpq equal to 2*dpq0L.
[0056] ii. Set the variable sp equal to sp0, the variable sq equal to sq0, and the variable spq equal to spq0.
[0057] iii. Initialize the variables p0, p3, q0, and q3 to 0 first, and then modify them according to sidePisLargeBlk and sideQisLargeBlk as follows:
[0058] – When sidePisLargeBlk is equal to 1, the following applies:
[0059] p3=p 3,0 (8-1099)
[0060] p0=p maxFilterLengthP,0 (8-1100)
[0061] – When sideQisLargeBlk is equal to 1, the following applies:
[0062] q3=q 3,0 (8-1101)
[0063] q0=q maxFilterLengthQ,0 (8-1102)
[0064] iv. For the sample position (xCb+xBl, yCb+yBl), with sample values p0, p3, q0, q3, variables dpq, sp, sq, spq, sidePisLargeBlk, sideQisLargeBlk, β and tC As input, the decision process specified in clause 8.8.3.6.5 is called for luma samples and the output is assigned to decision dSam0.
[0065] v. Set the variable dpq equal to 2*dpq3L.
[0066] vi. Set the variable sp equal to sp3, the variable sq equal to sq3, and the variable spq equal to spq3.
[0067] vii. Initialize the variables p0, p3, q0, and q3 to 0 first, and then modify them according to sidePisLargeBlk and sideQisLargeBlk as follows:
[0068] – When sidePisLargeBlk is equal to 1, the following applies:
[0069] p3=p 3,3 (8-1103)
[0070] p0=p maxFilterLengthP,3 (8-1104)
[0071] – When sideQisLargeBlk is equal to 1, the following applies:
[0072] q3=q 3,3 (8-1105)
[0073] q0=q maxFilterLengthQ,3 (8-1106)
[0074] viii. When edgeType is equal to EDGE_VER for sample position (xCb+xBl, yCb+yBl+3) or edgeType is equal to EDGE_HOR for sample position (xCb+xBl+3, yCb+yBl), variables dpq, sp, sq, spq, sidePisLargeBlk, sideQisLargeBlk, β, and t are equal to sample values p0, p3, q0, q3 C As input, the decision process specified in clause 8.8.3.6.5 is called for luma samples and the output is assigned to decision dSam3.
[0075] 9. The variables dE, dEp and dEq are derived as follows:
[0076] – If dSam0 and dSam3 are both equal to 1, then set the variables dE equal to 3, dEp equal to 1, and dEq equal to 1.
[0077] – Otherwise, the following sequential steps apply:
[0078] a. The variables dpq0, dpq3, dp, dq, and d are derived as follows:
[0079] dpq0=dp0+dq0 (8-1107)
[0080] dpq3=dp3+dq3 (8-1108)
[0081] dp=dp0+dp3 (8-1109)
[0082] dq=dq0+dq3 (8-1110)
[0083] d=dpq0+dpq3 (8-1111)
[0084] b. Set the variables dE, dEp, dEq, sidePisLargeBlk, and sideQisLargeBlk equal to 0.
[0085] c. When d is less than β and maxFilterLengthP and maxFilterLengthQ are both greater than 2, the following ordered steps apply:
[0086] i. Set the variable dpq equal to 2*dpq0.
[0087] ii. Set the variable sp equal to sp0, the variable sq equal to sq0, and the variable spq equal to spq0.
[0088] iii. For the sample position (xCb+xBl, yCb+yBl), with variables p0, p3, q0, q3 (all set equal to 0), variables dpq, sp, sq, spq, sidePisLargeBlk, sideQisLargeBlk, β, and t C The decision process specified in clause 8.8.3.6.5 for luma samples is called as input and the output is assigned to decision dSam0.
[0089] iv. Set the variable dpq equal to 2*dpq3.
[0090] v. Set the variable sp equal to sp3, the variable sq equal to sq3, and the variable spq equal to spq3.
[0091] vi. When edgeType is equal to EDGE_VER for sample position (xCb+xBl, yCb+yBl+3) or edgeType is equal to EDGE_HOR for sample position (xCb+xBl+3, yCb+yBl), variables p0, p3, q0, q3 (all set equal to 0), variables dpq, sp, sq, spq, sidePisLargeBlk, sideQisLargeBlk, β, and t C As input, the decision process specified in Section 8.8.3.6.5 for the sample is called and the output is assigned to the decision dSam3.
[0092] d. When d is less than β, the following sequential steps apply:
[0093] i. Set the variable dE equal to 1.
[0094] ii. When dSam0 is equal to 1 and dSam3 is equal to 1, set the variable dE equal to 2.
[0095] iii. When maxFilterLengthP is greater than 1 and maxFilterLengthQ is greater than 1 and dp is less than (β+(β>>1))>>3, set the variable dEp equal to 1.
[0096] iv. When maxFilterLengthP is greater than 1 and maxFilterLengthQ is greater than 1 and dq is less than (β+(β>>1))>>3, set the variable dEq equal to 1.
[0097] Table 8-18 – Derivation of threshold variables β' and t from input Q C '
[0098] Q 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 β′ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 6 <![CDATA[t C ′]]> 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Q 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 β′ 7 8 9 10 11 12 13 14 15 16 17 18 20 22 24 26 28 <![CDATA[t C ′]]> 0 3 4 4 4 4 5 5 5 5 7 7 8 9 10 10 11 Q 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 β′ 30 32 34 36 38 40 42 44 46 48 50 52 54 56 58 60 62 <![CDATA[t C ′]]> 13 14 15 17 19 21 24 25 29 33 36 41 45 51 57 64 71 Q 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 β′ 64 66 68 70 72 74 76 78 80 82 84 86 88 - - <![CDATA[t C ′]]> 80 89 100 112 125 141 157 177 198 222 250 280 314 352 395
[0099] 8.8.3.6.2 Filtering process for luminance block edges
[0100] …
[0101] Depending on the value of edgeType, the following applies:
[0102] – If edgeType is equal to EDGE_VER, the following ordered steps apply: ..
[0104] 3. When dE equals 3, for each sample position (xCb+xBl, yCb+yBl+k), k=0..3, the following ordered steps apply:
[0105] a. Take sample value p i,k,q j,k (where i = 0..maxFilterLengthP and j = 0..maxFilterLengthQ), set to be equal to the position (xP) of (xCb+xBl-i-1,yCb+yBl+k). i ,yP i ) (where i = 0..maxFilterLengthP-1) and the position (xCb+xBl+j,yCb+yBl+k) set equal to (xCb+xBl+j,yCb+yBl+k) j ,yQ j )(where j = 0..maxFilterLengthQ-1), variables maxFilterLengthP, maxFilterLengthQ and t C As input, the filtering process using the long filter specified in clause 8.8.3.6.7 is invoked on the luma samples and the filtered sample values p are i ′ and q j ’ as output.
[0106] b. Filtered sample value p i ′(i=0..maxFilterLengthP-1) replaces the corresponding sample in the sample array recPicture as follows:
[0107] recPicture[xCb+xBl-i-1][yCb+yBl+k]=p i ' (8-1116)
[0108] c. Filtered sample value q j ′(j=0..maxFilterLengthQ-1) replaces the corresponding sample in the sample array recPicture as follows:
[0109] recPicture[xCb+xBl+j][yCb+yBl+k]=q j ' (8-1117) ...
[0111] – Otherwise (edgeType equals EDGE_HOR), the following ordered steps apply: ...
[0113] 3. When dE equals 3, for each sample position (xCb+xBl+k, yCb+yBl), k=0..3, the following ordered steps apply:
[0114] a. Take sample value p i,k ,qj,k (where i = 0..maxFilterLengthP and j = 0..maxFilterLengthQ), set to be equal to the position (xP) of (xCb+xBl+k,yCb+yBl-i-1). i ,yP i ) (where i = 0..maxFilterLengthP-1) and the position (xQ) set equal to (xCb+xBl+k,yCb+yBl+j) j ,yQ j )(where j = 0..maxFilterLengthQ-1), variables maxFilterLengthP, maxFilterLengthQ and variable t C As input, the filtering process using the long filter specified in clause 8.8.3.6.7 is invoked on the luma samples and the filtered sample values p are i ′ and q j ’ as output.
[0115] b. Filtered sample value p i ′(i=0..maxFilterLengthP-1) replaces the corresponding sample in the sample array recPicture as follows:
[0116] recPicture[xCb+xBl+k][yCb+yBl-i-1]=p i ′ (8-1122)
[0117] c. Filtered sample value q j ′(j=0..maxFilterLengthQ-1) replaces the corresponding sample in the sample array recPicture as follows:
[0118] recPicture[xCb+xBl+k][yCb+yBl+j]=q j ′ (8-1123) ...
[0120] 8.8.3.6.5 Decision process for brightness samples
[0121] The inputs to this process are:
[0122] – sample values p0, p3, q0 and q3,
[0123] – Variables dpq, sp, sq, spq, sidePisLargeBlk, sideQisLargeBlk, β, and t C .
[0124] The output of this process is the variable dSam containing the decision.
[0125] The variables sp and sq are modified as follows:
[0126] – When sidePisLargeBlk is equal to 1, the following applies:
[0127] sp=(sp+Abs(p3-p0)+1)>>1 (8-1158)
[0128] – When sideQisLargeBlk is equal to 1, the following applies:
[0129] sq=(sq+Abs(q3-q0)+1)>>1 (8-1159)
[0130] The variable sThr is derived as follows:
[0131] – If sidePisLargeBlk is equal to 1 or sideQisLargeBlk is equal to 1, then the following applies:
[0132] sThr=3*β>>5 (8-1160)
[0133] – Otherwise, the following applies:
[0134] sThr=β>>3 (8-1161)
[0135] The variable dSam is specified as follows:
[0136] – Set dSam to 1 if all of the following are true:
[0137] –dpq is less than (β>>2),
[0138] –sp+sq is less than sThr,
[0139] –spq is less than (5*t C +1)>>1.
[0140] – Otherwise, set dSam equal to 0. ...
[0142] 8.8.3.6.6 Filtering of luma samples using short filters
[0143] The inputs to this process are:
[0144] – Sample value p i and q i , where i = 0..3,
[0145] –pi and q i Position (xP i ,yP i ) and (xQ i ,yQ i ), where i = 0..2,
[0146] – variable dE,
[0147] – variables dEp and dEq, containing the decision to filter samples p1 and q1 respectively,
[0148] – Variable t C .
[0149] The output of this process is:
[0150] – the number of filtered samples nDp and nDq,
[0151] – The filtered sample value p i ′ and q j ′, where i = 0..nDp–1, j = 0..nDq-1.
[0152] Depending on the value of dE, the following applies:
[0153] – If the variable dE is equal to 2, both nDp and nDq are set equal to 3 and the following strong filtering applies:
[0154] p0′=Clip3(p0-3*t C ,p0+3*t C ,(p2+2*p1+2*p0+2*q0+q1+4)>>3) (8-1162)
[0155] p1′=Clip3(p1-2*t C ,p1+2*t C ,(p2+p1+p0+q0+2)>>2) (8-1163)
[0156] p2′=Clip3(p2-1*t C ,p2+1*t C ,(2*p3+3*p2+p1+p0+q0+4)>>3) (8-1164)
[0157] q0′=Clip3(q0-3*t C ,q0+3*t C ,(p1+2*p0+2*q0+2*q1+q2+4)>>3) (8-1165)
[0158] q1′=Clip3(q1-2*tC ,q1+2*t C ,(p0+q0+q1+q2+2)>>2) (8-1166)
[0159] q2′=Clip3(q2-1*t C ,q2+1*t C ,(p0+q0+q1+3*q2+2*q3+4)>>3) (8-1167)
[0160] – Otherwise, both nDp and nDq are set to 0 and the following weak filtering applies:
[0161] – The following apply:
[0162] Δ=(9*(q0-p0)-3*(q1-p1)+8)>>4 (8-1168)
[0163] –When Abs(Δ) is less than t C *10, the following sequential steps apply:
[0164] – The filtered sample values p0′ and q0′ are specified as follows:
[0165] Δ=Clip3(-t C ,t C ,Δ) (8-1169)
[0166] p0′=Clip1 Y (p0+Δ) (8-1170)
[0167] q0′=Clip1 Y (q0-Δ) (8-1171)
[0168] – When dEp is equal to 1, the filtered sample value p1′ is specified as follows:
[0169] Δp=Clip3(-(t C >>1),t C >>1,(((p2+p0+1)>>1)-p1+Δ)>>1) (8-1172)
[0170] p1′=Clip1 Y (p1+Δp) (8-1173)
[0171] – When dEq is equal to 1, the filtered sample value q1′ is specified as follows:
[0172] Δq=Clip3(-(t C >>1),t C>>1,(((q2+q0+1)>>1)-q1-Δ)>>1) (8-1174)
[0173] q1′=Clip1 Y (q1+Δq) (8-1175)
[0174] – Set nDp equal to dEp+1 and nDq equal to dEq+1.
[0175] Set nDp equal to 0 when nDp is greater than 0 and one or more of the following conditions are true:
[0176] – cu_transquant_bypass_flag is equal to 1 for the coding unit that includes the coding block containing sample p0.
[0177] – pred_mode_plt_flag is equal to 1 for the coding unit that includes the coding block containing the sample p0.
[0178] Set nDq equal to 0 when nDq is greater than 0 and one or more of the following conditions are true:
[0179] – cu_transquant_bypass_flag is equal to 1 for the coding unit that includes the coding block that contains sample q0.
[0180] – pred_mode_plt_flag is equal to 1 for the coding unit that includes the coding block containing sample q0.
[0181] 8.8.3.6.7 Filtering of Luma Samples Using Long Filters
[0182] The inputs to this process are:
[0183] – variables maxFilterLengthP and maxFilterLengthQ,
[0184] – Sample value p i and q j , where i = 0..maxFilterLengthP and j = 0..maxFilterLengthQ,
[0185] –p i and q j Position (xP i ,yP i ) and (xQ j ,yQ j), where i = 0..maxFilterLengthP–1 and j = 0..maxFilterLengthQ-1,
[0186] – Variable t C .
[0187] The output of this process is:
[0188] – The filtered sample value p i ′ and q j ′, where i=0..maxFilterLengthP–1, j=0..maxFilterLenghtQ-1.
[0189] The variable refMiddle is exported as follows:
[0190] – If maxFilterLengthP is equal to maxFilterLengthQ and maxFilterLengthP is equal to 5, then the following applies:
[0191] refMiddle=(p4+p3+2*(p2+p1+p0+q0+q1+q2)+q3+q4+8)>>4 (8-1176)
[0192] – Otherwise, if maxFilterLengthP is equal to maxFilterLengthQ and maxFilterLengthP is not equal to 5, then the following applies:
[0193] refMiddle=(p6+p5+p4+p3+p2+p1+2*(p0+q0)+q1+q2+q3+q4+q5+q6+8)>>4 (8-1177)
[0194] – Otherwise, if one of the following conditions is true,
[0195] – maxFilterLengthQ is equal to 7 and maxFilterLengthP is equal to 5,
[0196] – maxFilterLengthQ is equal to 5 and maxFilterLengthP is equal to 7,
[0197] Then the following applies:
[0198] refMiddle=(p4+p3+2*(p2+p1+p0+q0+q1+q2)+q3+q4+8)>>4 (8-1178)
[0199] – Otherwise, if one of the following conditions is true,
[0200] – maxFilterLengthQ is equal to 5 and maxFilterLengthP is equal to 3,
[0201] – maxFilterLengthQ is equal to 3 and maxFilterLengthP is equal to 5,
[0202] Then the following applies:
[0203] refMiddle=(p3+p2+p1+p0+q0+q1+q2+q3+4)>>3 (8-1179)
[0204] – Otherwise, if maxFilterLengthQ is equal to 7 and maxFilterLengthP is equal to 3, the following applies:
[0205] refMiddle=(2*(p2+p1+p0+q0)+p0+p1+q1+q2+q3+q4+q5+q6+8)>>4 (8-1180)
[0206] – Otherwise, the following applies:
[0207] refMiddle=(p6+p5+p4+p3+p2+p1+2*(q2+q1+q0+p0)+q0+q1+8)>>4 (8-1181)
[0208] The variables refP and refQ are derived as follows:
[0209] refP=(p maxFilterLengtP +p maxFilterLengthP-1 +1)>>1 (8-1182)
[0210] refQ=(q maxFilterLengtQ +q maxFilterLengthQ-1 +1)>>1 (8-1183)
[0211] Variable f i and t C PD i Defined as follows:
[0212] – If maxFilterLengthP is equal to 7, the following applies:
[0213] f 0..6 ={59,50,41,32,23,14,5} (8-1184)
[0214] t C PD 0..6 ={6,5,4,3,2,1,1} (8-1185)
[0215] – Otherwise, if maxFilterLengthP is equal to 5, the following applies:
[0216] f 0..4 ={58,45,32,19,6} (8-1186)
[0217] t C PD 0..4 ={6,5,4,3,2} (8-1187)
[0218] – Otherwise, the following applies:
[0219] f 0..2 ={53,32,11} (8-1188)
[0220] t C PD 0..2 ={6,4,2} (8-1189)
[0221] Variable g j and t C QD j Defined as follows:
[0222] – If maxFilterLengthQ is equal to 7, the following applies:
[0223] g 0..6 ={59,50,41,32,23,14,5} (8-1190)
[0224] t C QD 0..6 ={6,5,4,3,2,1,1} (8-1191)
[0225] – Otherwise, if maxFilterLengthQ is equal to 5, the following applies:
[0226] g 0..4 ={58,45,32,19,6} (8-1192)
[0227] t C QD 0..4 ={6,5,4,3,2} (8-1193)
[0228] – Otherwise, the following applies:
[0229] g 0..2 ={53,32,11} (8-1194)
[0230] t C QD 0..2={6,4,2} (8-1195)
[0231] The filtered sample value p i ′ and q j ′ (where i=0..maxFilterLengthP–1 and j=0..maxFilterLengthQ-1) is derived as follows:
[0232] p i ′=Clip3(p i -(t C *t C PD i )>>1,p i +(t C *t C PD i )>>1,(refMiddle*f i +refP*(64-f i )+32)>>6) (8-1196)
[0233] q j ′=Clip3(q j -(t C *t C QD j )>>1,q j +(t C *t C QD j )>>1,(refMiddle*g j +refQ*(64-g j )+32)>>6) (8-1197)
[0234] When one or more of the following conditions are true, the filtered sample value p i ′ is replaced by the corresponding input sample value p i , where i = 0..maxFilterLengthP-1:
[0235] – cu_transquant_bypass_flag is equal to 1 for the coding unit that includes the following coding block: the coding block contains sample p i .
[0236] – pred_mode_plt_flag is equal to 1 for a coding unit that includes a coding block containing sample p i .
[0237] When one or more of the following conditions are true, the filtered sample value q i ′ is replaced by the corresponding input sample value qj , where j = 0..maxFilterLengthQ-1:
[0238] – cu_transquant_bypass_flag is equal to 1 for the coding unit that includes the following coding block: the coding block contains samples q i .
[0239] – pred_mode_plt_flag is equal to 1 for a coding unit that includes a coding block containing sample q i . ...
[0241] --END EXCERPT-- Summary of the invention
[0242] There are certain challenges. For example, the decision to filter a long filter for 7 samples on one or both sides does not consider sample p6 of block P or q6 of block Q, which can enable long filtering despite the fact that such long filtering can degrade image quality (e.g., damage natural textures) by modifying p6 and / or q6.
[0243] Here, the following are examples of sample values that cross the boundary between block P (p0 to p7) and block Q (q0 to q7), where p0 and q0 are adjacent to the boundary, which the current long filter decision completely ignores and thus may apply deblocking that removes natural texture:
[0244] Sample: p7 p6 p5 p4 p3 p2 p1 p0|q0 q1 q2 q3 q4 q5 q6 q7
[0245] In the case where p6 and q6 are larger or smaller than the neighborhood samples shown in Example 1, the peak in sample p6 or q6 cannot be detected.
[0246] Example 1 10 0 10 10 10 10 10 10|10 10 10 10 10 10 0 10
[0247] In the case where p4, p5, p6, q4, q5, and q6 are larger or smaller than the neighborhood samples shown in Example 2, the peak in sample p5 or q5 cannot be detected.
[0248] Example 2 10 20 30 20 10 10 10 10|10 10 10 10 20 30 20 10
[0249] To overcome this problem, the present disclosure proposes an embodiment of modifying the long filter decision in VVC by adding at least one gradient check including at least sample p6 or q6. This makes it possible to avoid using a long filter when there is some natural structure at sample p6 or q6. In a specific embodiment, at least two gradient checks including both q6 and p6 are added. In another embodiment, the dpq threshold is modified from beta>>2 to beta>>4. This threshold change embodiment can be used in combination with an embodiment in which a gradient check including p6 and / or q6 is added to the long filter decision or the threshold change embodiment can be used instead of an embodiment in which a gradient check including p6 and / or q6 is added to the long filter decision. The advantage of the proposed embodiment is that the quality of the image displayed to the user is improved (for example, it avoids removing narrow lines or blurring narrow lines).
[0250] Thus, in one aspect, a method (400) of filtering sample values associated with an image is provided. The method comprises: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i,k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_i,k, where i=0-7 and k=0-3. The method further comprises: deciding (s404) whether to filter at least a subset of the first set of sample values using a long filter. Deciding whether to filter at least a subset of the first set of sample values using a long filter comprises: calculating (s502) a first gradient value maxGradB1_6,0 using the sample value B1_6,0; calculating (s504) a first pq value pq1_0 using maxGradB1_6,0; and comparing pq1_0 to a threshold value (s508). In another aspect, an apparatus configured to perform the method is provided.
[0251] In another aspect, a method (400) for filtering sample values associated with an image is provided. The method comprises: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i,k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_i,k, where i=0-7 and k=0-3. The method further comprises: selecting (s404) a filter. Selecting the filter comprises: calculating (s504) a first pq value pq2_0 using at least a first value equal to Abs(B1_2, 0-2*B1_1, 0+B1_0, 0) and a second value equal to Abs(B2_2, 0-2*B2_1, 0+B2_0, 0); and comparing pq2_0 to a threshold value (s508), wherein the threshold value is equal to β>>4, and β is selected from a set of predetermined β values based on a quantization parameter value Q. In another aspect, an apparatus configured to perform the method is provided.
[0252] In another aspect, a method for filtering sample values associated with an image is provided. The method comprises: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i,k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_i,k, where i=0-7 and k=0-3. The method further comprises: selecting (s404) a filter. Selecting the filter includes: i) calculating a first pq value pq1_0, wherein calculating pq1_0 includes calculating a value sp, calculating a value sq, and calculating sp+sq, wherein pq1_0=(sp+sq); ii) comparing pq1_0 with a first threshold; iii) calculating (s504) a second pq value pq2_0 using at least a first value equal to Abs(B1_2, 0-2*B1_1, 0+B1_0, 0) and a second value equal to Abs(B2_2, 0-2*B2_1, 0+B2_0, 0); and iv) comparing pq2_0 with a second threshold (s508), wherein the second threshold is equal to β>>4, and β is selected from a set of predetermined β values based on a quantization parameter value Q. In another aspect, an apparatus configured to perform the method is provided. BRIEF DESCRIPTION OF THE DRAWINGS
[0253] Figure 1 is a schematic block diagram of a video encoder according to an embodiment.
[0254] Figure 2 is a schematic block diagram of a video decoder according to an embodiment.
[0255] Figure 3 The boundary between a first block (denoted as P-block) and a second block (denoted as Q-block) is shown.
[0256] Figure 4 is a flow chart illustrating a process according to an embodiment.
[0257] Figure 5 is a flow chart illustrating a process according to an embodiment.
[0258] Figure 6 is a block diagram of an apparatus according to an embodiment.
[0259] Figure 7 is a functional block diagram of an apparatus according to an embodiment. DETAILED DESCRIPTION
[0260] The embodiments described herein may be used in a video encoder or a video decoder to deblock vertical and / or horizontal block boundaries. They may also be applied to an image encoder or an image decoder to deblock vertical and / or horizontal block boundaries.
[0261] Figure 1 is a schematic block diagram of a video encoder 140 for encoding blocks of pixels in video images (also called frames) of a video sequence according to some embodiments.
[0262] The current pixel block is predicted by performing motion estimation based on pixel blocks already provided in the same frame or in a previous frame using a motion estimator 150. In the case of inter-frame prediction, the result of the motion estimation is a motion or displacement vector associated with a reference block. The motion vector can be used by the motion compensator 150 to output an inter-frame prediction of the pixel block.
[0263] Intra-frame predictor 149 calculates an intra-frame prediction for the current pixel block. The outputs of motion estimator / compensator 150 and intra-frame predictor 149 are input to selector 151, which selects intra-frame prediction or inter-frame prediction for the current pixel block. The output of selector 151 is input to an error calculator in the form of adder 141, which also receives the pixel values of the current pixel block. Adder 141 calculates and outputs a residual error as the pixel value difference between the pixel block and its prediction.
[0264] The error is transformed in transformer 142 (e.g., by discrete cosine transform), quantized by quantizer 143, and then encoded (e.g., by entropy encoder) in encoder 144. In inter-coding, the estimated motion vector is also brought to encoder 144 to generate an encoded representation of the current pixel block.
[0265] The transformed and quantized residual error of the current pixel block is also provided to the inverse quantizer 145 and the inverse transformer 146 to obtain the original residual error. The adder 147 adds the error to the block prediction output from the motion compensator 150 or the intra-frame predictor 149 to create a reference pixel block that can be used for prediction and encoding of the next pixel block. According to the examples / embodiments discussed below, the deblocking filter 100 first processes the new reference block to perform deblocking filtering to reduce / combat block artifacts. The processed new reference block is then temporarily stored in the frame buffer 148, where the processed new reference block can be used for the intra-frame predictor 149 and the motion estimator / compensator 150.
[0266] Figure 2 1 is a corresponding schematic block diagram of a video decoder 260 including the deblocking filter 100 according to some embodiments. The decoder 260 includes a decoder 261 (e.g., an entropy decoder) to decode the encoded representation of the pixel block to obtain a set of quantized and transformed residual errors. These residual errors are dequantized by an inverse quantizer 262 and inversely transformed by an inverse transformer 263 to provide a set of residual errors.
[0267] These residual errors are added to the pixel values of the reference pixel block by the adder 264. Depending on whether inter-frame prediction or intra-frame prediction is performed, the reference block is determined by the motion estimator / compensator 267 or the intra-frame predictor 266. The selector 268 is thus interconnected to the adder 264 and the motion estimator / compensator 267 and the intra-frame predictor 266. According to some embodiments of the present invention, the resulting decoded pixel block output from the adder 264 is input to the deblocking filter 100 to provide deblocking filtering of block artifacts. The filtered pixel block is output from the decoder 260 and can be further temporarily provided to the frame buffer 265 to be used as a reference pixel block for a subsequent pixel block to be decoded. The frame buffer 265 is thus connected to the motion estimator / compensator 267 to make the stored pixel block available to the motion estimator / compensator 267.
[0268] The output of the adder 264 may also be input to the intra predictor 266 to be used as an unfiltered reference pixel block.
[0269] exist Figure 1 and Figure 2In the embodiment of the decoder 260, the deblocking filter 100 can perform deblocking filtering as a so-called loop filtering. In an alternative embodiment of the decoder 260, the deblocking filter 100 can be arranged to perform so-called post-processing filtering. In this case, the deblocking filter 100 operates on the output frame outside the loop formed by the adder 264, the frame buffer 265, the intra-frame predictor 266, the motion estimator / compensator 267 and the selector 268. In this embodiment, deblocking filtering is usually not performed in the encoder. The operation of the deblocking filter 100 will be discussed in more detail below.
[0270] When the maximum number of samples that can be modified on at least one side of a block boundary is determined to be 7 samples and the boundary strength is determined to be greater than 0 for a row of samples, the long filter decision is based on: if maxFilterLengthP is equal to 7, then the sample value p6 in block P is used to determine the gradient value (denoted as "magGradp6") (e.g., the magnitude of the gradient); if maxFilterLengthQ is equal to 7, then the sample value q6 in block P is used to determine the gradient value (denoted as "magGradq6").
[0271] In one embodiment, calculating magGradp6 includes using p6 and using at least one of p3, p4, p5, and p7 to calculate magGradp6, and calculating magGradq6 includes using q6 and using at least one of q3, q4, q5, and q7 to calculate magGradp6.
[0272] Alternative 1
[0273] The magGradp6 value is added to other gradient calculations involving at least samples p0, p3, and p7. For example, the value sp is calculated as:
[0274] sp=(Abs(p0–p3)+Abs(p3–p7)+magGradp6+1)>>1
[0275] The magGradq6 value is added to the other gradient calculations that include at least samples q0, q3, and q7. For example, the value sq is calculated as:
[0276] sq=(Abs(q0–q3)+Abs(q3–q7)+magGradq6+1)>>1.
[0277] The value spq can then be calculated, where spq=sp+sq.
[0278] dp=(Abs(p0–2*p1+p2)+Abs(p3–2*p4+p5)+1)>>1.
[0279] dq=(Abs(q0–2*q1+q2)+Abs(q3–2*q4+q5)+1)>>1.
[0280] Alternative 2
[0281] The magGradp6 value replaces the magnitude calculated when maxFilterLengthP is equal to 5, as shown below:
[0282] If maxFilterLengthP==7, then
[0283] dp=(Abs(p0–2*p1+p2)+magGradp6+1)>>1, otherwise
[0284] dp=(Abs(p0–2*p1+p2)+Abs(p3–2*p4+p5)+1)>>1.
[0285] The magGradq6 value replaces the magnitude calculated when maxFilterLengthQ is equal to 5, as shown below:
[0286] If maxFilterLengthQ==7, then
[0287] dq=(Abs(q0–2*q1+q2)+magGradq6+1)>>1, otherwise
[0288] dq=(Abs(q0–2*q1+q2)+Abs(q3–2*q4+q5)+1)>>1.
[0289] The value dpq is then calculated as dpq=dq+dp.
[0290] For alternative 1 or alternative 2 above, in one embodiment, the decision to use the long filter is made if all three of the following conditions are true:
[0291] (1) spq < threshold 1,
[0292] (2) 2*dpq < threshold 2, and
[0293] (Abs(p0–q0)<threshold 3.
[0294] If one or more of the above conditions are not true, the long filter is not applied and maxFilterLengthP and maxFilterLengthQ are equal to or less than 3.
[0295] In one embodiment, the threshold value l=sThr (eg, (3*beta)>>5).
[0296] In one embodiment, threshold 2=beta>>2, where beta depends on the quantization parameter value Q, as shown in Tables 8-18 above.
[0297] In one embodiment, threshold 3=(5*tC+1)>>1, where tC depends on the quantization parameter value Q, as shown in Tables 8-18 above.
[0298] For Alternative 1 or Alternative 2 above, in one embodiment, magGradp6 is determined as: Abs(p6-p7), and magGradq6 is determined as: Abs(q7-q6).
[0299] In another embodiment, magGradp6 is equal to Abs(p4–p5–p6+p7) and magGradq6 is equal to Abs(q7–q5–q6+q4). One benefit of this embodiment, compared to embodiments where the gradient is determined based on the difference between two samples, is that this method of determining the gradient magnitude does not increase sensitivity to slopes having increasing or decreasing values from p0 to p7 or from q0 to p7.
[0300] In another embodiment, magGradp6 is equal to Abs(p4-2*p5+p6) and magGradq6 is equal to Abs(q6-2*q5+q4). A benefit of this embodiment over the embodiment where the gradient is determined based on the difference between two samples is that this method of determining the gradient magnitude does not increase sensitivity to slopes having increasing or decreasing values from p0 to p7 or from q0 to p7.
[0301] For Alternative 1, equations 8-1081, 8-1082, 8-1084, and 8-1085 of section 8.8.3.6.1 of the specification can be modified as follows:
[0302] sp0=maxFilterLengthP==7? Abs(p3,0-p0,0)+magGradp6_0:Abs(p3,0-p0,0)(8-1081),
[0303] sq0=maxFilterLengthQ==7? Abs(q0,0-q3,0)+magGradq6_0:Abs(q0,0-q3,0)(8-1082),
[0304] sp3=maxFilterLengthP==7? Abs(p3,3-p0,3)+magGradp6_3:Abs(p3,3-p0,3)(8-1084),
[0305] sq3=maxFilterLengthQ==7? Abs(q0,3-q3,3)+magGradq6_3:Abs(q0,3-q3,3)(8-1085),
[0306] in
[0307] magGradp6_0=Abs(p7,0-p6,0) or Abs(p7,0-p6,0-p5,0+p4,0) or Abs(p6,0-2*p5,0+p4,0);
[0308] magGradp6_3=Abs(p7,3-p6,3) or Abs(p7,3-p6,3-p5,3+p4,3) or Abs(p6,3-2*p5,3+p4,3);
[0309] magGradq6_0=Abs(q6,0-q7,0) or Abs(q4,0-q6,0-q5,0+q7,0) or Abs(q4,0-2*q5,0+q6,0); and
[0310] magGradq6_3=Abs(q6,3-q7,3) or Abs(q4,3-q6,3-q5,3+q7,3) or Abs(q4,3-2*q5,3+q6,3).
[0311] For Alternative 2, equations 8-1087, 8-1088, 8-1092, and 8-1093 in section 8.8.3.6.1 of the specification can be modified as follows:
[0312] dp0L=(dp0+(maxFilterLengthP==7?magGradp6_0:Abs(p5,0-2*p4,0+p3,0))+1)>>1 (8-1087),
[0313] dp3L=(dp3+(maxFilterLEngthP==7?magGradp6_3:Abs(p5,3-2*p4,3+p3,3))+1)>>1 (8 1088),
[0314] dq0L=(dq0+(maxFilterLEngthQ==7?magGradq6_0:Abs(q5,0-2*q4,0+q3,0))+1)>>1 (8-1092),
[0315] dq3L=(dq3+(maxFilterLengthQ==7?magGradq6_3:Abs(q5,3-2*q4,3+q3,3))+1)>>1 (8-1093).
[0316] in
[0317] magGradp6_0=Abs(p7,0-p6,0-p5,0+p4,0) or Abs(p6,0-2*p5,0+p4,0);
[0318] magGradp6_3=Abs(p7,3-p6,3-p5,3+p4,3) or Abs(p6,3-2*p5,3+p4,3);
[0319] magGradq6_0=Abs(q4,0-q6,0-q5,0+q7,0)or Abs(q4,0-2*q5,0+q6,0); and
[0320] magGradq6_3=Abs(q4,3-q6,3-q5,3+q7,3) or Abs(q4,3-2*q5,3+q6,3).
[0321] In another embodiment, the dpq threshold (also called "threshold 2" is modified so that threshold 2 is equal to beta>>4, rather than beta>>2. In this embodiment, section 8.8.3.6.5 is modified as follows:
[0322]
[0323] In another embodiment, the dqp threshold modification is also applied to the strong / weak filter decision. In this embodiment, Section 8.8.3.6.5 is modified as follows:
[0324]
[0325]
[0326] Figure 4 is a flow chart illustrating a process 400 according to some embodiments. The process 400 may start at step s402.
[0327] Step s402 includes obtaining a first set of sample values. In one embodiment, the first set of sample values includes a first block of sample values (e.g., block 302) (hereinafter referred to as a P block) and a second block of sample values (e.g., block 304) (hereinafter referred to as a Q block). In one embodiment, Figure 3As shown, a P block comprises a set of sample values pi,k, where i=0 to 7 and k=0 to 3, and a q block comprises a set of sample values qi,k, where i=0 to 7 and k=0 to 3.
[0328] Step s404 comprises selecting a filter for filtering at least a subset of the first set of sample values (e.g., sample values pi,k, where i=0 to 7 and k=0 to 3 and / or sample values qi,k, where i=0 to 7 and k=0 to 3). For example, step s404 may comprise deciding whether to filter at least the subset of the first set of sample values using a long filter, or deciding whether strong filtering should be applied (see, e.g., VVC specification 8.8.3.6.6).
[0329] Step s406 comprises: applying the selected filter.
[0330] Figure 5 is a flow chart illustrating a process 500 for performing step s404 according to one embodiment. The process 500 may start from step s501. Step s501 includes initializing three variables k, dSam_0 and dSam_3, wherein all these variables are initialized to zero.
[0331] After step s501, process 500 may include performing steps s502 and s504 or alternatively performing step s506. Steps s502 and s504 are performed assuming maxFilterLengthP=7.
[0332] Step s502 includes calculating a first gradient value maxGradp6_k using the sample value p6, k. For example, calculating maxGradp6_k includes: calculating Abs(p7, k-p6, k) or calculating Abs(p7, k-p6, k-p5, k+p4, k) or calculating Abs(p6, k-2*p5, k+p4, k).
[0333] Step s504 includes calculating three pq values (pq1, pq2 and pq3), wherein at least pq1 is calculated using maxGradp6_k.
[0334] For example, in one embodiment, calculating pql includes: calculating the value sp+sq, where calculating sp includes calculating sp=(Abs(p0, k–p3, k)+Abs(p3, k–p7, k)+magGradp6_k+1)>>1. Calculating sq may include calculating: (Abs(q0, k–q3, k)+Abs(q3, k–q7, k)+magGradq6_k+1)>>1, where magGradq6_k is equal to: Abs(q7, k-q6, k) or Abs(q7, k-q6, k-q5, k+q4, k) or Abs(q6, k-2*q5, k+q4, k).
[0335] In another embodiment, calculating pql includes calculating 2*(dp+dq), wherein calculating dp includes calculating dp=(Abs(p0, k−2*p1, k+p2, k)+magGradp6_k+1)>>1. Calculating dq may include calculating (Abs(q0, k−2*q1, k+q2, k)+magGradq6_k+1)>>1.
[0336] Step s506 includes calculating three pq values (pq1, pq2, and pq3) without using maxGradp6_k (ie, without using sample value p6,k). In one embodiment, pq1 = sp + sq; pq2 = dpq; and pq3 = Abs (p0, k - q0, k).
[0337] Step s508 comprises: i) comparing pq1 with a first threshold value (t1), ii) comparing pq2 with a second threshold value (t2), and iii) comparing pq3 with a third threshold value (t3).
[0338] If pq1 is less than t1, and pq2 is less than t2, and pq3 is less than t3, then process 500 proceeds to step s510, otherwise proceeds to step s509 (ie, selects the first filter (eg, applies short filtering)).
[0339] Step s510 includes checking whether k is equal to 3. If k is not equal to 3, the process 500 proceeds to step s512, otherwise to step s516. In step s512, k is set equal to 3 and dSam_0 is set to 1. After step s512, the process returns to step s502 or s506. Step s516 includes checking whether dSam_0 is equal to 1. If not, the process 500 proceeds to step s509, otherwise the process 500 proceeds to step s518 (i.e., selecting a second filter (e.g., applying long filtering)).
[0340] In an embodiment where step s506 is performed instead of steps s502 and s504, pql is equal to 2*(dp+dq), where
[0341] dp=(Abs(p0–2*p1+p2)+Abs(p5-2*p4+p3)+1)>>1, and
[0342] dq=(Abs(q0−2*q1+q2)+Abs(q5−2*q4+q3)+1)>>1. In such an embodiment, the first threshold (t1) may be equal to beta>>4.
[0343] Figure 6 6 is a block diagram of an apparatus 600 for implementing the video encoder 140 or the video decoder 260 according to some embodiments. Figure 6As shown, the device 600 may include: a processing circuit (PC) 602, which may include one or more processors (P) 655 (e.g., a general-purpose microprocessor and / or one or more other processors, such as an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), etc.), which may be co-located in a single housing or in a single data center, or may be geographically distributed (i.e., the device 600 may be a distributed computing device); a network interface 648, including a transmitter (Tx) 645 and a receiver (Rx) 647, for enabling the device 600 to send data to and receive data from other nodes connected to a network 110 (e.g., an Internet Protocol (IP) network), the network 110 being (directly or indirectly) connected to the network interface 648 (e.g., the network interface 648 may be wirelessly connected to the network 110, in which case the network interface 648 is connected to an antenna arrangement); and a local storage unit (also referred to as a "data storage system") 608, which may include one or more non-volatile storage devices and / or one or more volatile storage devices. In embodiments where the PC 602 includes a programmable processor, a computer program product (CPP) 641 may be provided. The CPP 641 includes a computer readable medium (CRM) 642 storing a computer program (CP) 643, which includes computer readable instructions (CRI) 644. The CRM 642 may be a non-transitory computer readable medium, such as a magnetic medium (e.g., a hard disk), an optical medium, a memory device (e.g., a random access memory, a flash memory), etc. In some embodiments, the CRI 644 of the computer program 643 is configured such that when executed by the PC 602, the CRI causes the device 600 to perform the steps described herein (e.g., the steps described herein with reference to the flowcharts). In other embodiments, the device 600 may be configured to perform the steps described herein without the need for code. That is, for example, the PC 602 may consist solely of one or more ASICs. Thus, the features of the embodiments described herein may be implemented in hardware and / or software.
[0344] Figure 7 is a functional block diagram of an apparatus 600 according to some other embodiments. The apparatus 600 comprises an obtaining module 702 and a filter selection module 704. The obtaining module 702 is adapted to obtain a first set of sample values, the first set of sample values comprising a first block of sample values (hereinafter referred to as a P block) and a second block of sample values (hereinafter referred to as a Q block), wherein the P block comprises a set of sample values pi,k, where i=0-7 and k=0-3, and the Q block comprises a set of sample values qi,k, where i=0-7 and k=0-3.
[0345] In one embodiment, the filter selection module is adapted to decide whether to use a long filter to filter at least a subset of the first set of sample values, wherein the filter selection module is configured to decide whether to use a long filter to filter at least a subset of the first set of sample values by performing a process comprising: calculating a first gradient value maxGradp6_0 using the sample value p6,0; calculating a first pq value pq1_0 using maxGradp6_0; and comparing pq1_0 to a threshold.
[0346] In another embodiment, the filter selection module is suitable for selecting a filter, wherein the filter selection module 704 is configured to select by performing a process comprising: calculating a first pq value pql using at least a first value equal to Abs(p2, 0-2*p1, 0+p0, 0) and a second value equal to Abs(q2, 0-2*q1, 0+q0, 0); and comparing pq1 with a threshold, wherein the threshold is equal to β>>4, and β is selected from a set of predetermined β values based on the quantization parameter value Q.
[0347] Brief description of some embodiments
[0348] A1. A method (400) for filtering sample values associated with an image, the method comprising: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values (hereinafter referred to as P-block) and a second block of sample values (hereinafter referred to as Q-block), wherein the P-block comprises a set of sample values pi,k, where i=0-7 and k=0-3, and the Q-block comprises a set of sample values qi,k, where i=0-7 and k=0-3; and deciding (s404) whether to use a long filter to filter at least a subset of the first set of sample values, wherein deciding whether to use a long filter to filter at least a subset of the first set of sample values comprises: calculating (s502) a first gradient value maxGradp6_0 using the sample value p6,0; calculating (s504) a first pq value pq1_0 using maxGradp6_0; and comparing pq1_0 with a threshold value (s508).
[0349] A2. A method according to embodiment A1, wherein determining whether to use a long filter to filter at least a subset of the first set of sample values also includes: using sample value p6,3 to calculate a second gradient value maxGradp6_3, using maxGradp6_3 to calculate a second pq value pq1_3, and comparing pq1_3 with a threshold (s508).
[0350] A3. The method of embodiment A1 or A2, wherein calculating pq1_0 comprises calculating the value sp+sq, wherein calculating sp comprises calculating sp=(Abs(p0, 0–p3, 0)+Abs(p3, 0–p7, 0)+magGradp6_0+1)>>1.
[0351] A4. The method according to embodiment A3, wherein magGradp6_0 is equal to Abs(p7, 0-p6, 0), magGradp6_0 is equal to Abs(p7, 0-p6, 0-p5, 0+p4, 0), or magGradp6_0 is equal to Abs(p6, 0-2*p5, 0+p4, 0).
[0352] A5. The method of embodiment A1 or A2, wherein calculating pq1_0 comprises calculating 2*(dp+dq), wherein dp is equal to (Abs(p0,0–2*p1,0+p2,0)+magGradp6_0+1)>>1.
[0353] A6. The method of embodiment A5, wherein magGradp6_0 is equal to Abs(p7, 0-p6, 0-p5, 0+p4, 0), or magGradp6_0 is equal to Abs(p6, 0-2*p5, 0+p4, 0).
[0354] A7. The method of any one of embodiments A1 to A6, wherein the step of calculating pq1_0 using maxGradp6_0 is performed as a result of determining that the maximum filter length maxFilterLengthP of the P block is equal to 7.
[0355] B1. A method (400) for filtering sample values associated with an image, the method comprising: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values (hereinafter referred to as P block) and a second block of sample values (hereinafter referred to as Q block), wherein the P block comprises a set of sample values pi,k, where i=0-7 and k=0-3, and the Q block comprises a set of sample values qi,k, where i=0-7 and k=0-3; and selecting (s404) a filter, wherein selecting the filter comprises: calculating (s504) a first pq value pq1 using at least a first value equal to Abs(p2, 0-2*p1, 0+p0, 0) and a second value equal to Abs(q2, 0-2*q1, 0+q0, 0); and comparing pq1 with a threshold value (s508), wherein the threshold value is equal to β>>4, and β is selected from a set of predetermined β values based on a quantization parameter value Q.
[0356] C1. A method for filtering sample values associated with an image, the method comprising: 1) obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i, k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_i, k, where i=0-7 and k=0-3; 2) selecting (s404) a filter, wherein selecting the filter comprises: i) calculating a first pq value pq1_0, wherein calculating pq1_0 comprises calculating a value sp , calculating the value sq and calculating sp+sq, where pq1_0=(sp+sp); ii) comparing pq1_0 with a first threshold; iii) calculating (s505) a second pq value pq2_0 using at least a first value equal to Abs(B1_2, 0-2*B1_1, 0+B1_0, 0) and a second value equal to Abs(B2_2, 0-2*B2_1, 0+B2_0, 0); iv) comparing pq2_0 with a second threshold (s508), where the second threshold is equal to β>>4, and β is selected from a set of predetermined β values based on the quantization parameter value Q.
[0357] C2. According to the method of claim C1, wherein selecting a filter further comprises: calculating a third pq value pq3_0, wherein pq3_0=Abs(B1_0, 0-B2_0, 0); and comparing pq3_0 with a third threshold, wherein the third threshold is equal to (5*tC+1)>>1, wherein tC is selected from a set of predetermined values based on the quantization parameter value Q.
[0358] C3. A method according to claim C1 or claim C2, wherein selecting a filter further comprises: calculating a fourth pq value pq2_3; comparing pq2_3 with a second threshold; calculating a fifth pq value pq1_3; and comparing pq1_3 with a first threshold, wherein the step of calculating pq2_3 comprises using at least a first value equal to Abs(B1_2, 3-2*B1_1, 3+B1_0, 3) and a first value equal to Abs(B2_2, 3-2*B2_1, 3+B2_0, 3). pq2_3 is calculated using binary values, and when maxFilterLengthP is greater than 3, a third value Abs(B1_5, 3–2*B1_4, 3+B1_3, 3) is also used, and when maxFilterLengthQ is greater than 3, a fourth value Abs(B2_5, 3–2*B2_4, 3+B2_3, 3) is also used. The steps of calculating pq1_3 include: calculating the value sp3, calculating the value sq3, and calculating sp3+sq3, where pq1_3=(sp3+sq3).
[0359] C4. The method according to claim C3, wherein the selection filter further comprises: calculating a sixth pq value pq3_3, where pq3_3 = Abs(B1_0,3 - B2_0,3); and comparing pq3_3 with a third threshold.
[0360] C5. The method according to any one of claims C1 to C4, wherein when the conditions of rows 0 and 3 in block B1 are less than the corresponding thresholds (for example, for row 0, pq1_0 < thr1 and pq2_0 < thr2 and pq3_0 < thr3, and for row 3, pq1_3 < thr1 and pq2_3 < thr2 and pq3_3 < thr3), the filter is used to modify 7 samples on each of rows 0 to 3 of the block row.
[0361] C6. The method according to claim C5, wherein thr1 is equal to 3 * β >> 5, thr2 is equal to β >> 4, and thr3 is equal to (5 * tC + 1) >> 1.
[0362] C7. The method according to any one of claims C1 to C6, wherein the first block has a maximum filter length maxFilterLengthP. If maxFilterLengthP is equal to 7, calculating sp includes calculating sp = (Abs(B1_0,0 – B1_3,0) + Abs(B1_3,0 – B1_7,0) + maxGradB1_6,0 + 1) >> 1, where maxGradB1_6,0 is a gradient value. If maxFilterLengthP is 5, calculating sp includes calculating sp = (Abs(B1_0,0 – B1_3,0) + Abs(B1_3,0 – B1_5,0) + 1) >> 1, and if maxFilterLengthP is equal to 3, calculating sp includes calculating sp = Abs(B1_0,0 – B1_3,0).
[0363] C8. The method according to claim C7, wherein maxGradB1_6,0 is equal to Abs(B1_7,0 - B1_6,0 - B1_5,0 + B1_4,0).
[0364] C9. According to a method according to any one of claims C1 to C9, wherein the second block has a maximum filter length maxFilterLengthQ, if maxFilterLengthQ is equal to 7, then calculating sq includes calculating sq=(Abs(B2_0, 0–B2_3, 0)+Abs(B2_3, 0–B2_7, 0)+maxGradB2_6,0+1)>>1, wherein maxGradB2_6,0 is a gradient value, if maxFilterLengthQ is equal to 5, then calculating sq includes calculating sq=(Abs(B2_0, 0–B2_3, 0)+Abs(B2_3, 0–B2_5, 0)+1)>>1, and if maxFilterLengthQ is equal to 3, then calculating sq includes calculating sq=Abs(B1_0, 0–B1_3, 0).
[0365] C10. The method according to claim C9, wherein maxGradB2_6,0 is equal to Abs(B2_7,0-B2_6,0-B2_5,0+B2_4,0).
[0366] C11. A method according to any one of claims C1 to C10, wherein a third value Abs(B1_5, 0–2*B1_4, 0+B1_3, 0) is also used when maxFilterLengthP is greater than 3, and wherein the second block has a maximum filter length maxFilterLengthQ, and when maxFilterLengthQ is greater than 3, a fourth value Abs(B2_5, 0–2*B2_4, 0+B2_3, 0) is also used.
[0367] C12. According to the method of claim C3 or C4, wherein, if maxFilterLengthP is equal to 7, calculating sp3 includes calculating sp3=(Abs(B1_0, 3–B1_3, 3)+Abs(B1_3, 3–B1_7, 3)+maxGradB1_6, 3+1)>>1, wherein maxGradB1_6, 3 is a gradient value, and if maxFilterLengthP is equal to 5, calculating sp3 includes calculating sp3=(Abs(B1_0, 3–B1_3, 3)+Abs(B1_3, 3–B1_5, 3))+1)>>1, and if maxFilterLengthP is equal to 5, calculating sp3 includes calculating sp3=Abs(B1_ 0, 3–B1_3, 3), if maxFilterLengthQ is equal to 7, then calculating sq3 includes calculating sq3=(Abs(B2_0, 3–B2_3, 3)+Abs(B2_3, 3–B2_7, 3)+maxGradB2_6, 3+1)>>1, where maxGradB2_6, 3 is the gradient value, if maxFilterLengthQ is equal to 5, then calculating sq3 includes calculating sq3=(Abs(B2_0, 3–B2_3, 3)+Abs(B2_3, 3–B2_5, 3)+1)>>1, if maxFilterLengthQ is equal to 3, then calculating sq3 includes calculating sq3=Abs(B2_0, 3–B2_3, 3).
[0368] D1. A method (400) for filtering sample values associated with an image, the method comprising: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i,k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_i,k, where i=0-7 and k=0-3; and deciding (s404) whether to filter at least a subset of the first set of sample values using a long filter, wherein deciding whether to filter at least a subset of the first set of sample values using a long filter comprises: calculating (s502) a first gradient value maxGradB1_6,0 using the sample value B1_6,0; calculating (s504) a first pq value pq1_0 using maxGradB1_6,0; and comparing pq1_0 with a threshold value (s508).
[0369] D2. According to the method of claim D1, wherein determining whether to use a long filter to filter at least a subset of the first set of sample values also includes: calculating a second gradient value maxGradB1_6,3 using the sample value B1_6,3, calculating a second pq value pq1_3 using maxGradB1_6,3, and comparing pq1_3 with a threshold (s508).
[0370] D3. A method according to claim D1 or D2, wherein calculating pq1_0 includes calculating a value sp, calculating a value sq, and calculating sp+sq, wherein pq1_0=(sp+sq), wherein calculating sp includes calculating sp=(Abs(B1_0, 0–B1_3, 0)+Abs(B1_3, 0–B1_7, 0)+maxGradB1_6, 0+1)>>1.
[0371] D4. A method according to claim D3, wherein maxGradB1_6,0 is equal to Abs(B1_7,0-B1_6,0-B1_5,0+B1_4,0).
[0372] D5. A method according to claim D3 or D4, wherein the second block has a maximum filter length maxFilterLengthQ, if maxFilterLengthQ is equal to 7, then sq = (Abs(B2_0, 0–B2_3, 0) + Abs(B2_3, 0–B2_7, 0) + maxGradB2_6, 0 + 1) >> 1, wherein maxGradB2_6, 0 is the third gradient value, if maxFilterLengthQ is equal to 5, then sq = (Abs(B2_0, 0–B2_3, 0) + Abs(B2_3, 0)–B2_5, 0) + 1) >> 1, and if maxFilterLengthQ is not equal to 7 and is not equal to 5, then sq = Abs(B2_0, 0–B2_3, 0).
[0373] D6. A method according to claim D5, wherein maxGradB2_6,0 is equal to Abs(B2_7,0–B2_6,0–B2_5,0+B2_4,0).
[0374] D7. A method according to any one of claims D2 to D6, wherein calculating pq1_3 includes calculating the value sp3, calculating the value sq3, calculating sp3+sq3, wherein pq1_3=(sp3+sq3), wherein calculating sp3 includes calculating sp3=(Abs(B1_0, 3–B1_3, 3)+Abs(B1_3, 3–B1_7, 3)+maxGradB1_6, 3+1)>>1.
[0375] D8. A method according to claim D7, wherein maxGradB1_6,3 is equal to Abs(B1_7,3-B1_6,3-B1_5,3+B1_4,3).
[0376] D9. A method according to any one of claims D1 to D8, wherein the step of calculating pq1_0 using maxGradB1_6,0 is performed as a result of determining that the maximum filter length maxFilterLengthP of the first block is equal to 7.
[0377] D10. A method according to any one of claims D2 to D9, wherein the step of calculating pq1_3 using maxGradB1_6,3 is performed as a result of determining that the maximum filter length maxFilterLengthP of the first block is equal to 7.
[0378] D11. According to the method of claim D7, wherein the second block has a maximum filter length maxFilterLengthQ, if maxFilterLengthQ is equal to 7, then sq3 = (Abs(B2_0, 3–B2_3, 3) + Abs(B2_3, 3–B2_7, 3) + maxGradB2_6, 3 + 1) >> 1, wherein maxGradB2_6, 3 is the fourth gradient value, if maxFilterLengthQ is equal to 5, then sq3 = (Abs(B2_0, 3–B2_3, 3) + Abs(B2_3, 3–B2_5, 3) + 1) >> 1, and if maxFilterLengthQ is not equal to 5 and is not equal to 7, then sq3 = Abs(B2_0, 3–B2_3, 3).
[0379] D12. A method according to claim D11, wherein maxGradB2_6,3 is equal to Abs(B2_7,3−B2_6,3−B2_5,3+B2_4,3).
[0380] D13. A method according to any one of claims D1 to D12, wherein, when deblocking a vertical boundary, the i value identifies the column of the block and the k value identifies the row of the block, and when deblocking a horizontal boundary, the k value identifies the column of the block and the i value identifies the row of the block.
[0381] D14. A method according to any one of claims D1 to D13, wherein B1_0,0 refers to the sample in the first block that is closest to the sample B2_0,0 in the second block, wherein B1_1,0 is closest to B1_0,0; B1_2,0 is closest to B1_1,0; B1_3,0 is closest to B1_2;0; B1_4,0 is closest to B1_3,0; B1_5,0 is closest to B1_4,0; B1_6,0 is closest to B1_5,0; B1_7,0 is closest to B1_6,0; B2_1,0 is closest to B2_0,0; B2_2,0 is closest to B2_1,0; B2_3,0 is closest to B2_2,0; B2_4,0 is closest to B2_3,0; B2_5,0 is closest to B2_4,0; B2_6,0 is closest to B2_5,0; B2_7 ,0 is closest to B2_6,0; B1_0,3 refers to the sample in the first block that is closest to the sample B2_0,3 in the second block, among which B1_1,3 is closest to B1_0,3; B1_2,3 is closest to B1_1,3; B1_3,3 is closest to B1_2,3; B1_4,3 is closest to B1_3,3; B1_5,3 is closest to B1_4,3; B1_6,3 is closest to Close to B1_5,3; B1_7,3 is closest to B1_6,3; B2_1,3 is closest to B2_0,3; B2_2,3 is closest to B2_1,3; B2_3,3 is closest to B2_2,3; B2_4,3 is closest to B2_3,3; B2_5,3 is closest to B2_4,3; B2_6,3 is closest to B2_5,3; B2_7,3 is closest to B2_6,3.
[0382] D15. A method according to any one of claims D1 to D14, wherein, when maxFilterLengthP is equal to 7, the samples to be filtered by the long filter are B1_0,0 to B1_6,0, B1_0,1 to B1_6,1, B1_0,2 to B1_6,2 and B1_0,3 to B1_6,3.
[0383] D16. A method according to any one of claims D1 to D15, wherein, when maxFilterLengthQ is equal to 7, the samples to be filtered by the long filter are B2_0,0 to B2_6,0, B2_0,1 to B2_6,1, B2_0,2 to B2_6,2 and B2_0,3 to B2_6,3.
[0384] E1. A method (400) for filtering sample values associated with an image, the method comprising: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i,k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_i,k, where i=0-7 and k=0-3; and selecting (s40 4) a filter, wherein selecting the filter comprises: calculating (s505) a first pq value pq2_0 using at least a first value equal to Abs(B1_2, 0-2*B1_1, 0+B1_0, 0) and a second value equal to Abs(B2_2, 0-2*B2_1, 0+B2_0, 0); and comparing pq2_0 with a threshold (s508), wherein the threshold is equal to β>>4, and β is selected from a set of predetermined β values based on the quantization parameter value Q.
[0385] E2. The method of E1, wherein selecting the filter further comprises calculating a second pq value pq2_3 using at least a first value equal to Abs(B1_2, 3-2*B1_1, 3+B1_0, 3) and a second value equal to Abs(B2_2, 3-2*B2_1, 3+B2_0, 3); and comparing pq2_3 to a threshold.
[0386] F1. An encoder (140) or a decoder (260) adapted to execute the method of any one of the above embodiments.
[0387] F2. A device (500), wherein the device implements the encoder (140) or decoder (260) of embodiment F1.
[0388] G1. A computer program (643), comprising: instructions (644), which, when executed by a processing circuit (602), cause the processing circuit (602) to perform any method of the above embodiments.
[0389] G2. A carrier comprising the computer program of embodiment G1, wherein the carrier is one of an electric signal, an optical signal, a radio signal and a computer-readable storage medium (642).
[0390] H1. A device (600) for filtering sample values associated with an image, the device comprising: an acquisition module (702 (see Figure 7)), adapted to obtain a first set of sample values, the first set of sample values comprising a first block of sample values (hereinafter referred to as P-block) and a second block of sample values (hereinafter referred to as Q-block), wherein the P-block comprises a set of sample values pi,k, where i=0-7 and k=0-3, and the Q-block comprises a set of sample values qi,k, where i=0-7 and k=0-3; and a filter selection module (704 (see Figure 7 )), adapted to decide whether to filter at least a subset of the first set of sample values using a long filter, wherein the filter selection module (704) is configured to decide whether to filter at least a subset of the first set of sample values using a long filter by performing a process comprising: calculating (s502) a first gradient value maxGradp6_0 using the sample value p6,0; calculating (s504) a first pq value pq1_0 using maxGradp6_0; and comparing pq1_0 with a threshold value (s508).
[0391] I1. A device (600) for filtering sample values associated with an image, the device comprising: an acquisition module (702 (see Figure 7 )), adapted to obtain a first set of sample values, the first set of sample values comprising a first block of sample values (hereinafter referred to as P-block) and a second block of sample values (hereinafter referred to as Q-block), wherein the P-block comprises a set of sample values pi,k, where i=0-7 and k=0-3, and the Q-block comprises a set of sample values qi,k, where i=0-7 and k=0-3; and a filter selection module (704 (see Figure 7 )), suitable for selecting a filter, wherein the filter selection module (704) is configured to select by performing a process comprising: calculating (s504) a first pq value pq1 using at least a first value equal to Abs(p2, 0-2*p1, 0+p0, 0) and a second value equal to Abs(q2, 0-2*q1, 0+q0, 0); and comparing pq1 with a threshold (s508), wherein the threshold is equal to β>>4, and β is selected from a set of predetermined β values based on the quantization parameter value Q.
[0392] Although various embodiments are described herein, it should be understood that these embodiments are presented by way of example only and not limitation. Therefore, the breadth and scope of the present disclosure should not be limited by any of the above exemplary embodiments. In addition, unless otherwise specified herein or clearly contradictory to the context, any combination of the above elements in all possible variations thereof is included in the present disclosure.
[0393] Furthermore, although the processes described above and illustrated in the accompanying drawings are shown as a series of steps, this is for illustration only. Therefore, it is contemplated that some steps may be added, some steps may be omitted, the order of the steps may be rearranged, and some steps may be performed in parallel.
Claims
1. A method (400) for deblocking a vertical block boundary and / or a horizontal block boundary, the method being performed by an image or video encoder or an image or video decoder, the method include: obtaining (s402) a first set of sample values, the first set of sample values comprising a first block of sample values and a second block of sample values, wherein the first block of sample values comprises a set of sample values B1_i,k, where i=0-7 and k=0-3, and the second block of sample values comprises a set of sample values B2_j,k, where j=0-7 and k=0-3; and Deciding (s404) whether to filter at least a subset of the first set of sample values using a long filter, wherein deciding whether to filter at least a subset of the first set of sample values using a long filter comprises: Calculate (s502) a first gradient value maxGradB1_6,0 using the sample value B1_6,0; A first pq value pq1_0 is calculated (s504) using maxGradB1_6,0, wherein calculating pq1_0 includes: calculating a value sp, calculating a value sq, and calculating sp+sq, wherein pq1_0=(sp+sq), and wherein calculating sp includes calculating sp=(Abs(B1_0, 0–B1_3, 0)+Abs(B1_3, 0–B1_7, 0)+maxGradB1_6, 0+1)>>1, and wherein maxGradB1_6, 0 is equal to Abs(B1_7, 0-B1_6, 0-B1_5, 0+B1_4, 0), and wherein the second block has a maximum filter length maxFilterLengthQ, and if maxFilterLengthQ is equal to 7, then sq=(Abs(B2_0, 0–B2_3, 0)+ Abs(B2_3, 0–B2_7, 0)+maxGradB2_6, 0+1)>>1, and maxGradB2_6, 0 is equal to Abs(B2_7, 0–B2_6, 0–B2_5, 0+B2_4, 0); Compare pq1_0 with a threshold value (s508); Calculate the second gradient value maxGradB1_6,3 using the sample value B1_6,3; The second pq value pq1_3 is calculated using maxGradB1_6,3, wherein calculating pq1_3 includes calculating a value sp3, calculating a value sq3, and calculating sp3+sq3, wherein pq1_3=(sp3+sq3), and wherein calculating sp3 includes calculating sp3=(Abs(B1_0,3–B1_3,3)+ Abs(B1_3, 3–B1_7, 3)+maxGradB1_6, 3+1)>>1, and wherein maxGradB1_6, 3 is equal to Abs(B1_7, 3-B1_6, 3-B1_5, 3+B1_4, 3), and wherein, if maxFilterLengthQ is equal to 7, then sq3=(Abs(B2_0, 3–B2_3, 3)+Abs(B2_3, 3–B2_7, 3)+maxGradB2_6, 3+1)>>1, and wherein maxGradB2_6, 3 is equal to Abs(B2_7, 3–B2_6, 3–B2_5, 3+B2_4, 3); and pq1_3 is compared with the threshold value (s508).
2. The method according to claim 1, in, If maxFilterLengthQ is equal to 5, then sq=(Abs(B2_0, 0-B2_3, 0)+Abs(B2_3, 0-B2_5, 0)+1)>>1, and If maxFilterLengthQ is not equal to 7 and not equal to 5, then sq=Abs(B2_0, 0−B2_3, 0).
3. The method according to claim 1, in, As a result of determining that the maximum filter length maxFilterLengthP of the first block is equal to 7, a step of calculating pq1_0 using maxGradB1_6,0 is performed.
4. The method according to claim 1, in, As a result of determining that the maximum filter length maxFilterLengthP of the first block is equal to 7, a step of calculating pq1_3 using maxGradB1_6,3 is performed.
5. The method according to claim 1, in, When deblocking vertical boundaries, the i value identifies the column of the block, the k value identifies the row of the block, and / or When deblocking horizontal boundaries, the k value identifies the column of the block and the i value identifies the row of the block.
6. The method according to claim 3, in, When maxFilterLengthP is equal to 7, the samples to be filtered by the long filter are B1_0,0 to B1_6,0, B1_0,1 to B1_6,1, B1_0,2 to B1_6,2 and B1_0,3 to B1_6,3.
7. The method according to claim 1, in, When maxFilterLengthQ is equal to 7, the samples to be filtered by the long filter are B2_0,0 to B2_6,0, B2_0,1 to B2_6,1, B2_0,2 to B2_6,2 and B2_0,3 to B2_6,3.
8. A computer program product, include: Instructions (644) which, when executed by a processing circuit (602), cause the processing circuit (602) to perform a method according to any one of claims 1 to 7.
9. A computer-readable storage medium (642) comprising instructions which, when executed by a processing circuit (602), cause the processing circuit (602) to perform the method according to any one of claims 1-7.
10. An apparatus (600) for performing deblocking filtering on vertical block boundaries and / or horizontal block boundaries, comprising a processing circuit (602) and a memory, wherein the memory stores instructions, and when the instructions are executed by the processing circuit (602), the processing circuit (602) performs the method according to any one of claims 1 to 7.
