[Mplayer-cvslog] CVS: main/libmpcodecs vf_crop.c,1.13,1.14

D Richard Felker III dalias at aerifal.cx
Mon Apr 28 04:06:34 CEST 2003


On Sun, Apr 27, 2003 at 11:12:28PM +0200, Arpi wrote:
> Hi,
> 
> > +static void draw_slice(struct vf_instance_s* vf,
> > +        unsigned char** src, int* stride, int w,int h, int x, int y){
> > +    //mp_msg(MSGT_VFILTER, MSGL_V, "crop slice %d %d %d %d ->", w,h,x,y);
> > +    if ((x -= vf->priv->crop_x) < 0) {
> > +	w += x;
> > +	x = 0;
> > +    }
> > +    if ((y -= vf->priv->crop_y) < 0) {
> > +	h += y;
> > +	y = 0;
> > +    }
> > +    if (x+w > vf->priv->crop_w) w = vf->priv->crop_w-x;
> > +    if (y+h > vf->priv->crop_h) h = vf->priv->crop_h-y;
> > +    //mp_msg(MSGT_VFILTER, MSGL_V, "%d %d %d %d\n", w,h,x,y);
> > +    if ((w < 0) || (h < 0)) return;
> > +    vf_next_draw_slice(vf,src,stride,w,h,x,y);
> > +}
> 
> imho this is broken. you should adjust src[] too (but copy it instead of
> in-place modification, it's not allowed!), changing x,y is not enough (it's
> used only as destination coordinates, src[] points is the upper left pixel
> of the area to be copied)

OK, can you send me one of those huge cola crates? My previous code
deserves about 100l -- the slice code was being called, but then the
normal put_image happened at the end of the frame too, hiding the
broken results of the slice code. All is fixed now, and I'm committing
a new version that actually has the reduced cpu usage advertised
before...

Rich



More information about the MPlayer-cvslog mailing list