[MPlayer-dev-eng] [PATCH] cropdetect
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Aug 9 21:59:01 CEST 2004
Hi,
> + while ( w % vf->priv->round != 0 ) {
> + --w;
> + if( w % 2 == 0 )
> + ++x;
> + }
> +
> + while ( h % vf->priv->round != 0 ) {
> + --h;
> + if( h % 2 == 0 )
> + ++y;
> + }
I've been thinking about this and I think it's ugly. I'd prefer
something like that:
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;
This should be functional equivalent, although it might need a bit more
mathematics to understand ;-) (actually only (a - b) % c = (a % c) - (b
% c) and (a % c) % c = a % c, if you really want to check )
Greetings,
Reimar Döffinger
More information about the MPlayer-dev-eng
mailing list