annotate Meerwald/cmp_dct8x8.c @ 13:cbecc570129d

cleanup warnings
author Peter Meerwald <pmeerw@cosy.sbg.ac.at>
date Mon, 30 Jun 2008 15:43:16 +0200
parents f83ef905a63d
children bd669312f068
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
1 #include "wm.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
2 #include "dct.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
3 #include "gray.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
4 #include "pgm.h"
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
5
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
6 char *progname;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
7
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
8 void usage(void) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
9 fprintf(stderr, "usage: %s [-h] [-m n] [-o file] [-pP] -i file file\n\n", progname);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
10 fprintf(stderr, "\t-h\t\tprint usage\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
11 fprintf(stderr, "\t-i file\t\toriginal image file\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
12 fprintf(stderr, "\t-m n\t\tmultiplication factor (default 16)\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
13 fprintf(stderr, "\t-o file\t\toutput file\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
14 fprintf(stderr, "\t-p\t\tprint PSNR, RMS and MSE\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
15 fprintf(stderr, "\t-P\t\tonly print PSNR, RMS and MSE, no difference image\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
16 exit(0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
17 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
18
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
19 int main(int argc, char *argv[]) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
20
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
21 FILE *in = stdin;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
22 FILE *out = stdout;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
23 FILE *orig = NULL;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
24
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
25 gray **input_image;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
26 gray **orig_image;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
27 double **input_dcts;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
28 double **orig_dcts;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
29 gray **output;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
30
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
31 char output_name[MAXPATHLEN] = "(stdout)";
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
32 char input_name[MAXPATHLEN] = "(stdin)";
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
33 char orig_name[MAXPATHLEN];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
34
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
35 int in_cols, in_rows, in_format;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
36 gray in_maxval;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
37 int orig_cols, orig_rows, orig_format;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
38 gray orig_maxval;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
39 int cols, rows, format;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
40 gray maxval;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
41 int col, row;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
42
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
43 int i, j;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
44 int c;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
45
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
46 int m = 16;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
47
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
48 int print_psnr = 0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
49 int print_psnr_only = 0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
50 double error = 0.0;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
51
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
52 progname = argv[0];
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
53
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
54 pgm_init(&argc, argv); wm_init();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
55
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
56 while ((c = getopt(argc, argv, "h?i:m:o:pP")) != EOF) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
57 switch (c) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
58 case 'h':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
59 case '?':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
60 usage();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
61 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
62 case 'i':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
63 if ((orig = fopen(optarg, "rb")) == NULL) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
64 fprintf(stderr, "%s: unable to open original image file %s\n", progname, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
65 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
66 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
67 strcpy(orig_name, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
68 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
69 case 'm':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
70 m = atoi(optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
71 if (m <= 0) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
72 fprintf(stderr, "%s: multiplication factor %d out of range\n", progname, m);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
73 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
74 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
75 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
76 case 'o':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
77 if ((out = fopen(optarg, "w")) == NULL) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
78 fprintf(stderr, "%s: unable to open output file %s\n", progname, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
79 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
80 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
81 strcpy(output_name, optarg);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
82 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
83 case 'p':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
84 print_psnr = 1;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
85 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
86 case 'P':
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
87 print_psnr_only = 1;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
88 break;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
89 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
90 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
91
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
92 argc -= optind;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
93 argv += optind;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
94
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
95 if (argc > 1) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
96 usage();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
97 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
98 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
99
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
100 if (argc == 1 && *argv[0] != '-') {
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
101 if ((in = fopen(argv[0], "rb")) == NULL) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
102 fprintf(stderr, "%s: unable to open input file %s\n", progname, argv[0]);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
103 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
104 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
105 else
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
106 strcpy(input_name, argv[0]);
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
107 }
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
108
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
109 if (!orig) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
110 fprintf(stderr, "%s: original image file not specified, use -i file option\n", progname);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
111 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
112 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
113
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
114 pgm_readpgminit(in, &in_cols, &in_rows, &in_maxval, &in_format);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
115
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
116 pgm_readpgminit(orig, &orig_cols, &orig_rows, &orig_maxval, &orig_format);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
117
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
118 if (in_cols != orig_cols || in_rows != orig_rows) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
119 fprintf(stderr, "%s: input image %s does not match dimensions of original image %s\n", progname, input_name, orig_name);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
120 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
121 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
122
8
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
123 cols = in_cols;
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
124 rows = in_rows;
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
125 format = in_format;
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
126 maxval = in_maxval;
f83ef905a63d fixing many warnings
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents: 0
diff changeset
127
0
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
128 if (cols % NJPEG) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
129 fprintf(stderr, "%s: image width %d not a multiple of %d\n", progname, cols, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
130 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
131 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
132
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
133 if (rows % NJPEG) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
134 fprintf(stderr, "%s: image height %d not a multiple of %d\n", progname, rows, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
135 exit(1);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
136 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
137
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
138 input_image = pgm_allocarray(cols, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
139 orig_image = pgm_allocarray(cols, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
140
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
141 init_dct_8x8();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
142 input_dcts = alloc_coeffs_8x8();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
143 orig_dcts = alloc_coeffs_8x8();
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
144 output = alloc_grays(cols, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
145
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
146 if (!print_psnr_only)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
147 pgm_writepgminit(out, cols, rows, maxval, 0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
148
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
149 for (row = 0; row < rows; row += NJPEG) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
150
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
151 for (i = 0; i < NJPEG; i++) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
152 pgm_readpgmrow(in, input_image[row % NJPEG], cols, maxval, format);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
153 pgm_readpgmrow(orig, orig_image[row % NJPEG], cols, maxval, format);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
154 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
155
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
156 for (col = 0; col < cols; col += NJPEG) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
157 fdct_block_8x8(input_image, col, 0, input_dcts);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
158 fdct_block_8x8(orig_image, col, 0, orig_dcts);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
159
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
160 for (i = 0; i < NJPEG; i++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
161 for (j = 0; j < NJPEG; j++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
162 error += sqr(input_dcts[j][i + cols] - orig_dcts[j][i + cols]);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
163 output[j][i + col] = PIXELRANGE(fabs(input_dcts[j][i + cols] - orig_dcts[j][i + cols]) * m);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
164 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
165
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
166 if (!print_psnr_only) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
167 for (i = 0; i < NJPEG; i++)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
168 pgm_writepgmrow(out, output[i], cols, maxval, 0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
169 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
170
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
171 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
172 fclose(in);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
173 fclose(orig);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
174 if (!print_psnr_only)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
175 fclose(out);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
176
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
177 pgm_freearray(input_image, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
178 pgm_freearray(orig_image, NJPEG);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
179 free_coeffs(input_dcts);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
180 free_coeffs(orig_dcts);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
181 free_grays(output);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
182
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
183 if (print_psnr || print_psnr_only) {
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
184 double mse = error / (double) (cols * rows);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
185 double rmse = sqrt(mse);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
186 double psnr = 20.0 * log(255.0 / rmse) / log(10.0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
187 FILE *print = print_psnr_only ? out : stderr;
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
188 if (mse > 0.0)
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
189 fprintf(print, "PSNR: %lf dB\n", psnr);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
190 else
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
191 fprintf(print, "PSNR: inf\n");
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
192 fprintf(print, "RMS: %lf\n", rmse);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
193 fprintf(print, "MSE: %lf\n", mse);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
194 }
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
195
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
196 exit(0);
Peter Meerwald <pmeerw@cosy.sbg.ac.at>
parents:
diff changeset
197 }

Repositories maintained by Peter Meerwald, pmeerw@pmeerw.net.