[FFmpeg-soc] RV40 Deblock filter help needed

Michael Niedermayer michaelni at gmx.at
Fri Aug 17 22:56:33 CEST 2007


Hi

On Fri, Aug 17, 2007 at 08:52:05PM +0300, Kostya wrote:
> Does this scheme reminds anybody of some other filter?
> For me it definitely looks like _not_ H.264.
> 
> For all rows/cols:
>  A[i] = SRC[i][-2] - SRC[i][-1]
>  B[i] = SRC[i][ 1] - SRC[i][ 0]
>  C[i] = SRC[i][-2] - SRC[i][-3]
>  D[i] = SRC[i][ 1] - SRC[i][ 2]
> 
>  AA = ABS(A[0]+A[1]+A[2]+A[3]); 
>  AB = ABS(B[0]+B[1]+B[2]+B[3]);
>  AC = ABS(C[0]+C[1]+C[2]+C[3]);
>  AD = ABS(D[0]+D[1]+D[2]+D[3]);
>  if(AA>= Thr1 && AB>= Thr1)
>     return;
>  f1 = AA < Thr1 && AC < Thr1;
>  f2 = AB < Thr1 && AD < Thr1;
>  if(f1 && f2){
>   use filters like 25 26 26 26 25 and 25 26 51 26, 4 pixels wide

these 25 26 26 blah filters are possibly described in JVT-A003r1.DOC/PDF
(you should be able to find it with google or on the public JVT/VCEG ftp)
----------
4.4.3 Stronger filtering for intra coded macroblocks
In case of intra coding and areas in the picture with little texture the subjective quality can be improved
by stronger filtering across macroblock boundaries (that is: not 4x4 block boundaries). This stronger
filtering is performed only if one or both of the adjacent macroblocks are intra coded and ap = 3 and aq = 3
and 1 < |p1-q1| < QP / 4.
In this case luminance filtering is performed using the formulas shown below. For chrominance pixels p3
to q3, are not filtered.
        P1 = (25*p3 + 26*p2 + 26*p1 + 26*q1 + 25*q2 + 64) / 128
        P2 = (25*p4 + 26*p3 + 26*p2 + 26*P1 + 25*q1 + 64) / 128
        P3 = (26*p4 + 51*p3 + 26*P2 + 25*P1 + 64) / 128
        Q1 = (25*p2 + 26*p1 + 26*q1 + 26*q2 + 25*q3 + 64) / 128
        Q2 = (25*p1 + 26*Q1 + 26*q2 + 26*q3 + 25*q4 + 64) / 128
        Q3 = (25*Q1 + 26*Q2 + 51*q3 + 26*q4 + 64) / 128
Note, that when filtering across the next 4x4 block boundary, pixel q3 may get overwritten. To
compensate the effect Q3 is stored and used as P2 when filtering across the next 4x4 block boundary.
                                                                                                   Page: 34
File: JVT-A003r1.DOC
Date Printed: 14.03.2002
-----------

>  }else if(something){
>   1-2 pixels wide filtering, 
>    src[0] = clip(src[0] + (src[-2] -4*src[-1] +4*src[0] - src[1] +4)>>3 + 128);
>    if(D[i]<Thr2) src[1]=clip(src[1] - clip_bounds((D[i]+B[i]+ X)>>1, -Lim1, Lim1) +128); 
>  }else{//clear flags, almost the same as previous branch
>   1-2 pixels wide filtering
>    src[0] = clip(src[0] - (src[-1] - src[0] + 1)>>1 + 128);
>    if(D[i] < Thr2 && some_flag) src[1] = clip(src[1] - clip_bounds((D[i] + B[i] + X) >> 1,-Lim1>>1,Lim1>>1) + 128);

this looks somewhat like:
-----
4.4.2 Filtering Process
There are 3 conditions, that determine which of the boundary pixels are filtered:
     If (ap > 1) and (aq > 1) the pixels p1 and q1 are filtered by:
                    Delta  = Clip( -c, c, ((q1  p1) << 2 + (p2  q2) + 4) >> 3)
                    P1     = Clip( 0, 255, (p1+Delta) )
                           = Clip( 0, 255, (q1- Delta) )
                    Q1
     If (ap == 3) and (aq >1) p2 is filtered by:
                    Delta  = Clip( -cp, cp, (p3+p1 - p2<<1) >> 1)
                           = Clip( 0, 255, (p2+Delta) )
                    P2
     If (ap>1) and (aq == 3) q2 is filtered by:
                    Delta  = Clip(       -cq, cq,        (q3+q1 - q2<<1) >> 1)
                    Q2     = Clip(       0,     255, (q2+Delta) )
Here Clip() denotes a clipping function with the parameters Clip( Min, Max, Value)
with the clipping constants:
                           = ClipTbl( QP, Strengthp )
                    cp
                    cq     = ClipTbl( QP, Strengthq )
                           = ( cp + cq + ap + aq ) / 2
                    c
                                                     TABLE 6
                                           ClipTbl (QP, Strength ):
QP            0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
ClipTbb(qp,0) 0 0 0 0 0 0 0 0 0 0  0  0   0  0  0   0  0   0 0  0 0  0 0  0  0  0  0  0  0  0  0  0
ClipTbl(qp,1) 0 0 0 0 0 0 0 0 0 0  0  1   1  1  1   1  1   1 1  1 1  2 2  2  2  3  3  3  3  4  5  5
ClipTbl(qp,2) 0 0 0 0 0 0 0 0 0 1  1  1   1  1  1   1  1   2 2  2 2  3 3  3  4  4  5  5  5  7  8  9
-----
yes i know the formatting is trashed ...

anyway, just look at old h.264 drafts ...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-soc/attachments/20070817/0ba32c85/attachment.pgp>


More information about the FFmpeg-soc mailing list