27 #define RANDOM_MAX ((double)(int)(((unsigned int)~0
)>>1
))
37 int oflag = 0, noise_amount = 4;
38 char * in_fname = NULL, * out_fname = NULL;
39 FILE *outfile = stdout;
40 rle_hdr in_hdr, out_hdr;
42 double rand_mult, newpix;
53 srandom( *(
int *)&seed );
60 srand( *(
int *)&seed );
65 if (
scanargs( argc
, argv
, "% n%-amount!d o%-outfile!s infile%s",
66 &noise_amount
, &noise_amount
, &oflag
, &out_fname
, &in_fname
) == 0 )
101 outrows[i] = inrows[i] + out_hdr
.xmin;
103 for ( y = in_hdr
.ymin; y <= in_hdr
.ymax; y++ )
106 for ( i = 0; i < in_hdr
.ncolors; i++ )
107 if ( inrows[i] != NULL )
108 for ( x = in_hdr
.xmin; x <= in_hdr
.xmax; x++ )
110 newpix = inrows[i][x] + random() * rand_mult -
116 inrows[i][x] = newpix;
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)
void rle_addhist(argv, rle_hdr *in_hdr, rle_hdr *out_hdr)
void rle_put_setup(rle_hdr *the_hdr)
rle_hdr * rle_hdr_init(rle_hdr *the_hdr)
#define RLE_CHECK_ALLOC(pgm, ptr, name)