16 #define MAX(i,j) ( (i) > (j) ? (i) : (j) )
18 #define RLE_EXPONENT (in_hdr.ncolors-1
)
39 float maxval, tmp, expnt, tmp_max;
40 char *infilename = NULL, *outfilename = NULL;
41 FILE *outfile = stdout;
45 if (
scanargs(argc
, argv
, "% v%- p%- s%- m%-maxval!f o%-outfile!s infile!s",
46 &verbose_flag
, &print_flag
, &scan_flag
, &max_flag
, &maxval
,
47 &oflag
, &outfilename
, &infilename
) == 0)
56 for ( rle_cnt = 0; ; rle_cnt++ )
59 if ( start < 0 && !max_flag && !scan_flag )
62 "%s: Can't pipe input unless either -m or -s is given.\n",
71 fprintf(stderr,
"%s: warning - no exponential_data comment\n",
77 "%s: File does not contain exponent channel.\n",
91 if ((verbose_flag) && (y % 100) == 0)
92 fprintf(stderr,
"Scanning row %d...\n", y);
104 maxval =
MAX( maxval, tmp );
107 if (scan_flag || print_flag || verbose_flag)
108 fprintf(stderr,
"Maximum value: %1.8g\n", maxval);
110 if (scan_flag) exit(0);
148 if (((y % 100) == 0) && verbose_flag)
149 fprintf(stderr,
"Processing row %d...\n", y);
163 tmp = expnt / maxval * tmp_max;
172 tmp *= expnt / maxval;
190 fprintf(stderr,
"%s: %d bytes truncated (sorry...)\n",
FILE * rle_open_f(char *prog_name, char *file_name, char *mode)
rle_hdr * rle_hdr_cp(rle_hdr *from_hdr, rle_hdr *to_hdr)
void rle_names(rle_hdr *the_hdr, const char *pgmname, const char *fname, int img_num)
void rle_row_free(rle_hdr *the_hdr, rle_pixel **scanp)
char * cmd_name(char **argv)
void main(int argc, char **argv)
int rle_get_setup(rle_hdr *the_hdr)
int rle_row_alloc(rle_hdr *the_hdr, rle_pixel ***scanp)
int rle_getrow(rle_hdr *the_hdr, scanline)
int rle_get_error(int code, const char *pgmname, const char *fname)
int scanargs(int argc, char **argv, const char *format,...)
void rle_puteof(rle_hdr *the_hdr)
void rle_putrow(rows, int rowlen, rle_hdr *the_hdr)
const char * rle_delcom(char *name, the_hdr) const
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
char * rle_getcom(char *name, rle_hdr *the_hdr) const
void rle_put_setup(rle_hdr *the_hdr)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)