| 1 | /* |
| 2 | FLAM3 - cosmic recursive fractal flames |
| 3 | Copyright (C) 1992-2009 Spotworks LLC |
| 4 | |
| 5 | This program is free software; you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation; either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | This program is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | #include "private.h"cxx . . $ `<file>/private.h`/ |
| 21 | #include "img.h"cxx . . $ `<file>/img.h`/ |
| 22 | #include "isaacs.h"cxx . . $ `<file>/isaacs.h`/ |
| 23 | |
| 24 | int maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv) { |
| 25 | char *ai, *fname; |
| 26 | char flamename[256]; |
| 27 | char *prefix = argscxx . . $ `private.h:71:9`!("prefix", ""); |
| 28 | int first_frame = argicxx . . $ `private.h:69:9`!("begin", 0); |
| 29 | int last_frame = argicxx . . $ `private.h:69:9`!("end", 0); |
| 30 | int frame_time = argicxx . . $ `private.h:69:9`!("time", 0); |
| 31 | int dtime = argicxx . . $ `private.h:69:9`!("dtime", 1); |
| 32 | int do_fields = argicxx . . $ `private.h:69:9`!("fields", 0); |
| 33 | int write_genome = argicxx . . $ `private.h:69:9`!("write_genome",0); |
| 34 | double qs = argfcxx . . $ `private.h:70:9`!("qs", 1.0); |
| 35 | double ss = argfcxx . . $ `private.h:70:9`!("ss", 1.0); |
| 36 | char *format = getenvcxx . . $ getenv(a8b8e32347182212).("format"); |
| 37 | int verbose = argicxx . . $ `private.h:69:9`!("verbose", 1); |
| 38 | int transparency = argicxx . . $ `private.h:69:9`!("transparency", 0); |
| 39 | int bits = argicxx . . $ `private.h:69:9`!("bits", 33); |
| 40 | int sub_batch_size = argicxx . . $ `private.h:69:9`!("sub_batch_size", 10000); |
| 41 | int bpc = argicxx . . $ `private.h:69:9`!("bpc",8); |
| 42 | int earlyclip = argicxx . . $ `private.h:69:9`!("earlyclip",0); |
| 43 | int ftime, channels; |
| 44 | unsigned char *image; |
| 45 | flam3_genomecxx . . $ flam3_genome# *cps,center_cp; |
| 46 | int i, ncps = 0; |
| 47 | char *inf = getenvcxx . . $ getenv(a8b8e32347182212).("in"); |
| 48 | double pixel_aspect = argfcxx . . $ `private.h:70:9`!("pixel_aspect", 1.0); |
| 49 | int num_threads = argicxx . . $ `private.h:69:9`!("nthreads",0); |
| 50 | FILEcxx . . $ FILE# *in,*fp,*genfp; |
| 51 | flam3_framecxx . . $ flam3_frame# f; |
| 52 | flam3_img_commentscxx . . $ flam3_img_comments# fpc; |
| 53 | stat_structcxx . . $ stat_struct# stats,stats2; |
| 54 | |
| 55 | char badval_string[64]; |
| 56 | char numiter_string[64]; |
| 57 | char rtime_string[64]; |
| 58 | |
| 59 | #ifdef WIN32 |
| 60 | |
| 61 | char *slashloc; |
| 62 | char exepath[256]; |
| 63 | char palpath[256]; |
| 64 | memset(exepath,0,256); |
| 65 | memset(palpath,0,256); |
| 66 | slashloc = strrchr(argv[0],'\\'); |
| 67 | if (NULL==slashloc) { |
| 68 | sprintf(palpath,"flam3_palettes=flam3-palettes.xml"); |
| 69 | } else { |
| 70 | strncpy(exepath,argv[0],slashloc-argv[0]+1); |
| 71 | sprintf(palpath,"flam3_palettes=%sflam3-palettes.xml",exepath); |
| 72 | } |
| 73 | putenv(palpath); |
| 74 | |
| 75 | #endif |
| 76 | |
| 77 | |
| 78 | memsetcxx . . $ memset(d1de1e4fb215f1c6).(¢er_cp,0, sizeof(flam3_genomecxx . . $ flam3_genome#)); |
| 79 | |
| 80 | if (1 != argc) { |
| 81 | docstringcxx . . $ docstring(d878ad36e69247c7).(); |
| 82 | exitcxx . . $ exit(3ca292c338df9bb3).(0); |
| 83 | } |
| 84 | |
| 85 | /* Init random number generators */ |
| 86 | flam3_init_framecxx . . $ flam3_init_frame(4142e08dcdbbecd8).(&f); |
| 87 | flam3_srandomcxx . . $ flam3_srandom(d878ad36e69247c7).(); |
| 88 | |
| 89 | /* Set the number of threads */ |
| 90 | if (num_threads==0) { |
| 91 | num_threads = flam3_count_nthreadscxx . . $ flam3_count_nthreads(b126dc7c1de90089).(); |
| 92 | if (verbose > 1) |
| 93 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Automatically detected %d core(s)...\n",num_threads); |
| 94 | } else{ |
| 95 | if (verbose) |
| 96 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Manually specified %d thread(s)...\n",num_threads); |
| 97 | } |
| 98 | |
| 99 | if (getenvcxx . . $ getenv(a8b8e32347182212).("frame")) { |
| 100 | if (getenvcxx . . $ getenv(a8b8e32347182212).("time")) { |
| 101 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "cannot specify both time and frame.\n"); |
| 102 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 103 | } |
| 104 | if (getenvcxx . . $ getenv(a8b8e32347182212).("begin") || getenvcxx . . $ getenv(a8b8e32347182212).("end")) { |
| 105 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "cannot specify both frame and begin or end.\n"); |
| 106 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 107 | } |
| 108 | first_frame = last_frame = atoicxx . . $ atoi(5c4306d8553b3696).(getenvcxx . . $ getenv(a8b8e32347182212).("frame")); |
| 109 | } |
| 110 | |
| 111 | if (getenvcxx . . $ getenv(a8b8e32347182212).("time")) { |
| 112 | if (getenvcxx . . $ getenv(a8b8e32347182212).("begin") || getenvcxx . . $ getenv(a8b8e32347182212).("end")) { |
| 113 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "cannot specify both time and begin or end.\n"); |
| 114 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 115 | } |
| 116 | first_frame = last_frame = frame_time; |
| 117 | } |
| 118 | |
| 119 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == format) format = "png"; |
| 120 | if (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format, "jpg") && |
| 121 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format, "ppm") && |
| 122 | strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format, "png")) { |
| 123 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "format must be either jpg, ppm, or png, not %s.\n", format); |
| 124 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 125 | } |
| 126 | |
| 127 | |
| 128 | if (pixel_aspect <= 0.0) { |
| 129 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "pixel aspect ratio must be positive, not %g.\n", |
| 130 | pixel_aspect); |
| 131 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 132 | } |
| 133 | |
| 134 | if (inf) |
| 135 | in = fopencxx . . $ fopen(82ec0787cd37e0a3).(inf, "rb"); |
| 136 | else |
| 137 | in = stdincxx . . $ `<external>/232824719582829767/stdio.h:153:9`!; |
| 138 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == in) { |
| 139 | perrorcxx . . $ perror(85c52e162fed56f9).(inf); |
| 140 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 141 | } |
| 142 | |
| 143 | cps = flam3_parse_from_filecxx . . $ flam3_parse_from_file(c6e32308d4d1c9).(in, inf, flam3_defaults_oncxx . . $ `flam3.h:48:9`!, &ncps); |
| 144 | if (inf) |
| 145 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(in); |
| 146 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == cps) { |
| 147 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!," error reading genomes.\n"); |
| 148 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 149 | } |
| 150 | if (0 == ncps) { |
| 151 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error: no genomes.\n"); |
| 152 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 153 | } |
| 154 | for (i = 0; i < ncps; i++) { |
| 155 | cps[i].sample_densitycxx . . $ $anonymous_type_d4ed57c78da46593_3#sample_density. *= qs; |
| 156 | cps[i].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height. = (int)(cps[i].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height. * ss); |
| 157 | cps[i].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width. = (int)(cps[i].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width. * ss); |
| 158 | cps[i].pixels_per_unitcxx . . $ $anonymous_type_d4ed57c78da46593_3#pixels_per_unit. *= ss; |
| 159 | if (cps[i].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height.<=0 || cps[i].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width.<=0) { |
| 160 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"output image has dimension <=0, aborting.\n"); |
| 161 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 162 | } |
| 163 | if (i > 0 && cps[i].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time. <= cps[i-1].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time.) { |
| 164 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "error: control points must be sorted by time, but %g <= %g, index %d.\n", |
| 165 | cps[i].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time., cps[i-1].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time., i); |
| 166 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 167 | } |
| 168 | if ((cps[i].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width. != cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width.) || |
| 169 | (cps[i].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height. != cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height.)) { |
| 170 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "warning: flame %d at time %g size mismatch. " |
| 171 | "(%d,%d) should be (%d,%d).\n", |
| 172 | i, cps[i].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time., |
| 173 | cps[i].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width., cps[i].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height., |
| 174 | cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width., cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height.); |
| 175 | cps[i].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width. = cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width.; |
| 176 | cps[i].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height. = cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height.; |
| 177 | } |
| 178 | } |
| 179 | if (!getenvcxx . . $ getenv(a8b8e32347182212).("time") && !getenvcxx . . $ getenv(a8b8e32347182212).("frame")) { |
| 180 | if (!getenvcxx . . $ getenv(a8b8e32347182212).("begin")) { |
| 181 | first_frame = (int) cps[0].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time.; |
| 182 | } |
| 183 | if (!getenvcxx . . $ getenv(a8b8e32347182212).("end")) { |
| 184 | last_frame = (int) cps[ncps-1].timecxx . . $ $anonymous_type_d4ed57c78da46593_3#time. - 1; |
| 185 | if (last_frame < first_frame) last_frame = first_frame; |
| 186 | } |
| 187 | } |
| 188 | channels = strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format, "png") ? 3 : 4; |
| 189 | |
| 190 | /* Check for 16-bit-per-channel processing */ |
| 191 | if ( (16 == bpc) && (strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format,"png") != 0)) { |
| 192 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Support for 16 bpc images is only present for the png format.\n"); |
| 193 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 194 | } else if (bpc != 8 && bpc != 16) { |
| 195 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"Unexpected bpc specified (%d)\n",bpc); |
| 196 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 197 | } |
| 198 | |
| 199 | // f.temporal_filter_radius = argf("blur", 0.5); |
| 200 | f.pixel_aspect_ratiocxx . . $ $anonymous_type_d4ed57c78da46593_5#pixel_aspect_ratio. = pixel_aspect; |
| 201 | f.genomescxx . . $ $anonymous_type_d4ed57c78da46593_5#genomes. = cps; |
| 202 | f.ngenomescxx . . $ $anonymous_type_d4ed57c78da46593_5#ngenomes. = ncps; |
| 203 | f.verbosecxx . . $ $anonymous_type_d4ed57c78da46593_5#verbose. = verbose; |
| 204 | f.bitscxx . . $ $anonymous_type_d4ed57c78da46593_5#bits. = bits; |
| 205 | f.progresscxx . . $ $anonymous_type_d4ed57c78da46593_5#progress. = 0; |
| 206 | f.earlyclipcxx . . $ $anonymous_type_d4ed57c78da46593_5#earlyclip. = earlyclip; |
| 207 | f.nthreadscxx . . $ $anonymous_type_d4ed57c78da46593_5#nthreads. = num_threads; |
| 208 | f.sub_batch_sizecxx . . $ $anonymous_type_d4ed57c78da46593_5#sub_batch_size. = sub_batch_size; |
| 209 | |
| 210 | if (16==bpc) |
| 211 | f.bytes_per_channelcxx . . $ $anonymous_type_d4ed57c78da46593_5#bytes_per_channel. = 2; |
| 212 | else |
| 213 | f.bytes_per_channelcxx . . $ $anonymous_type_d4ed57c78da46593_5#bytes_per_channel. = 1; |
| 214 | |
| 215 | |
| 216 | image = (void *) calloccxx . . $ calloc(63a7bf2941bfcd7a).((size_t)channels * |
| 217 | (size_t)cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width. * |
| 218 | (size_t)cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height. * f.bytes_per_channelcxx . . $ $anonymous_type_d4ed57c78da46593_5#bytes_per_channel., sizeof(char)); |
| 219 | |
| 220 | if (dtime < 1) { |
| 221 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "dtime must be positive, not %d.\n", dtime); |
| 222 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 223 | } |
| 224 | |
| 225 | for (ftime = first_frame; ftime <= last_frame; ftime += dtime) { |
| 226 | f.timecxx . . $ $anonymous_type_d4ed57c78da46593_5#time. = (double) ftime; |
| 227 | |
| 228 | if (verbose && ((last_frame-first_frame)/dtime) >= 1) { |
| 229 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "time = %d/%d/%d\n", ftime, last_frame, dtime); |
| 230 | } |
| 231 | |
| 232 | if (do_fields) { |
| 233 | |
| 234 | if (flam3_rendercxx . . $ flam3_render(65dcdf3bdd0e255d).(&f, image, flam3_field_evencxx . . $ `flam3.h:627:9`!, channels, transparency,&stats)) { |
| 235 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"error rendering image: aborting.\n"); |
| 236 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 237 | } |
| 238 | f.timecxx . . $ $anonymous_type_d4ed57c78da46593_5#time. += 0.5; |
| 239 | if (flam3_rendercxx . . $ flam3_render(65dcdf3bdd0e255d).(&f, image, flam3_field_oddcxx . . $ `flam3.h:628:9`!, channels, transparency,&stats2)) { |
| 240 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"error rendering image: aborting.\n"); |
| 241 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 242 | } |
| 243 | |
| 244 | stats.badvalscxx . . $ $anonymous_type_d4ed57c78da46593_1#badvals.+=stats2.badvalscxx . . $ $anonymous_type_d4ed57c78da46593_1#badvals.; |
| 245 | stats.render_secondscxx . . $ $anonymous_type_d4ed57c78da46593_1#render_seconds.+=stats2.render_secondscxx . . $ $anonymous_type_d4ed57c78da46593_1#render_seconds.; |
| 246 | stats.num_iterscxx . . $ $anonymous_type_d4ed57c78da46593_1#num_iters.+=stats2.num_iterscxx . . $ $anonymous_type_d4ed57c78da46593_1#num_iters.; |
| 247 | } else { |
| 248 | if (flam3_rendercxx . . $ flam3_render(65dcdf3bdd0e255d).(&f, image, flam3_field_bothcxx . . $ `flam3.h:626:9`!, channels, transparency,&stats)) { |
| 249 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!,"error rendering image: aborting.\n"); |
| 250 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | if (getenvcxx . . $ getenv(a8b8e32347182212).("out")) |
| 255 | fname = getenvcxx . . $ getenv(a8b8e32347182212).("out"); |
| 256 | else { |
| 257 | fname = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(strlencxx . . $ strlen(751346f8406fd082).(prefix) + 20); |
| 258 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(fname, "%s%05d.%s", prefix, ftime, format); |
| 259 | } |
| 260 | |
| 261 | if (verbose) |
| 262 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "writing %s...", fname); |
| 263 | |
| 264 | if (write_genome) { |
| 265 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(flamename,"%s.flam3",fname); |
| 266 | |
| 267 | /* get center genome */ |
| 268 | flam3_interpolatecxx . . $ flam3_interpolate(8e79edf768e9d90f).(f.genomescxx . . $ $anonymous_type_d4ed57c78da46593_5#genomes., f.ngenomescxx . . $ $anonymous_type_d4ed57c78da46593_5#ngenomes., f.timecxx . . $ $anonymous_type_d4ed57c78da46593_5#time., 0, ¢er_cp); |
| 269 | |
| 270 | /* write it out */ |
| 271 | genfp = fopencxx . . $ fopen(82ec0787cd37e0a3).(flamename,"w"); |
| 272 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == genfp) { |
| 273 | perrorcxx . . $ perror(85c52e162fed56f9).(flamename); |
| 274 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 275 | } |
| 276 | |
| 277 | flam3_printcxx . . $ flam3_print(23fe5a5ee5da949e).(genfp, ¢er_cp, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, flam3_print_editscxx . . $ `flam3.h:53:9`!); |
| 278 | |
| 279 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(genfp); |
| 280 | } |
| 281 | |
| 282 | fp = fopencxx . . $ fopen(82ec0787cd37e0a3).(fname, "wb"); |
| 283 | if (NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! == fp) { |
| 284 | perrorcxx . . $ perror(85c52e162fed56f9).(fname); |
| 285 | exitcxx . . $ exit(3ca292c338df9bb3).(1); |
| 286 | } |
| 287 | |
| 288 | /* Get center cp for embedding in png file */ |
| 289 | flam3_interpolatecxx . . $ flam3_interpolate(8e79edf768e9d90f).(f.genomescxx . . $ $anonymous_type_d4ed57c78da46593_5#genomes., f.ngenomescxx . . $ $anonymous_type_d4ed57c78da46593_5#ngenomes., f.timecxx . . $ $anonymous_type_d4ed57c78da46593_5#time., 0, ¢er_cp); |
| 290 | |
| 291 | /* Convert to string */ |
| 292 | fpc.genomecxx . . $ $anonymous_type_78c5e6a72a418af9_0#genome. = flam3_print_to_stringcxx . . $ flam3_print_to_string(1831709153df027a).(¢er_cp); |
| 293 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(badval_string, "%g",stats.badvalscxx . . $ $anonymous_type_d4ed57c78da46593_1#badvals./(double)stats.num_iterscxx . . $ $anonymous_type_d4ed57c78da46593_1#num_iters.); |
| 294 | fpc.badvalscxx . . $ $anonymous_type_78c5e6a72a418af9_0#badvals. = badval_string; |
| 295 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(numiter_string,"%g",(double)stats.num_iterscxx . . $ $anonymous_type_d4ed57c78da46593_1#num_iters.); |
| 296 | fpc.numiterscxx . . $ $anonymous_type_78c5e6a72a418af9_0#numiters. = numiter_string; |
| 297 | sprintfcxx . . $ sprintf(26c8642d26409d6d).(rtime_string,"%d",stats.render_secondscxx . . $ $anonymous_type_d4ed57c78da46593_1#render_seconds.); |
| 298 | fpc.rtimecxx . . $ $anonymous_type_78c5e6a72a418af9_0#rtime. = rtime_string; |
| 299 | |
| 300 | if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format, "png")) { |
| 301 | |
| 302 | write_pngcxx . . $ write_png(3e16693ba21738cc).(fp, image, cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width., cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height., &fpc, f.bytes_per_channelcxx . . $ $anonymous_type_d4ed57c78da46593_5#bytes_per_channel.); |
| 303 | |
| 304 | } else if (!strcmpcxx . . $ strcmp(5ae29d726ae57f88).(format, "jpg")) { |
| 305 | |
| 306 | write_jpegcxx . . $ write_jpeg(620951cf4c809ab2).(fp, image, cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width., cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height., &fpc); |
| 307 | |
| 308 | } else { |
| 309 | int size = 3 * cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width. * cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height.; |
| 310 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "P6\n"); |
| 311 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(fp, "%d %d\n255\n", cps[0].widthcxx . . $ $anonymous_type_d4ed57c78da46593_3#width., cps[0].heightcxx . . $ $anonymous_type_d4ed57c78da46593_3#height.); |
| 312 | if (size != fwritecxx . . $ fwrite(ab0609fa07c47d6e).(image, 1, size, fp)) { |
| 313 | perrorcxx . . $ perror(85c52e162fed56f9).(fname); |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | /* Free string */ |
| 318 | freecxx . . $ free(5d22bdacc48458e8).(fpc.genomecxx . . $ $anonymous_type_78c5e6a72a418af9_0#genome.); |
| 319 | |
| 320 | clear_cpcxx . . $ clear_cp(843ee1bb9c5f59ba).(¢er_cp,0); |
| 321 | |
| 322 | fclosecxx . . $ fclose(89bc1efcdac0ca22).(fp); |
| 323 | |
| 324 | if (!getenvcxx . . $ getenv(a8b8e32347182212).("out")) |
| 325 | freecxx . . $ free(5d22bdacc48458e8).(fname); |
| 326 | |
| 327 | } |
| 328 | |
| 329 | for (i = 0; i < ncps; i++) { |
| 330 | xmlFreeDoccxx . . $ xmlFreeDoc(42de24d0ab3f771).(cps[i].editscxx . . $ $anonymous_type_d4ed57c78da46593_3#edits.); |
| 331 | clear_cpcxx . . $ clear_cp(843ee1bb9c5f59ba).(&cps[i],0); |
| 332 | } |
| 333 | freecxx . . $ free(5d22bdacc48458e8).(cps); |
| 334 | |
| 335 | freecxx . . $ free(5d22bdacc48458e8).(image); |
| 336 | |
| 337 | if (verbose) |
| 338 | fprintfcxx . . $ fprintf(bc216f8e5b1ebeac).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!, "done.\n"); |
| 339 | |
| 340 | fflushcxx . . $ fflush(89bc1efcdac0ca22).(stderrcxx . . $ `<external>/232824719582829767/stdio.h:155:9`!); |
| 341 | return 0; |
| 342 | } |