aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Hawthorn <john.hawthorn@gmail.com>2009-12-25 02:23:36 -0800
committerJohn Hawthorn <john.hawthorn@gmail.com>2009-12-25 02:23:36 -0800
commit7b6b8b7d817a2c26f3e8ef9b7e763ac22174ec96 (patch)
treefb9917f83e99e3107b43bbb3aeaeaa162f992079
parent63a954808a57f31490202efc3e08616a6ac6a6d0 (diff)
downloadmirror-meh-7b6b8b7d817a2c26f3e8ef9b7e763ac22174ec96.tar.gz
mirror-meh-7b6b8b7d817a2c26f3e8ef9b7e763ac22174ec96.tar.bz2
mirror-meh-7b6b8b7d817a2c26f3e8ef9b7e763ac22174ec96.zip
slight tweaks. slightly faster
-rw-r--r--src/scale.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/scale.c b/src/scale.c
index 6555af3..92db4a8 100644
--- a/src/scale.c
+++ b/src/scale.c
@@ -46,8 +46,8 @@ static void superscale(struct image *img, unsigned int width, unsigned int heigh
TDEBUG_START
- int divx[bytesperline];
- int divy[bytesperline];
+ unsigned int divx[bytesperline];
+ unsigned int divy[bytesperline];
memset(divx, 0, sizeof divx);
memset(divy, 0, sizeof divy);
for(x = 0; x < img->bufwidth; x++){
@@ -57,27 +57,29 @@ static void superscale(struct image *img, unsigned int width, unsigned int heigh
divy[y * height / img->bufheight]++;
}
- int xoff[img->bufwidth];
+ unsigned int tmp[width * 4];
+
+ unsigned int *xoff[img->bufwidth];
for(x = 0; x < img->bufwidth; x++){
- xoff[x] = (x * width / img->bufwidth) * 3;
+ xoff[x] = tmp + (x * width / img->bufwidth) * 3;
}
- int tmp[width * 4];
unsigned int y0;
+ int * __restrict__ dest;
for(y = 0; y < img->bufheight;){
- int ydiv = divy[y * height / img->bufheight];
+ unsigned int ydiv = divy[y * height / img->bufheight];
char * __restrict__ ydest = &newBuf[bytesperline * (y * height / img->bufheight)];
memset(tmp, 0, sizeof tmp);
ibuf = &img->buf[y * img->bufwidth * 3];
- for(y0 = y; y < y0 + ydiv; y++){
+ for(y0 = y + ydiv; y < y0; y++){
for(x = 0; x < img->bufwidth; x++){
- int * __restrict__ dest = tmp + xoff[x];
+ dest = xoff[x];
for(i = 0; i < 3; i++){
*dest++ += *ibuf++;
}
}
}
- int * __restrict__ src = tmp;
+ unsigned int * __restrict__ src = tmp;
for(x = 0; x < width; x++){
ydest[2] = *src++ / ydiv / divx[x];
ydest[1] = *src++ / ydiv / divx[x];