#include /* sub.c This is a file of subroutines getcode, diff, value, images, and files */ #include "idc.h" /******************************************************************************* *NOTICE: * *This code is believed by the author to be bug free. You are free to use and * *modify this code with the understanding that any use, either direct or * *derivative, must contain acknowledgement of its author and source. The author* *makes no warranty of any kind, expressed or implied, of merchantability or * *fitness for a particular purpose. The author shall not be held liable for any* *incidental or consequential damages in connection with or arising out of the * *furnishing, performance, or use of this software. This software is not * *authorized for use in life support devices or systems. * ********************************************************************************/ /* This subroutine gets code and code lengths from a file code is put in an array named code and the code lengths are put in an array named length */ void getcode(FILE *fp, int num, unsigned int *code, char *length) { fread(code,sizeof(unsigned int),num,fp); /* gets code from a file */ fread(length,sizeof(char),num,fp); /* gets code lengths from file */ fclose(fp); } /* This subroutine calculates the differences between pixals, the differences are put in an array named dimage so they can be used later and do not have to be recalculated */ void diff(int *diffs, unsigned char *image,int rows,int cols,int num, unsigned char *dimage) { int i,j,d; /* i,j are counters, d is the difference between pixals */ unsigned char p; /* p is an unsigned char used to write the differences into an array */ /* find diffs */ d=0-*(image); /* the first character's difference is subtracted from zero */ for(i=0;i