Mercurial > mplayer.hg
diff libmpcodecs/vf_rectangle.c @ 32702:7af3e6f901fd
Convert some tabs to whitespace to allow using MPlayer filter sourcecode in FFmpeg.
| author | cehoyos |
|---|---|
| date | Fri, 14 Jan 2011 22:10:21 +0000 |
| parents | a972c1a4a012 |
| children |
line wrap: on
line diff
--- a/libmpcodecs/vf_rectangle.c Fri Jan 14 13:36:48 2011 +0000 +++ b/libmpcodecs/vf_rectangle.c Fri Jan 14 22:10:21 2011 +0000 @@ -36,17 +36,17 @@ unsigned int flags, unsigned int outfmt) { if (vf->priv->w < 0 || width < vf->priv->w) - vf->priv->w = width; + vf->priv->w = width; if (vf->priv->h < 0 || height < vf->priv->h) - vf->priv->h = height; + vf->priv->h = height; if (vf->priv->x < 0) - vf->priv->x = (width - vf->priv->w) / 2; + vf->priv->x = (width - vf->priv->w) / 2; if (vf->priv->y < 0) - vf->priv->y = (height - vf->priv->h) / 2; + vf->priv->y = (height - vf->priv->h) / 2; if (vf->priv->w + vf->priv->x > width - || vf->priv->h + vf->priv->y > height) { - mp_msg(MSGT_VFILTER,MSGL_WARN,"rectangle: bad position/width/height - rectangle area is out of the original!\n"); - return 0; + || vf->priv->h + vf->priv->y > height) { + mp_msg(MSGT_VFILTER,MSGL_WARN,"rectangle: bad position/width/height - rectangle area is out of the original!\n"); + return 0; } return vf_next_config(vf, width, height, d_width, d_height, flags, outfmt); } @@ -57,27 +57,27 @@ const int *const tmp = data; switch(request){ case VFCTRL_CHANGE_RECTANGLE: - switch (tmp[0]){ - case 0: - vf->priv->w += tmp[1]; - return 1; - break; - case 1: - vf->priv->h += tmp[1]; - return 1; - break; - case 2: - vf->priv->x += tmp[1]; - return 1; - break; - case 3: - vf->priv->y += tmp[1]; - return 1; - break; - default: - mp_msg(MSGT_VFILTER,MSGL_FATAL,"Unknown param %d \n", tmp[0]); - return 0; - } + switch (tmp[0]){ + case 0: + vf->priv->w += tmp[1]; + return 1; + break; + case 1: + vf->priv->h += tmp[1]; + return 1; + break; + case 2: + vf->priv->x += tmp[1]; + return 1; + break; + case 3: + vf->priv->y += tmp[1]; + return 1; + break; + default: + mp_msg(MSGT_VFILTER,MSGL_FATAL,"Unknown param %d \n", tmp[0]); + return 0; + } } return vf_next_control(vf, request, data); return 0; @@ -88,18 +88,18 @@ unsigned int bpp = mpi->bpp / 8; int x, y, w, h; dmpi = vf_get_image(vf->next, mpi->imgfmt, MP_IMGTYPE_TEMP, - MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, - mpi->w, mpi->h); + MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE, + mpi->w, mpi->h); memcpy_pic(dmpi->planes[0],mpi->planes[0],mpi->w*bpp, mpi->h, - dmpi->stride[0],mpi->stride[0]); + dmpi->stride[0],mpi->stride[0]); if(mpi->flags&MP_IMGFLAG_PLANAR && mpi->flags&MP_IMGFLAG_YUV){ - memcpy_pic(dmpi->planes[1],mpi->planes[1], - mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, - dmpi->stride[1],mpi->stride[1]); - memcpy_pic(dmpi->planes[2],mpi->planes[2], - mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, - dmpi->stride[2],mpi->stride[2]); + memcpy_pic(dmpi->planes[1],mpi->planes[1], + mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, + dmpi->stride[1],mpi->stride[1]); + memcpy_pic(dmpi->planes[2],mpi->planes[2], + mpi->w>>mpi->chroma_x_shift, mpi->h>>mpi->chroma_y_shift, + dmpi->stride[2],mpi->stride[2]); } /* Draw the rectangle */ @@ -121,36 +121,36 @@ h = FFMAX(h, 0); if (0 <= vf->priv->y && vf->priv->y <= dmpi->height) { - unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; - unsigned int count = w * bpp; - while (count--) - p[count] = 0xff - p[count]; + unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; + unsigned int count = w * bpp; + while (count--) + p[count] = 0xff - p[count]; } if (h != 1 && vf->priv->y + vf->priv->h - 1 <= mpi->height) { - unsigned char *p = dmpi->planes[0] + (vf->priv->y + vf->priv->h - 1) * dmpi->stride[0] + x * bpp; - unsigned int count = w * bpp; - while (count--) - p[count] = 0xff - p[count]; + unsigned char *p = dmpi->planes[0] + (vf->priv->y + vf->priv->h - 1) * dmpi->stride[0] + x * bpp; + unsigned int count = w * bpp; + while (count--) + p[count] = 0xff - p[count]; } if (0 <= vf->priv->x && vf->priv->x <= dmpi->width) { - unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; - unsigned int count = h; - while (count--) { - unsigned int i = bpp; - while (i--) - p[i] = 0xff - p[i]; - p += dmpi->stride[0]; - } + unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + x * bpp; + unsigned int count = h; + while (count--) { + unsigned int i = bpp; + while (i--) + p[i] = 0xff - p[i]; + p += dmpi->stride[0]; + } } if (w != 1 && vf->priv->x + vf->priv->w - 1 <= mpi->width) { - unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + (vf->priv->x + vf->priv->w - 1) * bpp; - unsigned int count = h; - while (count--) { - unsigned int i = bpp; - while (i--) - p[i] = 0xff - p[i]; - p += dmpi->stride[0]; - } + unsigned char *p = dmpi->planes[0] + y * dmpi->stride[0] + (vf->priv->x + vf->priv->w - 1) * bpp; + unsigned int count = h; + while (count--) { + unsigned int i = bpp; + while (i--) + p[i] = 0xff - p[i]; + p += dmpi->stride[0]; + } } return vf_next_put_image(vf, dmpi, pts); } @@ -166,8 +166,8 @@ vf->priv->w = -1; vf->priv->h = -1; if (args) - sscanf(args, "%d:%d:%d:%d", - &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y); + sscanf(args, "%d:%d:%d:%d", + &vf->priv->w, &vf->priv->h, &vf->priv->x, &vf->priv->y); return 1; }
