summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2015-02-28 15:07:18 +0100
committerLars-Dominik Braun <lars@6xq.net>2015-05-02 21:36:45 +0200
commit3214c51acb3346815ccd5e33f4114f232879e1a8 (patch)
treef68e21ac422e3442b98b507f436561a3ea8c99aa
parent02e5b6af7df001cc105e874ade35b47d560b1f83 (diff)
downloadpucket-3214c51acb3346815ccd5e33f4114f232879e1a8.tar.gz
pucket-3214c51acb3346815ccd5e33f4114f232879e1a8.tar.bz2
pucket-3214c51acb3346815ccd5e33f4114f232879e1a8.zip
Drop temporal filter/passes
-rw-r--r--filters.c301
-rw-r--r--filters.h33
-rw-r--r--flam3.c79
-rw-r--r--flam3.h39
-rw-r--r--interpolation.c7
-rw-r--r--main.c2
-rw-r--r--palettes.c5
-rw-r--r--parser.c52
-rw-r--r--private.h21
-rw-r--r--rect.c96
-rw-r--r--wscript2
11 files changed, 18 insertions, 619 deletions
diff --git a/filters.c b/filters.c
deleted file mode 100644
index 29ecb22..0000000
--- a/filters.c
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- FLAM3 - cosmic recursive fractal flames
- Copyright (C) 1992-2009 Spotworks LLC
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include <math.h>
-#include <assert.h>
-
-#include "filters.h"
-
-
-/*
- * filter function definitions
- * from Graphics Gems III code
- * and ImageMagick resize.c
- */
-
-
-double flam3_spatial_support[flam3_num_spatialfilters] = {
-
- 1.5, /* gaussian */
- 1.0, /* hermite */
- 0.5, /* box */
- 1.0, /* triangle */
- 1.5, /* bell */
- 2.0, /* b spline */
- 2.0, /* mitchell */
- 1.0, /* blackman */
- 2.0, /* catrom */
- 1.0, /* hanning */
- 1.0, /* hamming */
- 3.0, /* lanczos3 */
- 2.0, /* lanczos2 */
- 1.5 /* quadratic */
-};
-
-double flam3_hermite_filter(double t) {
- /* f(t) = 2|t|^3 - 3|t|^2 + 1, -1 <= t <= 1 */
- if(t < 0.0) t = -t;
- if(t < 1.0) return((2.0 * t - 3.0) * t * t + 1.0);
- return(0.0);
-}
-
-double flam3_box_filter(double t) {
- if((t > -0.5) && (t <= 0.5)) return(1.0);
- return(0.0);
-}
-
-double flam3_triangle_filter(double t) {
- if(t < 0.0) t = -t;
- if(t < 1.0) return(1.0 - t);
- return(0.0);
-}
-
-double flam3_bell_filter(double t) {
- /* box (*) box (*) box */
- if(t < 0) t = -t;
- if(t < .5) return(.75 - (t * t));
- if(t < 1.5) {
- t = (t - 1.5);
- return(.5 * (t * t));
- }
- return(0.0);
-}
-
-double flam3_b_spline_filter(double t) {
-
- /* box (*) box (*) box (*) box */
- double tt;
-
- if(t < 0) t = -t;
- if(t < 1) {
- tt = t * t;
- return((.5 * tt * t) - tt + (2.0 / 3.0));
- } else if(t < 2) {
- t = 2 - t;
- return((1.0 / 6.0) * (t * t * t));
- }
- return(0.0);
-}
-
-double flam3_sinc(double x) {
- x *= M_PI;
- if(x != 0) return(sin(x) / x);
- return(1.0);
-}
-
-double flam3_blackman_filter(double x) {
- return(0.42+0.5*cos(M_PI*x)+0.08*cos(2*M_PI*x));
-}
-
-double flam3_catrom_filter(double x) {
- if (x < -2.0)
- return(0.0);
- if (x < -1.0)
- return(0.5*(4.0+x*(8.0+x*(5.0+x))));
- if (x < 0.0)
- return(0.5*(2.0+x*x*(-5.0-3.0*x)));
- if (x < 1.0)
- return(0.5*(2.0+x*x*(-5.0+3.0*x)));
- if (x < 2.0)
- return(0.5*(4.0+x*(-8.0+x*(5.0-x))));
- return(0.0);
-}
-
-double flam3_mitchell_filter(double t) {
- double tt;
-
- tt = t * t;
- if(t < 0) t = -t;
- if(t < 1.0) {
- t = (((12.0 - 9.0 * flam3_mitchell_b - 6.0 * flam3_mitchell_c) * (t * tt))
- + ((-18.0 + 12.0 * flam3_mitchell_b + 6.0 * flam3_mitchell_c) * tt)
- + (6.0 - 2 * flam3_mitchell_b));
- return(t / 6.0);
- } else if(t < 2.0) {
- t = (((-1.0 * flam3_mitchell_b - 6.0 * flam3_mitchell_c) * (t * tt))
- + ((6.0 * flam3_mitchell_b + 30.0 * flam3_mitchell_c) * tt)
- + ((-12.0 * flam3_mitchell_b - 48.0 * flam3_mitchell_c) * t)
- + (8.0 * flam3_mitchell_b + 24 * flam3_mitchell_c));
- return(t / 6.0);
- }
- return(0.0);
-}
-
-double flam3_hanning_filter(double x) {
- return(0.5+0.5*cos(M_PI*x));
-}
-
-double flam3_hamming_filter(double x) {
- return(0.54+0.46*cos(M_PI*x));
-}
-
-double flam3_lanczos3_filter(double t) {
- if(t < 0) t = -t;
- if(t < 3.0) return(flam3_sinc(t) * flam3_sinc(t/3.0));
- return(0.0);
-}
-
-double flam3_lanczos2_filter(double t) {
- if(t < 0) t = -t;
- if(t < 2.0) return(flam3_sinc(t) * flam3_sinc(t/2.0));
- return(0.0);
-}
-
-double flam3_gaussian_filter(double x) {
- return(exp((-2.0*x*x))*sqrt(2.0/M_PI));
-}
-
-double flam3_quadratic_filter(double x) {
- if (x < -1.5)
- return(0.0);
- if (x < -0.5)
- return(0.5*(x+1.5)*(x+1.5));
- if (x < 0.5)
- return(0.75-x*x);
- if (x < 1.5)
- return(0.5*(x-1.5)*(x-1.5));
- return(0.0);
-}
-
-double flam3_spatial_filter(int knum, double x) {
-
- if (knum==0)
- return flam3_gaussian_filter(x);
- else if (knum==1)
- return flam3_hermite_filter(x);
- else if (knum==2)
- return flam3_box_filter(x);
- else if (knum==3)
- return flam3_triangle_filter(x);
- else if (knum==4)
- return flam3_bell_filter(x);
- else if (knum==5)
- return flam3_b_spline_filter(x);
- else if (knum==6)
- return flam3_mitchell_filter(x);
- else if (knum==7)
- return flam3_sinc(x)*flam3_blackman_filter(x);
- else if (knum==8)
- return flam3_catrom_filter(x);
- else if (knum==9)
- return flam3_sinc(x)*flam3_hanning_filter(x);
- else if (knum==10)
- return flam3_sinc(x)*flam3_hamming_filter(x);
- else if (knum==11)
- return flam3_lanczos3_filter(x)*flam3_sinc(x/3.0);
- else if (knum==12)
- return flam3_lanczos2_filter(x)*flam3_sinc(x/2.0);
- else if (knum==13)
- return flam3_quadratic_filter(x);
- assert (0);
-}
-
-int normalize_vector(double *v, int n) {
- double t = 0.0;
- int i;
- for (i = 0; i < n; i++)
- t += v[i];
- if (0.0 == t) return 1;
- t = 1.0 / t;
- for (i = 0; i < n; i++)
- v[i] *= t;
- return 0;
-}
-
-double flam3_create_temporal_filter(int numsteps, int filter_type, double filter_exp, double filter_width,
- double **temporal_filter, double **temporal_deltas) {
-
- double maxfilt = 0.0;
- double sumfilt = 0.0;
- double slpx,halfsteps;
- double *deltas, *filter;
-
- int i;
-
- /* Allocate memory - this must be freed in the calling routine! */
- deltas = (double *)malloc(numsteps*sizeof(double));
- filter = (double *)malloc(numsteps*sizeof(double));
-
- /* Deal with only one step */
- if (numsteps==1) {
- deltas[0] = 0;
- filter[0] = 1.0;
- *temporal_deltas = deltas;
- *temporal_filter = filter;
- return(1.0);
- }
-
- /* Define the temporal deltas */
- for (i = 0; i < numsteps; i++)
- deltas[i] = ((double)i /(double)(numsteps - 1) - 0.5)*filter_width;
-
- /* Define the filter coefs */
- if (flam3_temporal_exp == filter_type) {
-
- for (i=0; i < numsteps; i++) {
-
- if (filter_exp>=0)
- slpx = ((double)i+1.0)/numsteps;
- else
- slpx = (double)(numsteps - i)/numsteps;
-
- /* Scale the color based on these values */
- filter[i] = pow(slpx,fabs(filter_exp));
-
- /* Keep the max */
- if (filter[i]>maxfilt)
- maxfilt = filter[i];
- }
-
- } else if (flam3_temporal_gaussian == filter_type) {
-
- halfsteps = numsteps/2.0;
- for (i=0; i < numsteps; i++) {
-
- /* Gaussian */
- filter[i] = flam3_spatial_filter(flam3_gaussian_kernel,
- flam3_spatial_support[flam3_gaussian_kernel]*fabs(i - halfsteps)/halfsteps);
- /* Keep the max */
- if (filter[i]>maxfilt)
- maxfilt = filter[i];
- }
-
- } else { // (flam3_temporal_box)
-
- for (i=0; i < numsteps; i++)
- filter[i] = 1.0;
-
- maxfilt = 1.0;
-
- }
-
- /* Adjust the filter so that the max is 1.0, and */
- /* calculate the K2 scaling factor */
- for (i=0;i<numsteps;i++) {
- filter[i] /= maxfilt;
- sumfilt += filter[i];
- }
-
- sumfilt /= numsteps;
-
- *temporal_deltas = deltas;
- *temporal_filter = filter;
-
- return(sumfilt);
-}
-
diff --git a/filters.h b/filters.h
deleted file mode 100644
index 1f7ac16..0000000
--- a/filters.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- FLAM3 - cosmic recursive fractal flames
- Copyright (C) 1992-2009 Spotworks LLC
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef filters_included
-#define filters_included
-
-#include "private.h"
-
-extern double flam3_spatial_support[flam3_num_spatialfilters];
-
-double flam3_spatial_filter(int knum, double x);
-int flam3_create_spatial_filter(flam3_frame *spec, int field, double **filter);
-double flam3_create_temporal_filter(int numsteps, int filter_type, double filter_exp, double filter_width,
- double **temporal_filter, double **temporal_deltas);
-
-#endif
-
-
diff --git a/flam3.c b/flam3.c
index 8adceeb..74a4cc7 100644
--- a/flam3.c
+++ b/flam3.c
@@ -23,7 +23,6 @@
#include "variations.h"
#include "interpolation.h"
#include "parser.h"
-#include "filters.h"
#include "palettes.h"
#include "random.h"
#include <limits.h>
@@ -1061,18 +1060,11 @@ void clear_cp(flam3_genome *cp, int default_flag) {
cp->background[2] = 0.0;
cp->width = 100;
cp->height = 100;
- cp->spatial_filter_radius = 0.5;
cp->zoom = 0.0;
cp->sample_density = 1;
cp->gam_lin_thresh = 0.01;
// cp->motion_exp = 0.0;
- cp->nbatches = 1;
- cp->ntemporal_samples = 1000;
- cp->spatial_filter_select = flam3_gaussian_kernel;
cp->interpolation_type = flam3_inttype_log;
- cp->temporal_filter_type = flam3_temporal_box;
- cp->temporal_filter_width = 1.0;
- cp->temporal_filter_exp = 0.0;
cp->palette_mode = PALETTE_MODE_STEP;
} else {
@@ -1082,21 +1074,12 @@ void clear_cp(flam3_genome *cp, int default_flag) {
cp->background[1] = -1.0;
cp->background[2] = -1.0;
cp->zoom = 999999999;
- cp->spatial_filter_radius = -1;
- cp->nbatches = -1;
- cp->ntemporal_samples = -1;
cp->width = -1;
cp->height = -1;
cp->sample_density = -1;
cp->gam_lin_thresh = -1;
// cp->motion_exp = -999;
- cp->nbatches = 0;
- cp->ntemporal_samples = 0;
- cp->spatial_filter_select = -1;
cp->interpolation_type = -1;
- cp->temporal_filter_type = -1;
- cp->temporal_filter_width = -1;
- cp->temporal_filter_exp = -999;
cp->palette_mode = -1;
}
@@ -1302,14 +1285,8 @@ void flam3_apply_template(flam3_genome *cp, flam3_genome *templ) {
cp->background[2] = templ->background[2];
if (templ->zoom < 999999998)
cp->zoom = templ->zoom;
- if (templ->spatial_filter_radius >= 0)
- cp->spatial_filter_radius = templ->spatial_filter_radius;
if (templ->sample_density > 0)
cp->sample_density = templ->sample_density;
- if (templ->nbatches > 0)
- cp->nbatches = templ->nbatches;
- if (templ->ntemporal_samples > 0)
- cp->ntemporal_samples = templ->ntemporal_samples;
if (templ->width > 0) {
/* preserving scale should be an option */
cp->pixels_per_unit = cp->pixels_per_unit * templ->width / cp->width;
@@ -1319,22 +1296,10 @@ void flam3_apply_template(flam3_genome *cp, flam3_genome *templ) {
cp->height = templ->height;
if (templ->gam_lin_thresh >= 0)
cp->gam_lin_thresh = templ->gam_lin_thresh;
- if (templ->nbatches>0)
- cp->nbatches = templ->nbatches;
- if (templ->ntemporal_samples>0)
- cp->ntemporal_samples = templ->ntemporal_samples;
- if (templ->spatial_filter_select>0)
- cp->spatial_filter_select = templ->spatial_filter_select;
if (templ->interpolation >= 0)
cp->interpolation = templ->interpolation;
if (templ->interpolation_type >= 0)
cp->interpolation_type = templ->interpolation_type;
- if (templ->temporal_filter_type >= 0)
- cp->temporal_filter_type = templ->temporal_filter_type;
- if (templ->temporal_filter_width > 0)
- cp->temporal_filter_width = templ->temporal_filter_width;
- if (templ->temporal_filter_exp > -900)
- cp->temporal_filter_exp = templ->temporal_filter_exp;
if (templ->highlight_power >=0)
cp->highlight_power = templ->highlight_power;
if (templ->palette_mode >= 0)
@@ -1406,52 +1371,8 @@ void flam3_print(FILE *f, flam3_genome *cp, char *extra_attributes, int print_ed
fprintf(f, " zoom=\"%g\"", cp->zoom);
fprintf(f, " rotate=\"%g\"", cp->rotate);
- fprintf(f, " filter=\"%g\"", cp->spatial_filter_radius);
-
- /* Need to print the correct kernel to use */
- if (cp->spatial_filter_select == flam3_gaussian_kernel)
- fprintf(f, " filter_shape=\"gaussian\"");
- else if (cp->spatial_filter_select == flam3_hermite_kernel)
- fprintf(f, " filter_shape=\"hermite\"");
- else if (cp->spatial_filter_select == flam3_box_kernel)
- fprintf(f, " filter_shape=\"box\"");
- else if (cp->spatial_filter_select == flam3_triangle_kernel)
- fprintf(f, " filter_shape=\"triangle\"");
- else if (cp->spatial_filter_select == flam3_bell_kernel)
- fprintf(f, " filter_shape=\"bell\"");
- else if (cp->spatial_filter_select == flam3_b_spline_kernel)
- fprintf(f, " filter_shape=\"bspline\"");
- else if (cp->spatial_filter_select == flam3_mitchell_kernel)
- fprintf(f, " filter_shape=\"mitchell\"");
- else if (cp->spatial_filter_select == flam3_blackman_kernel)
- fprintf(f, " filter_shape=\"blackman\"");
- else if (cp->spatial_filter_select == flam3_catrom_kernel)
- fprintf(f, " filter_shape=\"catrom\"");
- else if (cp->spatial_filter_select == flam3_hanning_kernel)
- fprintf(f, " filter_shape=\"hanning\"");
- else if (cp->spatial_filter_select == flam3_hamming_kernel)
- fprintf(f, " filter_shape=\"hamming\"");
- else if (cp->spatial_filter_select == flam3_lanczos3_kernel)
- fprintf(f, " filter_shape=\"lanczos3\"");
- else if (cp->spatial_filter_select == flam3_lanczos2_kernel)
- fprintf(f, " filter_shape=\"lanczos2\"");
- else if (cp->spatial_filter_select == flam3_quadratic_kernel)
- fprintf(f, " filter_shape=\"quadratic\"");
-
- if (cp->temporal_filter_type == flam3_temporal_box)
- fprintf(f, " temporal_filter_type=\"box\"");
- else if (cp->temporal_filter_type == flam3_temporal_gaussian)
- fprintf(f, " temporal_filter_type=\"gaussian\"");
- else if (cp->temporal_filter_type == flam3_temporal_exp)
- fprintf(f, " temporal_filter_type=\"exp\" temporal_filter_exp=\"%g\"",cp->temporal_filter_exp);
-
- fprintf(f, " temporal_filter_width=\"%g\"",cp->temporal_filter_width);
-
-
fprintf(f, " quality=\"%g\"", cp->sample_density);
- fprintf(f, " passes=\"%d\"", cp->nbatches);
- fprintf(f, " temporal_samples=\"%d\"", cp->ntemporal_samples);
fprintf(f, " background=\"%g %g %g\"",
cp->background[0], cp->background[1], cp->background[2]);
fprintf(f, " brightness=\"%g\"", cp->brightness);
diff --git a/flam3.h b/flam3.h
index 4611196..de082fd 100644
--- a/flam3.h
+++ b/flam3.h
@@ -477,19 +477,7 @@ typedef struct {
double background[3];
double zoom; /* effects ppu, sample density, scale */
double pixels_per_unit; /* vertically */
- double spatial_filter_radius; /* radius of spatial filter */
- int spatial_filter_select; /* selected spatial filter */
-// double (*spatial_filter_func)(double); /* spatial filter kernel function */
-// double spatial_filter_support; /* size of standard kernel for specific function */
double sample_density; /* samples per pixel (not bucket) */
- /* in order to motion blur more accurately we compute the logs of the
- sample density many times and average the results. */
- /* nbatches is the number of times the buckets are filtered into
- the abucket log accumulator */
- /* ntemporal_samples is the number of time steps per batch. this many
- interpolated control points are used per batch and accumulated */
- int nbatches;
- int ntemporal_samples;
/* XML Edit structure */
xmlDocPtr edits;
@@ -504,9 +492,6 @@ typedef struct {
double hue_rotation1;
double palette_blend;
- int temporal_filter_type; /* Temporal filters */
- double temporal_filter_width, temporal_filter_exp;
-
int palette_mode;
@@ -583,7 +568,6 @@ void flam3_apply_template(flam3_genome *cp, flam3_genome *templ);
int flam3_count_nthreads(void);
typedef struct {
-// double temporal_filter_radius;
double pixel_aspect_ratio; /* width over height of each pixel */
flam3_genome *genomes;
int ngenomes;
@@ -635,27 +619,4 @@ flam3_genome *sheep_edge(flam3_genome *cp, double blend, int seqflag, double sta
#define CROSS_INTERPOLATE 1
#define CROSS_ALTERNATE 2
-/* Filters */
-/* Spatial filter kernels */
-#define flam3_gaussian_kernel 0
-#define flam3_hermite_kernel 1
-#define flam3_box_kernel 2
-#define flam3_triangle_kernel 3
-#define flam3_bell_kernel 4
-#define flam3_b_spline_kernel 5
-#define flam3_lanczos3_kernel 6
-#define flam3_lanczos2_kernel 7
-#define flam3_mitchell_kernel 8
-#define flam3_blackman_kernel 9
-#define flam3_catrom_kernel 10
-#define flam3_hamming_kernel 11
-#define flam3_hanning_kernel 12
-#define flam3_quadratic_kernel 13
-
-/* Temporal filters */
-#define flam3_temporal_box 0
-#define flam3_temporal_gaussian 1
-#define flam3_temporal_exp 2
-
-
#endif
diff --git a/interpolation.c b/interpolation.c
index 8a5c87b..279e1a2 100644
--- a/interpolation.c
+++ b/interpolation.c
@@ -411,8 +411,6 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
result->palette_index = flam3_palette_random;
result->symmetry = 0;
- result->spatial_filter_select = cpi[0].spatial_filter_select;
- result->temporal_filter_type = cpi[0].temporal_filter_type;
result->palette_mode = cpi[0].palette_mode;
result->interpolation_type = cpi[0].interpolation_type;
@@ -432,14 +430,9 @@ void flam3_interpolate_n(flam3_genome *result, int ncp,
INTERP(background[1]);
INTERP(background[2]);
INTERP(pixels_per_unit);
- INTERP(spatial_filter_radius);
- INTERP(temporal_filter_exp);
- INTERP(temporal_filter_width);
INTERP(sample_density);
INTERP(zoom);
INTERP(rotate);
- INTERI(nbatches);
- INTERI(ntemporal_samples);
INTERP(gam_lin_thresh);
/* Interpolate the chaos array */
diff --git a/main.c b/main.c
index 4c18336..7a24e82 100644
--- a/main.c
+++ b/main.c
@@ -110,8 +110,6 @@ static void do_render (const render_arguments * const arguments) {
flam3_genome * const genome = &cps[0];
- /* Force ntemporal_samples to 1 for -render */
- genome->ntemporal_samples = 1;
genome->sample_density = arguments->quality;
genome->height *= arguments->scale;
genome->width *= arguments->scale;
diff --git a/palettes.c b/palettes.c
index 1f891f0..6154054 100644
--- a/palettes.c
+++ b/palettes.c
@@ -370,10 +370,7 @@ static double try_colors(flam3_genome *g, int color_resolution) {
// g->width = 100; // XXX keep aspect ratio
// g->height = 100;
// g->pixels_per_unit = 50;
- g->nbatches = 1;
- g->ntemporal_samples = 1;
-// f.temporal_filter_radius = 0.0;
f.bytes_per_channel=1;
f.verbose = 0;
f.genomes = g;
@@ -424,8 +421,6 @@ static double try_colors(flam3_genome *g, int color_resolution) {
g->width = saved.width;
g->height = saved.height;
g->pixels_per_unit = saved.pixels_per_unit;
- g->nbatches = saved.nbatches;
- g->ntemporal_samples = saved.ntemporal_samples;
/* Free xform storage */
clear_cp(&saved,flam3_defaults_on);
diff --git a/parser.c b/parser.c
index 06ce22c..b61d732 100644
--- a/parser.c
+++ b/parser.c
@@ -18,7 +18,6 @@
#include "parser.h"
#include "interpolation.h"
-#include "filters.h"
#include <errno.h>
static int flam3_conversion_failed;
@@ -389,53 +388,6 @@ int parse_flame_element(xmlNode *flame_node, flam3_genome *loc_current_cp,
cp->rotate = flam3_atof(att_str);
} else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"zoom")) {
cp->zoom = flam3_atof(att_str);
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"filter")) {
- cp->spatial_filter_radius = flam3_atof(att_str);
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"filter_shape")) {
- if (!strcmp("gaussian", att_str))
- cp->spatial_filter_select = flam3_gaussian_kernel;
- else if (!strcmp("hermite", att_str))
- cp->spatial_filter_select = flam3_hermite_kernel;
- else if (!strcmp("box", att_str))
- cp->spatial_filter_select = flam3_box_kernel;
- else if (!strcmp("triangle", att_str))
- cp->spatial_filter_select = flam3_triangle_kernel;
- else if (!strcmp("bell", att_str))
- cp->spatial_filter_select = flam3_bell_kernel;
- else if (!strcmp("bspline", att_str))
- cp->spatial_filter_select = flam3_b_spline_kernel;
- else if (!strcmp("mitchell", att_str))
- cp->spatial_filter_select = flam3_mitchell_kernel;
- else if (!strcmp("blackman", att_str))
- cp->spatial_filter_select = flam3_blackman_kernel;
- else if (!strcmp("catrom", att_str))
- cp->spatial_filter_select = flam3_catrom_kernel;
- else if (!strcmp("hanning", att_str))
- cp->spatial_filter_select = flam3_hanning_kernel;
- else if (!strcmp("hamming", att_str))
- cp->spatial_filter_select = flam3_hamming_kernel;
- else if (!strcmp("lanczos3", att_str))
- cp->spatial_filter_select = flam3_lanczos3_kernel;
- else if (!strcmp("lanczos2", att_str))
- cp->spatial_filter_select = flam3_lanczos2_kernel;
- else if (!strcmp("quadratic", att_str))
- cp->spatial_filter_select = flam3_quadratic_kernel;
- else
- fprintf(stderr, "warning: unrecognized kernel shape %s. Using gaussian.\n", att_str);
-
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"temporal_filter_type")) {
- if (!strcmp("box", att_str))
- cp->temporal_filter_type = flam3_temporal_box;
- else if (!strcmp("gaussian", att_str))
- cp->temporal_filter_type = flam3_temporal_gaussian;
- else if (!strcmp("exp",att_str))
- cp->temporal_filter_type = flam3_temporal_exp;
- else
- fprintf(stderr, "warning: unrecognized temporal filter %s. Using box.\n",att_str);
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"temporal_filter_width")) {
- cp->temporal_filter_width = flam3_atof(att_str);
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"temporal_filter_exp")) {
- cp->temporal_filter_exp = flam3_atof(att_str);
} else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"palette_mode")) {
if (!strcmp("step", att_str))
cp->palette_mode = PALETTE_MODE_STEP;
@@ -445,10 +397,6 @@ int parse_flame_element(xmlNode *flame_node, flam3_genome *loc_current_cp,
fprintf(stderr,"warning: unrecognized palette mode %s. Using step.\n",att_str);
} else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"quality")) {
cp->sample_density = flam3_atof(att_str);
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"passes")) {
- cp->nbatches = flam3_atoi(att_str);
- } else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"temporal_samples")) {
- cp->ntemporal_samples = flam3_atoi(att_str);
} else if (!xmlStrcmp(cur_att->name, (const xmlChar *)"background")) {
if (sscanf(att_str, "%lf %lf %lf%1s", &cp->background[0], &cp->background[1], &cp->background[2], tmps) != 3) {
fprintf(stderr,"error: invalid background attribute '%s'\n",att_str);
diff --git a/private.h b/private.h
index 9b3b7ce..e86c43f 100644
--- a/private.h
+++ b/private.h
@@ -57,8 +57,7 @@ typedef struct {
double4 *buckets; /* Points to the first accumulator */
double badvals; /* accumulates all badvalue resets */
double batch_size;
- int temporal_sample_num,ntemporal_samples;
- int batch_num, nbatches, aborted, cmap_size;
+ int aborted, cmap_size;
time_t *progress_timer;
time_t *progress_timer_history;
double *progress_history;
@@ -79,24 +78,6 @@ typedef struct {
double flam3_sinc(double x);
-#define flam3_num_spatialfilters 14
-double flam3_gaussian_filter(double x);
-double flam3_hermite_filter(double t);
-double flam3_box_filter(double t);
-double flam3_triangle_filter(double t);
-double flam3_bell_filter(double t);
-double flam3_b_spline_filter(double t);
-double flam3_lanczos3_filter(double t);
-double flam3_lanczos2_filter(double t);
-double flam3_mitchell_filter(double t);
-double flam3_blackman_filter(double x);
-double flam3_catrom_filter(double x);
-double flam3_hamming_filter(double x);
-double flam3_hanning_filter(double x);
-double flam3_quadratic_filter(double x);
-
-double flam3_spatial_filter(int knum, double x);
-
#define flam3_mitchell_b (1.0 / 3.0)
#define flam3_mitchell_c (1.0 / 3.0)
diff --git a/rect.c b/rect.c
index cb310a5..e6d02aa 100644
--- a/rect.c
+++ b/rect.c
@@ -20,24 +20,10 @@
#include <stdlib.h>
#include "private.h"
-#include "filters.h"
#include "variations.h"
#include "palettes.h"
#include "math.h"
-/*
- * for batch
- * generate de filters
- * for temporal_sample_batch
- * interpolate
- * compute colormap
- * for subbatch
- * compute samples
- * buckets += cmap[samples]
- * accum += time_filter[temporal_sample_batch] * log[buckets] * de_filter
- * image = filter(accum)
- */
-
/* allow this many iterations for settling into attractor */
#define FUSE_27 15
#define FUSE_28 100
@@ -119,8 +105,7 @@ static void *iter_thread(void *fth) {
if (fthp->first_thread && newt != *(ficp->progress_timer)) {
double percent = 100.0 *
- ((((sub_batch / (double) ficp->batch_size) + ficp->temporal_sample_num)
- / ficp->ntemporal_samples) + ficp->batch_num)/ficp->nbatches;
+ ((((sub_batch / (double) ficp->batch_size))));
int old_mark = 0;
int ticker;
@@ -162,8 +147,7 @@ static void *iter_thread(void *fth) {
/* Recalculate % done, as the other calculation only updates once per second */
double percent = 100.0 *
- ((((sub_batch / (double) ficp->batch_size) + ficp->temporal_sample_num)
- / ficp->ntemporal_samples) + ficp->batch_num)/ficp->nbatches;
+ (((sub_batch / (double) ficp->batch_size)));
rv = (*ficp->spec->progress)(ficp->spec->progress_parameter, percent, 0, eta);
@@ -302,16 +286,12 @@ static double4 clip (const double4 in, const double g, const double linrange,
int render_rectangle(flam3_frame *spec, void *out,
int field, stat_struct *stats) {
long nbuckets;
- int i, j, k, batch_num, temporal_sample_num;
- double nsamples, batch_size;
- double *temporal_filter, *temporal_deltas, *batch_filter;
+ int i, j, k;
double ppux=0, ppuy=0;
int image_width, image_height; /* size of the image to produce */
int out_width;
int bytes_per_channel = spec->bytes_per_channel;
double highpow;
- int nbatches;
- int ntemporal_samples;
flam3_palette dmap;
double vibrancy = 0.0;
double gamma = 0.0;
@@ -326,7 +306,6 @@ int render_rectangle(flam3_frame *spec, void *out,
pthread_t *myThreads=NULL;
int thi;
time_t tstart,tend;
- double sumfilt;
int cmap_size;
/* Per-render progress timers */
@@ -350,13 +329,6 @@ int render_rectangle(flam3_frame *spec, void *out,
/* interpolate and get a control point */
flam3_interpolate(spec->genomes, spec->ngenomes, spec->time, 0, &cp);
highpow = cp.highlight_power;
- nbatches = cp.nbatches;
- ntemporal_samples = cp.ntemporal_samples;
-
- if (nbatches < 1) {
- fprintf(stderr, "nbatches must be positive, not %d.\n", nbatches);
- return(1);
- }
/* Initialize the thread helper structures */
fth = (flam3_thread_helper *)calloc(spec->nthreads,sizeof(flam3_thread_helper));
@@ -377,21 +349,6 @@ int render_rectangle(flam3_frame *spec, void *out,
} else
image_height = cp.height;
-
- /* batch filter */
- /* may want to revisit this at some point */
- batch_filter = (double *) malloc(sizeof(double) * nbatches);
- for (i=0; i<nbatches; i++)
- batch_filter[i]=1.0/(double)nbatches;
-
- /* temporal filter - we must free temporal_filter and temporal_deltas at the end */
- sumfilt = flam3_create_temporal_filter(nbatches*ntemporal_samples,
- cp.temporal_filter_type,
- cp.temporal_filter_exp,
- cp.temporal_filter_width,
- &temporal_filter, &temporal_deltas);
-
-
/* Allocate the space required to render the image */
fic.height = image_height;
fic.width = image_width;
@@ -419,23 +376,13 @@ int render_rectangle(flam3_frame *spec, void *out,
/* Batch loop - outermost */
- for (batch_num = 0; batch_num < nbatches; batch_num++) {
+ {
double sample_density=0.0;
double k1, area, k2;
memset(buckets, 0, sizeof(*buckets) * nbuckets);
- /* Temporal sample loop */
- for (temporal_sample_num = 0; temporal_sample_num < ntemporal_samples; temporal_sample_num++) {
-
- double temporal_sample_time;
- double color_scalar = temporal_filter[batch_num*ntemporal_samples + temporal_sample_num];
-
- temporal_sample_time = spec->time +
- temporal_deltas[batch_num*ntemporal_samples + temporal_sample_num];
-
- /* Interpolate and get a control point */
- flam3_interpolate(spec->genomes, spec->ngenomes, temporal_sample_time, 0, &cp);
+ {
/* Get the xforms ready to render */
if (prepare_precalc_flags(&cp)) {
@@ -453,11 +400,11 @@ int render_rectangle(flam3_frame *spec, void *out,
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] * color_scalar;
+ dmap[j].color[k] = cp.palette[(j * 256) / CMAP_SIZE].color[k];
}
/* compute camera */
- if (1) {
+ {
double shift=0.0, corner0, corner1;
double scale;
@@ -498,10 +445,10 @@ int render_rectangle(flam3_frame *spec, void *out,
}
/* number of samples is based only on the output image size */
- nsamples = sample_density * image_width * image_height;
+ double nsamples = sample_density * image_width * image_height;
/* how many of these samples are rendered in this loop? */
- batch_size = nsamples / (nbatches * ntemporal_samples);
+ double batch_size = nsamples;
stats->num_iters += batch_size;
@@ -509,14 +456,9 @@ int render_rectangle(flam3_frame *spec, void *out,
fic.xform_distrib = xform_distrib;
fic.spec = spec;
fic.batch_size = batch_size / (double)spec->nthreads;
- fic.temporal_sample_num = temporal_sample_num;
- 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;
fic.buckets = (void *)buckets;
/* Need a timer per job */
@@ -532,10 +474,7 @@ int render_rectangle(flam3_frame *spec, void *out,
if (0==thi) {
fth[thi].first_thread=1;
- if (0==batch_num && 0==temporal_sample_num)
- fth[thi].timer_initialize = 1;
- else
- fth[thi].timer_initialize = 0;
+ fth[thi].timer_initialize = 1;
} else {
fth[thi].first_thread=0;
@@ -583,15 +522,15 @@ int render_rectangle(flam3_frame *spec, void *out,
}
/* XXX: the original formula has a factor 268/256 in here, not sure why */
- k1 = cp.contrast * cp.brightness * batch_filter[batch_num];
+ k1 = cp.contrast * cp.brightness;
area = image_width * image_height / (ppux * ppuy);
- k2 = nbatches / (cp.contrast * area * sample_density * sumfilt);
+ k2 = 1.0 / (cp.contrast * area * sample_density);
#if 0
printf("iw=%d,ih=%d,ppux=%f,ppuy=%f\n",image_width,image_height,ppux,ppuy);
- printf("contrast=%f, brightness=%f, PREFILTER=%d, temporal_filter=%f\n",
- cp.contrast, cp.brightness, PREFILTER_WHITE, temporal_filter[batch_num]);
- printf("nbatches=%d, area = %f, WHITE_LEVEL=%d, sample_density=%f\n",
- nbatches, area, WHITE_LEVEL, sample_density);
+ printf("contrast=%f, brightness=%f, PREFILTER=%d\n",
+ cp.contrast, cp.brightness, PREFILTER_WHITE);
+ printf("area = %f, WHITE_LEVEL=%d, sample_density=%f\n",
+ area, WHITE_LEVEL, sample_density);
printf("k1=%f,k2=%15.12f\n",k1,k2);
#endif
@@ -679,9 +618,6 @@ int render_rectangle(flam3_frame *spec, void *out,
stats->badvals = fic.badvals;
- free(temporal_filter);
- free(temporal_deltas);
- free(batch_filter);
free(buckets);
free(accumulate);
/* We have to clear the cps in fth first */
diff --git a/wscript b/wscript
index d804ab1..732086e 100644
--- a/wscript
+++ b/wscript
@@ -19,5 +19,5 @@ def configure(conf):
conf.write_config_header ('config.h')
def build(bld):
- bld.program (features='c cprogram', source='flam3.c filters.c parser.c variations.c interpolation.c palettes.c png.c random.c rect.c main.c', target='vlam3', use='xml2 png amdlibm pthread')
+ bld.program (features='c cprogram', source='flam3.c parser.c variations.c interpolation.c palettes.c png.c random.c rect.c main.c', target='vlam3', use='xml2 png amdlibm pthread')