[MPlayer-dev-eng] [PATCH] cropdetect

Adrian agbauer at gmail.com
Tue Aug 10 02:08:52 CEST 2004


These are not equivalent:

> > +      while ( w % vf->priv->round != 0 ) {
> > +        --w;
> > +        if( w % 2 == 0 )
> > +          ++x;
> > +      }
> > +
> > +      while ( h % vf->priv->round != 0 ) {
> > +        --h;
> > +        if( h % 2 == 0 )
> > +          ++y;
> > +      }

and

> int shrink_by;
> shrink_by = w % vf->priv->round;
> w -= shrink_by;
> x += shrink_by / 2;
> 
> shrink_by = h % vf->priv->round;
> h -= shrink_by;
> y += shrink_by / 2;

You need to increment by (shrink_by + 1) / 2.

Also, this is not true:
> (a - b) % c = (a % c) - (b % c)

Adrian




More information about the MPlayer-dev-eng mailing list