| 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 | #ifndef private_included |
| 20 | #define private_includedcxx . . $ `private.h:20:9`! |
| 21 | |
| 22 | #include "flam3.h"cxx . . $ `<file>/flam3.h`/ |
| 23 | #include "config.h"cxx . . $ `<file>/config.h`/ |
| 24 | #include <stdlib.h> |
| 25 | |
| 26 | #include <ctype.h> |
| 27 | #include <time.h> |
| 28 | #include <string.h> |
| 29 | #include <libxml/parser.h> |
| 30 | |
| 31 | #ifdef _WIN32 |
| 32 | #define basename(x) strdup(x) |
| 33 | #define snprintf _snprintf |
| 34 | #define _USE_MATH_DEFINES |
| 35 | #else |
| 36 | #include <unistd.h> |
| 37 | #include <libgen.h> |
| 38 | #endif |
| 39 | |
| 40 | #include <math.h> |
| 41 | |
| 42 | #ifdef HAVE_LIBPTHREADcxx . . $ `config.h:23:9`! |
| 43 | #include <pthread.h> |
| 44 | #endif |
| 45 | |
| 46 | #define PREFILTER_WHITEcxx . . $ `private.h:46:9`! 255 |
| 47 | #define EPScxx . . $ `private.h:47:9`! (1e-10) |
| 48 | #define CMAP_SIZEcxx . . $ `private.h:48:9`! 256 |
| 49 | #define CMAP_SIZE_M1cxx . . $ `private.h:49:9`! 255 |
| 50 | #define rbitcxx . . $ `private.h:50:9`!() (flam3_random_bit()) |
| 51 | #define flam3_variation_nonecxx . . $ `private.h:51:9`! (-1) |
| 52 | #define max_specified_varscxx . . $ `private.h:52:9`! (100) |
| 53 | #define vlencxx . . $ `private.h:53:9`!(x) (sizeof(x)/sizeof(*x)) |
| 54 | |
| 55 | |
| 56 | #ifdef _WIN32 |
| 57 | |
| 58 | #ifndef M_PI |
| 59 | #define M_PI 3.1415926536 |
| 60 | #define M_1_PI 0.3183098862 |
| 61 | #define M_PI_4 0.7853981634 |
| 62 | #endif |
| 63 | #define random() (rand() ^ (rand()<<15)) |
| 64 | #define srandom(x) (srand(x)) |
| 65 | extern int getpid(); |
| 66 | #define rint(A) floor((A)+(((A) < 0)? -0.5 : 0.5)) |
| 67 | #endif |
| 68 | |
| 69 | #define argicxx . . $ `private.h:69:9`!(s,d) ((ai = getenv(s)) ? atoi(ai) : (d)) |
| 70 | #define argfcxx . . $ `private.h:70:9`!(s,d) ((ai = getenv(s)) ? atof(ai) : (d)) |
| 71 | #define argscxx . . $ `private.h:71:9`!(s,d) ((ai = getenv(s)) ? ai : (d)) |
| 72 | |
| 73 | void docstringcxx . . $ docstring(d878ad36e69247c7).(); |
| 74 | |
| 75 | /* Structures for passing parameters to iteration threads */ |
| 76 | typedef structcxx . . $ $anonymous_type_20002849f0f6538d_0# { |
| 77 | unsigned short *xform_distribcxx . . $ $anonymous_type_20002849f0f6538d_0#xform_distrib.; /* Distribution of xforms based on weights */ |
| 78 | flam3_framecxx . . $ flam3_frame# *speccxx . . $ $anonymous_type_20002849f0f6538d_0#spec.; /* Frame contains timing information */ |
| 79 | double boundscxx . . $ $anonymous_type_20002849f0f6538d_0#bounds.[4]; /* Corner coords of viewable area */ |
| 80 | double rotcxx . . $ $anonymous_type_20002849f0f6538d_0#rot.[2][2]; /* Rotation transformation */ |
| 81 | double sizecxx . . $ $anonymous_type_20002849f0f6538d_0#size.[2]; |
| 82 | int widthcxx . . $ $anonymous_type_20002849f0f6538d_0#width., heightcxx . . $ $anonymous_type_20002849f0f6538d_0#height.; /* buffer width/height */ |
| 83 | double ws0cxx . . $ $anonymous_type_20002849f0f6538d_0#ws0., wb0s0cxx . . $ $anonymous_type_20002849f0f6538d_0#wb0s0., hs1cxx . . $ $anonymous_type_20002849f0f6538d_0#hs1., hb1s1cxx . . $ $anonymous_type_20002849f0f6538d_0#hb1s1.; /* shortcuts for indexing */ |
| 84 | flam3_palette_entrycxx . . $ flam3_palette_entry# *dmapcxx . . $ $anonymous_type_20002849f0f6538d_0#dmap.; /* palette */ |
| 85 | double color_scalarcxx . . $ $anonymous_type_20002849f0f6538d_0#color_scalar.; /* <1.0 if non-uniform motion blur is set */ |
| 86 | void *bucketscxx . . $ $anonymous_type_20002849f0f6538d_0#buckets.; /* Points to the first accumulator */ |
| 87 | double badvalscxx . . $ $anonymous_type_20002849f0f6538d_0#badvals.; /* accumulates all badvalue resets */ |
| 88 | double batch_sizecxx . . $ $anonymous_type_20002849f0f6538d_0#batch_size.; |
| 89 | int temporal_sample_numcxx . . $ $anonymous_type_20002849f0f6538d_0#temporal_sample_num.,ntemporal_samplescxx . . $ $anonymous_type_20002849f0f6538d_0#ntemporal_samples.; |
| 90 | int batch_numcxx . . $ $anonymous_type_20002849f0f6538d_0#batch_num., nbatchescxx . . $ $anonymous_type_20002849f0f6538d_0#nbatches., abortedcxx . . $ $anonymous_type_20002849f0f6538d_0#aborted., cmap_sizecxx . . $ $anonymous_type_20002849f0f6538d_0#cmap_size.; |
| 91 | time_tcxx . . $ time_t# *progress_timercxx . . $ $anonymous_type_20002849f0f6538d_0#progress_timer.; |
| 92 | time_tcxx . . $ time_t# *progress_timer_historycxx . . $ $anonymous_type_20002849f0f6538d_0#progress_timer_history.; |
| 93 | double *progress_historycxx . . $ $anonymous_type_20002849f0f6538d_0#progress_history.; |
| 94 | int *progress_history_markcxx . . $ $anonymous_type_20002849f0f6538d_0#progress_history_mark.; |
| 95 | #ifdef HAVE_LIBPTHREADcxx . . $ `./config.h:23:9`! |
| 96 | /* mutex for bucket accumulator */ |
| 97 | pthread_mutex_tcxx . . $ pthread_mutex_t# bucket_mutexcxx . . $ $anonymous_type_20002849f0f6538d_0#bucket_mutex.; |
| 98 | #endif |
| 99 | |
| 100 | } flam3_iter_constantscxx . . $ flam3_iter_constants#; |
| 101 | |
| 102 | typedef structcxx . . $ $anonymous_type_20002849f0f6538d_1# { |
| 103 | |
| 104 | double txcxx . . $ $anonymous_type_20002849f0f6538d_1#tx.,tycxx . . $ $anonymous_type_20002849f0f6538d_1#ty.; /* Starting coordinates */ |
| 105 | |
| 106 | double precalc_atancxx . . $ $anonymous_type_20002849f0f6538d_1#precalc_atan., precalc_sinacxx . . $ $anonymous_type_20002849f0f6538d_1#precalc_sina.; /* Precalculated, if needed */ |
| 107 | double precalc_cosacxx . . $ $anonymous_type_20002849f0f6538d_1#precalc_cosa., precalc_sqrtcxx . . $ $anonymous_type_20002849f0f6538d_1#precalc_sqrt.; |
| 108 | double precalc_sumsqcxx . . $ $anonymous_type_20002849f0f6538d_1#precalc_sumsq.,precalc_atanyxcxx . . $ $anonymous_type_20002849f0f6538d_1#precalc_atanyx.; |
| 109 | |
| 110 | flam3_xformcxx . . $ flam3_xform# *xformcxx . . $ $anonymous_type_20002849f0f6538d_1#xform.; /* For the important values */ |
| 111 | |
| 112 | /* Output Coords */ |
| 113 | |
| 114 | double p0cxx . . $ $anonymous_type_20002849f0f6538d_1#p0., p1cxx . . $ $anonymous_type_20002849f0f6538d_1#p1.; |
| 115 | |
| 116 | /* Pointer to the isaac RNG state */ |
| 117 | randctxcxx . . $ randctx# *rccxx . . $ $anonymous_type_20002849f0f6538d_1#rc.; |
| 118 | |
| 119 | } flam3_iter_helpercxx . . $ flam3_iter_helper#; |
| 120 | |
| 121 | typedef structcxx . . $ $anonymous_type_20002849f0f6538d_2# { |
| 122 | double *iter_storagecxx . . $ $anonymous_type_20002849f0f6538d_2#iter_storage.; /* Storage for iteration coordinates */ |
| 123 | randctxcxx . . $ randctx# rccxx . . $ $anonymous_type_20002849f0f6538d_2#rc.; /* Thread-unique ISAAC seed */ |
| 124 | flam3_genomecxx . . $ flam3_genome# cpcxx . . $ $anonymous_type_20002849f0f6538d_2#cp.; /* Full copy of genome for use by the thread */ |
| 125 | int first_threadcxx . . $ $anonymous_type_20002849f0f6538d_2#first_thread.; |
| 126 | int timer_initializecxx . . $ $anonymous_type_20002849f0f6538d_2#timer_initialize.; |
| 127 | flam3_iter_constantscxx . . $ flam3_iter_constants# *ficcxx . . $ $anonymous_type_20002849f0f6538d_2#fic.; /* Constants for render */ |
| 128 | } flam3_thread_helpercxx . . $ flam3_thread_helper#; |
| 129 | |
| 130 | double flam3_sinccxx . . $ flam3_sinc(447c67c6676f75c3).(double x); |
| 131 | |
| 132 | #define flam3_num_spatialfilterscxx . . $ `private.h:132:9`! 14 |
| 133 | double flam3_gaussian_filtercxx . . $ flam3_gaussian_filter(447c67c6676f75c3).(double x); |
| 134 | double flam3_hermite_filtercxx . . $ flam3_hermite_filter(447c67c6676f75c3).(double t); |
| 135 | double flam3_box_filtercxx . . $ flam3_box_filter(447c67c6676f75c3).(double t); |
| 136 | double flam3_triangle_filtercxx . . $ flam3_triangle_filter(447c67c6676f75c3).(double t); |
| 137 | double flam3_bell_filtercxx . . $ flam3_bell_filter(447c67c6676f75c3).(double t); |
| 138 | double flam3_b_spline_filtercxx . . $ flam3_b_spline_filter(447c67c6676f75c3).(double t); |
| 139 | double flam3_lanczos3_filtercxx . . $ flam3_lanczos3_filter(447c67c6676f75c3).(double t); |
| 140 | double flam3_lanczos2_filtercxx . . $ flam3_lanczos2_filter(447c67c6676f75c3).(double t); |
| 141 | double flam3_mitchell_filtercxx . . $ flam3_mitchell_filter(447c67c6676f75c3).(double t); |
| 142 | double flam3_blackman_filtercxx . . $ flam3_blackman_filter(447c67c6676f75c3).(double x); |
| 143 | double flam3_catrom_filtercxx . . $ flam3_catrom_filter(447c67c6676f75c3).(double x); |
| 144 | double flam3_hamming_filtercxx . . $ flam3_hamming_filter(447c67c6676f75c3).(double x); |
| 145 | double flam3_hanning_filtercxx . . $ flam3_hanning_filter(447c67c6676f75c3).(double x); |
| 146 | double flam3_quadratic_filtercxx . . $ flam3_quadratic_filter(447c67c6676f75c3).(double x); |
| 147 | |
| 148 | double flam3_spatial_filtercxx . . $ flam3_spatial_filter(538a8530131fd110).(int knum, double x); |
| 149 | |
| 150 | #define flam3_mitchell_bcxx . . $ `private.h:150:10`! (1.0 / 3.0) |
| 151 | #define flam3_mitchell_ccxx . . $ `private.h:151:10`! (1.0 / 3.0) |
| 152 | |
| 153 | |
| 154 | #endif |