summaryrefslogtreecommitdiff
path: root/rMD-exp
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-11-07 08:55:56 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-11-07 08:55:56 +0000
commitc8a065fce0937a40a0f050c1c8b19ad0700a7625 (patch)
tree347328184c8a95755e99a1f06103fa8001a6d9e7 /rMD-exp
parentbda6b2593e7906db106779f8d73a1c99441d8ed8 (diff)
Loops in comparing-caching blocks are made with incrementing pointers
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@150 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'rMD-exp')
-rw-r--r--rMD-exp/src/cache_frame.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/rMD-exp/src/cache_frame.c b/rMD-exp/src/cache_frame.c
index d845367..c100505 100644
--- a/rMD-exp/src/cache_frame.c
+++ b/rMD-exp/src/cache_frame.c
@@ -31,12 +31,18 @@ int CompareBlocks(unsigned char *incoming,unsigned char *old,int blockno,int wid
int j,i,
block_i=blockno/divisor,//place on the grid
block_k=blockno%divisor;
+ register unsigned char *incoming_reg=&(incoming[block_i*(width*height/divisor)+block_k*width/divisor]),
+ *old_reg=&(old[block_i*(width*height/divisor)+block_k*width/divisor]);
+
+ for(j=0;j<height/divisor;j++){
+ for(i=0;i<width/divisor;i++){
+ if((*(incoming_reg++))!=(*(old_reg++)))
+ return 1;
+ }
+ incoming_reg+=(width-width/divisor);
+ old_reg+=(width-width/divisor);
+ }
- for(j=0;j<height/divisor;j++)//we copy rows
- for(i=0;i<width/divisor;i++)
- if(incoming[block_i*(width*height/divisor)+j*width+block_k*width/divisor+i]!=
- old[block_i*(width*height/divisor)+j*width+block_k*width/divisor+i])
- return 1;
return 0;
}
@@ -44,10 +50,11 @@ void FlushBlock(unsigned char *buf,int blockno,int width, int height,int divisor
int j,
block_i=blockno/divisor,//place on the grid
block_k=blockno%divisor;
-
- for(j=0;j<height/divisor;j++)//we flush in rows
- gzwrite(fp,(void *)&buf[block_i*(width*height/divisor)+j*width+block_k*width/divisor],width/divisor);
-
+ register unsigned char *buf_reg=(&buf[block_i*(width*height/divisor)+block_k*width/divisor]);
+ for(j=0;j<height/divisor;j++){//we flush in rows
+ gzwrite(fp,(void *)buf_reg,width/divisor);
+ buf_reg+=width;
+ }
}
void *CacheImageBuffer(void *pdata){
© All Rights Reserved