[xiph-cvs] cvs commit: snatch snatchconvert.c
Monty
xiphmont at xiph.org
Sat Feb 23 15:19:44 PST 2002
xiphmont 02/02/23 15:19:44
Modified: . snatchconvert.c
Log:
bounds fix in yuvscale
Revision Changes Path
1.13 +46 -4 snatch/snatchconvert.c
Index: snatchconvert.c
===================================================================
RCS file: /usr/local/cvsroot/snatch/snatchconvert.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- snatchconvert.c 2002/02/23 22:57:46 1.12
+++ snatchconvert.c 2002/02/23 23:19:43 1.13
@@ -640,7 +640,6 @@
int dyo=(dh-sh)/4,syo=0;
/* dirt simple for now. No scaling, just centering */
- memset(dst,1,dw*dh*3/2);
if(dyo<0){
syo= -dyo;
@@ -651,11 +650,25 @@
dxo=0;
}
+ for(y=0;y<dyo*2;y++){
+ unsigned char *dptr=dst+y*dw;
+ for(x=0;x<dw;x++)
+ *dptr++=0;
+ }
+
for(y=0;y<sh && y<dh;y++){
unsigned char *sptr=src+(y+syo*2)*sw+sxo*2;
- unsigned char *dptr=dst+(y+dyo*2)*dw+dxo*2;
+ unsigned char *dptr=dst+(y+dyo*2)*dw;
+ for(x=0;x<dxo*2;x++)
+ *dptr++=0;
for(x=0;x<sw && x<dw;x++)
*dptr++=*sptr++;
+ for(;x<dw-dxo*2;x++)
+ *dptr++=0;
+ }
+
+ for(;y<dh-dyo*2;y++){
+ unsigned char *dptr=dst+(y+dyo*2)*dw;
for(x=0;x<dw;x++)
*dptr++=0;
}
@@ -667,23 +680,52 @@
sh/=2;
dh/=2;
+ for(y=0;y<dyo;y++){
+ unsigned char *dptr=dst+y*dw;
+ for(x=0;x<dw;x++)
+ *dptr++=128;
+ }
+
for(y=0;y<sh && y<dh;y++){
unsigned char *sptr=src+(y+syo)*sw+sxo;
- unsigned char *dptr=dst+(y+dyo)*dw+dxo;
+ unsigned char *dptr=dst+(y+dyo)*dw;
+ for(x=0;x<dxo;x++)
+ *dptr++=128;
for(x=0;x<sw && x<dw;x++)
*dptr++=*sptr++;
+ for(;x<dw-dxo;x++)
+ *dptr++=128;
+ }
+
+ for(;y<dh-dyo;y++){
+ unsigned char *dptr=dst+(y+dyo)*dw;
for(x=0;x<dw;x++)
*dptr++=128;
}
+
src+=sw*sh;
dst+=dw*dh;
+ for(y=0;y<dyo;y++){
+ unsigned char *dptr=dst+y*dw;
+ for(x=0;x<dw;x++)
+ *dptr++=128;
+ }
+
for(y=0;y<sh && y<dh;y++){
unsigned char *sptr=src+(y+syo)*sw+sxo;
- unsigned char *dptr=dst+(y+dyo)*dw+dxo;
+ unsigned char *dptr=dst+(y+dyo)*dw;
+ for(x=0;x<dxo;x++)
+ *dptr++=128;
for(x=0;x<sw && x<dw;x++)
*dptr++=*sptr++;
+ for(;x<dw-dxo;x++)
+ *dptr++=128;
+ }
+
+ for(;y<dh-dyo;y++){
+ unsigned char *dptr=dst+(y+dyo)*dw;
for(x=0;x<dw;x++)
*dptr++=128;
}
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list