diff options
| author | Erik Reckase <e.reckase@gmail.com> | 2011-01-02 23:45:52 +0000 | 
|---|---|---|
| committer | Scott Draves <spot@draves.org> | 2015-02-15 12:20:14 -0500 | 
| commit | 6be5e2e3f2117c4284d9b062a36700f3cf088f79 (patch) | |
| tree | c6ed40a7f94efbe4e34734b130eb860ec91f7e63 /src | |
| parent | 0053026871a3def94980593ca56364ee6a7c0f71 (diff) | |
| download | pucket-6be5e2e3f2117c4284d9b062a36700f3cf088f79.tar.gz pucket-6be5e2e3f2117c4284d9b062a36700f3cf088f79.tar.bz2 pucket-6be5e2e3f2117c4284d9b062a36700f3cf088f79.zip | |
apophysis only uses the bottom 255 elements of the palette (instead of all 256).  In many cases this does not have a noticable effect on images, but in others, the color difference is very striking.  the env var 'apo_palette' may be set to 1 in order to render the image in flam3 as it would appear in apophysis.
git-svn-id: https://flam3.googlecode.com/svn/trunk@152 77852712-ef1d-11de-8684-7d64432d61a3
Diffstat (limited to 'src')
| -rw-r--r-- | src/README.txt | 3 | ||||
| -rw-r--r-- | src/docstring.c | 2 | ||||
| -rw-r--r-- | src/private.h | 2 | ||||
| -rw-r--r-- | src/rect.c | 26 | 
4 files changed, 20 insertions, 13 deletions
| diff --git a/src/README.txt b/src/README.txt index a1128f6..aaf0f63 100644 --- a/src/README.txt +++ b/src/README.txt @@ -106,14 +106,13 @@ insert_palette  unset           insert the palette into the image.  enable_jpeg_comments  1         enables comments in the jpeg header (render and animate)  enable_png_comments   1         enables comments in the png header (render and animate) -New in 2.8: -  earlyclip       0               enables the early clipping of rgb values for better antialiasing and resizing                                  defaults to 0 for backwards compatibility  flam27          0               flam3 2.7 compatibility mode; ensures generated genomes can be used by flam3 2.7.18  stagger         0               affects simultaneity of xform interpolation during genome interpolation.                                  represents how 'separate' the xforms are interpolated.  set to 1 for each                                  xform to be interpolated individually, fractions control interp overlap. +apo_palette     0               set this to 1 to use only the first 255 elements of the palette (apophysis compatibility)  for example: diff --git a/src/docstring.c b/src/docstring.c index 0cb4b6f..7e6357d 100644 --- a/src/docstring.c +++ b/src/docstring.c @@ -103,13 +103,13 @@ static char *the_docstring1 =  "enable_jpeg_comments   1    enables comments in the jpeg header (render and animate)\n"  "enable_png_comments    1    enables comments in the png header (render and animate)\n"  "\n" -"New in 2.8:\n"  "earlyclip       0               enables the early clipping of rgb values for better antialiasing and resizing\n"  "                                defaults to 0 for backwards compatibility\n"  "flam27          0               flam3 2.7 compatibility mode; ensures generated genomes can be used by flam3 2.7.18\n"  "stagger         0               affects simultaneity of xform interpolation during genome interpolation.\n"  "                                represents how 'separate' the xforms are interpolated.  set to 1 for each\n"  "                                xform to be interpolated individually, fractions control interp overlap.\n" +"apo_palette     0               set this to 1 to use only the first 255 elements of the palette (apophysis compatibility)\n"  "\n"  "for example:\n" diff --git a/src/private.h b/src/private.h index 156b0d2..9800f82 100644 --- a/src/private.h +++ b/src/private.h @@ -87,7 +87,7 @@ typedef struct {     double badvals; /* accumulates all badvalue resets */     double batch_size;     int temporal_sample_num,ntemporal_samples; -   int batch_num, nbatches, aborted; +   int batch_num, nbatches, aborted, cmap_size;     time_t *progress_timer;     time_t *progress_timer_history;     double *progress_history; @@ -258,6 +258,8 @@ static void iter_thread(void *fth) {     struct timespec pauset;     int SBS = ficp->spec->sub_batch_size;     int fuse; +   int cmap_size = ficp->cmap_size; +   int cmap_size_m1 = ficp->cmap_size-1;     double eta = 0.0; @@ -443,7 +445,7 @@ static void iter_thread(void *fth) {              //fprintf(stdout,"%.16f\n",p[2]*256.0); -            while(color_index0 < CMAP_SIZE_M1) { +            while(color_index0 < cmap_size_m1) {              	if (ficp->dmap[color_index0+1].index > p[2])              	   break;              	else @@ -463,15 +465,15 @@ static void iter_thread(void *fth) {                 bump_no_overflow(b[0][3], logvis*ficp->dmap[color_index0].color[3]);                 bump_no_overflow(b[0][4], logvis*255.0);  #else -            dbl_index0 = p[2] * CMAP_SIZE; +            dbl_index0 = p[2] * cmap_size;              color_index0 = (int) (dbl_index0);              if (flam3_palette_mode_linear == fthp->cp.palette_mode) {                 if (color_index0 < 0) {                    color_index0 = 0;                    dbl_frac = 0; -               } else if (color_index0 >= CMAP_SIZE_M1) { -                  color_index0 = CMAP_SIZE_M1-1; +               } else if (color_index0 >= cmap_size_m1) { +                  color_index0 = cmap_size_m1-1;                    dbl_frac = 1.0;                 } else {                    /* interpolate between color_index0 and color_index0+1 */ @@ -487,8 +489,8 @@ static void iter_thread(void *fth) {                 if (color_index0 < 0) {                    color_index0 = 0; -               } else if (color_index0 >= CMAP_SIZE_M1) { -                  color_index0 = CMAP_SIZE_M1; +               } else if (color_index0 >= cmap_size_m1) { +                  color_index0 = cmap_size_m1;                 }                 for (ci=0;ci<4;ci++) @@ -563,6 +565,8 @@ static int render_rectangle(flam3_frame *spec, void *out,     int thi;     time_t tstart,tend;        double sumfilt; +   char *ai; +   int cmap_size;     char *last_block;     size_t memory_rqd; @@ -580,6 +584,9 @@ static int render_rectangle(flam3_frame *spec, void *out,     stats->num_iters = 0; +   /* correct for apophysis's use of 255 colors in the palette rather than all 256 */ +   cmap_size = 256 - argi("apo_palette",0); +     memset(&cp,0, sizeof(flam3_genome));     /* interpolate and get a control point                      */ @@ -769,10 +776,10 @@ static int render_rectangle(flam3_frame *spec, void *out,           /* compute the colormap entries.                             */           /* the input colormap is 256 long with entries from 0 to 1.0 */ -         for (j = 0; j < CMAP_SIZE; j++) { -            dmap[j].index = cp.palette[(j * 256) / CMAP_SIZE].index / 256.0; +         for (j = 0; j < cmap_size; j++) { +            dmap[j].index = cp.palette[(j * 256) / cmap_size].index / 256.0;              for (k = 0; k < 4; k++) -               dmap[j].color[k] = (cp.palette[(j * 256) / CMAP_SIZE].color[k] * WHITE_LEVEL) * color_scalar; +               dmap[j].color[k] = (cp.palette[(j * 256) / cmap_size].color[k] * WHITE_LEVEL) * color_scalar;           }           /* compute camera */ @@ -836,6 +843,7 @@ static int render_rectangle(flam3_frame *spec, void *out,           fic.ntemporal_samples = ntemporal_samples;           fic.batch_num = batch_num;           fic.nbatches = nbatches; +         fic.cmap_size = cmap_size;           fic.dmap = (flam3_palette_entry *)dmap;           fic.color_scalar = color_scalar; | 
