[FFmpeg-devel] [PATCH] RV40 Loop Filter, hopefully final version

Michael Niedermayer michaelni
Sun Nov 23 19:23:32 CET 2008


On Sun, Nov 23, 2008 at 04:40:28PM +0200, Kostya wrote:
> On Sun, Nov 23, 2008 at 02:49:18PM +0100, Michael Niedermayer wrote:
> > On Sun, Nov 23, 2008 at 09:15:58AM +0200, Kostya wrote:
> > > On Sun, Nov 23, 2008 at 09:15:03AM +0200, Kostya wrote:
[...]
> [...]
> > > +                            if(!i){
> > > +                                clip_left = uvcbp[POS_LEFT][k] & (MASK_CUR << (2*j+1)) ? clip[POS_LEFT] : 0;
> > > +                            }else{
> > > +                                clip_left = uvcbp[POS_CUR][k]  & (MASK_CUR << (ij-1))  ? clip[POS_CUR]  : 0;
> > > +                            }
> > 
> > if(i)
> > else
> > is clearer than if(!i) IMHO
> 
> IMNSHO too

?
you disagree?
or you agree but forgot to change it?


[...]
> Index: libavcodec/rv40.c
> ===================================================================
> --- libavcodec/rv40.c	(revision 15827)
> +++ libavcodec/rv40.c	(working copy)
> @@ -285,7 +285,358 @@
>      }
>  }
>  
> +static inline void rv40_adaptive_loop_filter(uint8_t *src, const int step,
> +                                             const int stride, const int dmode,
> +                                             const int lim_q1, const int lim_p1,
> +                                             const int alpha,
> +                                             const int beta, const int beta2,
> +                                             const int chroma, const int edge)
> +{
> +    int diff_p1p0[4], diff_q1q0[4], diff_p1p2[4], diff_q1q2[4];
> +    int sum_p1p0 = 0, sum_q1q0 = 0, sum_p1p2 = 0, sum_q1q2 = 0;
> +    uint8_t *ptr;
> +    int flag_strong0 = 1, flag_strong1 = 1;
> +    int filter_p1 = 1, filter_q1 = 1;
> +    int i;
> +    int lims;
> +
> +    for(i = 0, ptr = src; i < 4; i++, ptr += stride){
> +        diff_p1p0[i] = ptr[-2*step] - ptr[-1*step];
> +        diff_q1q0[i] = ptr[ 1*step] - ptr[ 0*step];
> +        sum_p1p0 += diff_p1p0[i];
> +        sum_q1q0 += diff_q1q0[i];
> +    }

> +    if(FFABS(sum_p1p0) >= (beta<<2))
> +        filter_p1 = 0;
> +    if(FFABS(sum_q1q0) >= (beta<<2))
> +        filter_q1 = 0;

filter_p1 = FFABS(sum_p1p0) < (beta<<2);
filter_q1 = FFABS(sum_q1q0) < (beta<<2);


> +    if(!filter_p1 && !filter_q1)
> +        return;
> +
> +    for(i = 0, ptr = src; i < 4; i++, ptr += stride){
> +        diff_p1p2[i] = ptr[-2*step] - ptr[-3*step];
> +        diff_q1q2[i] = ptr[ 1*step] - ptr[ 2*step];
> +        sum_p1p2 += diff_p1p2[i];
> +        sum_q1q2 += diff_q1q2[i];
> +    }
> +

> +    if(!edge){
> +        flag_strong0 = flag_strong1 = 0;
> +    }else{
> +        flag_strong0 = filter_p1 && (FFABS(sum_p1p2) < beta2);
> +        flag_strong1 = filter_q1 && (FFABS(sum_q1q2) < beta2);
> +    }

if(edge) else is cleaner IMHO



> +
> +    lims = (lim_q1 + lim_p1 + (filter_p1?3:1) + (filter_q1?3:1)) >> 1;

uhm
lims = ((lim_q1 + lim_p1) >> 1) + filter_p1 + filter_q1 + 1;


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

Concerning the gods, I have no means of knowing whether they exist or not
or of what sort they may be, because of the obscurity of the subject, and
the brevity of human life -- Protagoras
-------------- 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/20081123/4b601fa8/attachment.pgp>



More information about the ffmpeg-devel mailing list