summaryrefslogtreecommitdiffstats
path: root/libmpcodecs/vf_crop.c
diff options
context:
space:
mode:
authorrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-30 18:24:04 +0000
committerrfelker <rfelker@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-30 18:24:04 +0000
commit9d0b5a9eaf8fe03a2064ccf54a56d743262f058a (patch)
treea83a2c4ece1de51f266df060410724d9650bfaac /libmpcodecs/vf_crop.c
parentc36a1c25ba470852fb3a3adfdeb8111d7ce04f44 (diff)
downloadmpv-9d0b5a9eaf8fe03a2064ccf54a56d743262f058a.tar.bz2
mpv-9d0b5a9eaf8fe03a2064ccf54a56d743262f058a.tar.xz
100l in my 100l fix! :(
it's finally right now (i hope!) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10028 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vf_crop.c')
-rw-r--r--libmpcodecs/vf_crop.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/libmpcodecs/vf_crop.c b/libmpcodecs/vf_crop.c
index cdd5aa45ba..0191f098ea 100644
--- a/libmpcodecs/vf_crop.c
+++ b/libmpcodecs/vf_crop.c
@@ -107,20 +107,30 @@ static void start_slice(struct vf_instance_s* vf, mp_image_t *mpi){
static void draw_slice(struct vf_instance_s* vf,
unsigned char** src, int* stride, int w,int h, int x, int y){
unsigned char *src2[3];
- src2[0] = src[0] + vf->priv->crop_y*stride[0] + vf->priv->crop_x;
+ src2[0] = src[0];
if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) {
- src2[1] = src[1] + (vf->priv->crop_y>>vf->priv->dmpi->chroma_y_shift)*stride[1]
- + (vf->priv->crop_x>>vf->priv->dmpi->chroma_x_shift);
- src2[2] = src[2] + (vf->priv->crop_y>>vf->priv->dmpi->chroma_y_shift)*stride[2]
- + (vf->priv->crop_x>>vf->priv->dmpi->chroma_x_shift);
+ src2[1] = src[1];
+ src2[2] = src[2];
}
//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 = -x;
+ src2[0] += x;
+ if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) {
+ src2[1] += x>>vf->priv->dmpi->chroma_x_shift;
+ src2[2] += x>>vf->priv->dmpi->chroma_x_shift;
+ }
+ w -= x;
x = 0;
}
if ((y -= vf->priv->crop_y) < 0) {
- h += y;
+ y = -y;
+ src2[0] += y*stride[0];
+ if (vf->priv->dmpi->flags & MP_IMGFLAG_PLANAR) {
+ src2[1] += (y>>vf->priv->dmpi->chroma_y_shift)*stride[1];
+ src2[2] += (y>>vf->priv->dmpi->chroma_y_shift)*stride[2];
+ }
+ h -= y;
y = 0;
}
if (x+w > vf->priv->crop_w) w = vf->priv->crop_w-x;