From 9c445fbe7a02806422bd48bb52190288c4fb66e6 Mon Sep 17 00:00:00 2001 From: Alan Curry Date: Thu, 27 Apr 2006 21:42:41 +0000 Subject: [PATCH] Fix some bugs handling input that is not aligned at 16 bytes or has stride!=width. Originally committed as revision 18323 to svn://svn.mplayerhq.hu/mplayer/trunk/postproc --- postproc/yuv2rgb_altivec.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/postproc/yuv2rgb_altivec.c b/postproc/yuv2rgb_altivec.c index 43ac871fd3..9a73b577ac 100644 --- a/postproc/yuv2rgb_altivec.c +++ b/postproc/yuv2rgb_altivec.c @@ -278,7 +278,7 @@ static int altivec_##name (SwsContext *c, \ vector signed short R1,G1,B1; \ vector unsigned char R,G,B; \ \ - vector unsigned char *uivP, *vivP; \ + vector unsigned char *y1ivP, *y2ivP, *uivP, *vivP; \ vector unsigned char align_perm; \ \ vector signed short \ @@ -292,7 +292,7 @@ static int altivec_##name (SwsContext *c, \ vector unsigned short lCSHIFT = c->CSHIFT; \ \ ubyte *y1i = in[0]; \ - ubyte *y2i = in[0]+w; \ + ubyte *y2i = in[0]+instrides[0]; \ ubyte *ui = in[1]; \ ubyte *vi = in[2]; \ \ @@ -304,7 +304,7 @@ static int altivec_##name (SwsContext *c, \ (oplanes[0]+srcSliceY*outstrides[0]+outstrides[0]); \ \ \ - instrides_scl[0] = instrides[0]; \ + instrides_scl[0] = instrides[0]*2-w; /* the loop moves y{1,2}i by w */ \ instrides_scl[1] = instrides[1]-w/2; /* the loop moves ui by w/2 */ \ instrides_scl[2] = instrides[2]-w/2; /* the loop moves vi by w/2 */ \ \ @@ -315,11 +315,17 @@ static int altivec_##name (SwsContext *c, \ \ for (j=0;j