[FFmpeg-devel] [PATCH i+1/N] RV40 loop filter

Michael Niedermayer michaelni
Sun Feb 24 20:09:09 CET 2008


On Sat, Feb 23, 2008 at 12:58:44PM +0200, Kostya wrote:
> Here is the monster.
> 
> I believe it's not too far from real loop filter used. 

[...]
> +    t = src[0*step] - src[-1*step];
> +    if(!t) return;
> +    t = (mult * FFABS(t)) >> 7;
> +    if(t > 3) return;
> +    if(flag0 && flag1 && t > 2) return;
> +    t = src[-1*step] - src[0*step];

t = src[-1*step] - src[0*step];
if(!t) return;
u = (mult * FFABS(t)) >> 7;
if(u > 3 - (flag0 && flag1))
    return;


> +
> +    if(flag0 && flag1)
> +        diff = (src[-2*step] - src[1*step] + t*4 + 4) >> 3;
> +    else
> +        diff = (t + 1) >> 1;

if(flag0 && flag1)
    t+= (src[-2*step] - src[1*step])>>2;
diff = (t + 1) >> 1;


[...]
> +            if(!sflag){
> +                src[-1*step] = p0;
> +                src[ 0*step] = p1;
> +            }else{
> +                if((src[-1*step] - p0) >= -v88 && (src[-1*step] - p0) <= v88)
> +                    src[-1*step] = p0;
> +                else
> +                    src[-1*step] = p1;
> +                if((src[ 0*step] - p1) >= -v88 && (src[ 0*step] - p1) <= v88)
> +                    src[ 0*step] = p1;
> +                else
> +                    src[ 0*step] = src[-1*step];
> +            }

if(!sflag || FFABS(src[-1*step] - p0) <= v88)
    src[-1*step] = p0;
else
    src[-1*step] = p1;

if(!sflag || FFABS(src[ 0*step] - p1) <= v88)
    src[ 0*step] = p1;
else
    src[ 0*step] = src[-1*step];

and the last line looks suspicious


[...]
> +            if(!s->first_slice_line){
> +                cbp2 = r->cbp_chroma[mb_pos - s->mb_stride] >> 2;
> +                if(cbp & 1){
> +                    lim1 = rv40_filter_clip_tbl[btype][q];
> +                    if(!(cbp2 & 1))
> +                        lim1 = lim0;
> +                    rv40_h_loop_filter(U, s->uvlinesize, 0, lim0, lim1, alpha, beta, q, 1, 1);
> +                }
> +                if(cbp & 0x10){
> +                    lim1 = rv40_filter_clip_tbl[btype][q];
> +                    if(!(cbp2 & 0x10))
> +                        lim1 = lim0;
> +                    rv40_h_loop_filter(V, s->uvlinesize, 0, lim0, lim1, alpha, beta, q, 1, 1);
> +                }
> +            }
> +            if(s->mb_x){
> +                cbp2 = r->cbp_chroma[mb_pos - 1] >> 1;
> +                if(cbp & 1){
> +                    lim1 = rv40_filter_clip_tbl[btype][q];
> +                    if(!(cbp2 & 1))
> +                        lim1 = lim0;
> +                    rv40_v_loop_filter(U, s->uvlinesize, 0, lim0, lim1, alpha, beta, q, 1, 1);
> +                }
> +                if(cbp & 0x10){
> +                    lim1 = rv40_filter_clip_tbl[btype][q];
> +                    if(!(cbp2 & 0x10))
> +                        lim1 = lim0;
> +                    rv40_v_loop_filter(V, s->uvlinesize, 0, lim0, lim1, alpha, beta, q, 1, 1);
> +                }
> +            }
> +            if(!s->first_slice_line){
> +                cbp2 = r->cbp_chroma[mb_pos - s->mb_stride] >> 3;
> +                if(cbp & 1){
> +                    lim1 = rv40_filter_clip_tbl[btype][q];
> +                    if(!(cbp2 & 2))
> +                        lim1 = lim0;
> +                    rv40_h_loop_filter(U + 4, s->uvlinesize, 0, lim0, lim1, alpha, beta, q, 1, 1);
> +                }
> +                if(cbp & 0x10){
> +                    lim1 = rv40_filter_clip_tbl[btype][q];
> +                    if(!(cbp2 & 0x20))
> +                        lim1 = lim0;
> +                    rv40_h_loop_filter(V + 4, s->uvlinesize, 0, lim0, lim1, alpha, beta, q, 1, 1);
> +                }
> +            }

code duplication?



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

Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- 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-devel/attachments/20080224/090b7fc3/attachment.pgp>



More information about the ffmpeg-devel mailing list