This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

MPFR vs GMP rendering test

  • Loading branch information...
jwm-art-net committed Nov 12, 2010
1 parent 2553e82 commit 554c574fb40c5c9ab133c2822f0374431e0e2a52
Showing with 346 additions and 40 deletions.
  1. +6 −0 TODO
  2. +1 −1 src/Makefile
  3. +44 −0 src/coords.c
  4. +18 −5 src/coords.h
  5. +232 −34 src/fractal.c
  6. +5 −0 src/fractal.h
  7. +26 −0 src/image_info.c
  8. +4 −0 src/image_info.h
  9. +6 −0 src/main_gui.c
  10. +4 −0 src/render.c
View
6 TODO
@@ -1,3 +1,9 @@
Todo RIGHT AT THIS VERY MOMENT!
* Testing GMP rendering speeds over MPFR rendering speeds.
GMP seems faster. May keep GMP rendering as an option.
Todo currently:
* When zoom-in-new window or duplicate is used the following settings
View
@@ -7,7 +7,7 @@ PROG := mdz
CC := gcc
DEFS := -Wall -Wextra -pedantic -std=gnu99 -DVERSION=\"$(VERSION)\"
DEFS := -Wall -Wextra -pedantic -std=gnu99 -DVERSION=\"$(VERSION)\" -DWITH_GMP
CFLAGS := $(DEFS) -O3 -fomit-frame-pointer -Winline
View
@@ -8,6 +8,22 @@
#include "debug.h"
#ifdef WITH_GMP
#include "my_mpfr_to_str.h"
void mpfr_to_gmp(mpfr_t from, mpf_t to)
{
char* str = my_mpfr_to_str(from);
mpf_set_str (to, str, 10);
printf("%s\n",str);
free(str);
}
#endif
static void coords_mpfr_clear(coords* c);
@@ -290,6 +306,19 @@ void coords_get_rect(coords* c, mpfr_t xmin, mpfr_t xmax,
}
#ifdef WITH_GMP
void coords_get_rect_gmp(coords* c, mpf_t xmin, mpf_t xmax,
mpf_t ymax, mpf_t width)
{
coords_center_to_rect(c);
mpfr_to_gmp(c->xmin, xmin);
mpfr_to_gmp(c->xmax, xmax);
mpfr_to_gmp(c->ymax, ymax);
mpfr_to_gmp(c->width, width);
}
#endif
void coords_set_rect(coords* c, mpfr_t xmin, mpfr_t xmax, mpfr_t ymax)
{
mpfr_set(c->xmin, xmin, GMP_RNDN);
@@ -435,6 +464,21 @@ void precision_change(mpfr_t x, mp_prec_t p)
}
#ifdef WITH_GMP
void precision_change_gmp(mpf_t x, mp_bitcnt_t p)
{
mpf_t tmp;
mpf_init2(tmp, p);
mpf_set(tmp, x);
mpf_set_prec( x, p);
mpf_set( x, tmp);
mpf_clear(tmp);
}
#endif
static void coords_mpfr_clear(coords* c)
{
mpfr_clear(c->xmin);
View
@@ -5,6 +5,10 @@
#include <stdio.h>
#include <mpfr.h>
#ifdef WITH_GMP
#include <gmp.h>
#endif
#define DEFAULT_PRECISION 80
@@ -15,6 +19,12 @@ int mpfr_mul_d(mpfr_t rop, mpfr_t op1, double _op2, mpfr_rnd_t rnd);
#endif
void precision_change(mpfr_t x, mp_prec_t p);
#ifdef WITH_GMP
void precision_change_gmp(mpf_t x, mp_bitcnt_t p);
#endif
struct coords
{
int img_width;
@@ -40,8 +50,6 @@ struct coords
mp_prec_t precision;
mp_prec_t recommend;
// bool using_mpfr;
double init_cx;
double init_cy;
double init_size;
@@ -87,12 +95,17 @@ void coords_pixel_to_coord(coords*, mpfr_t x, mpfr_t y);
void coords_get_rect(coords*, mpfr_t xmin, mpfr_t xmax,
mpfr_t ymax, mpfr_t width);
void coords_set_rect(coords*, mpfr_t xmin, mpfr_t xmax, mpfr_t y);
#ifdef WITH_GMP
void coords_get_rect_gmp(coords*, mpf_t xmin, mpf_t xmax,
mpf_t ymax, mpf_t width);
#endif
void coords_set_rect(coords*, mpfr_t xmin, mpfr_t xmax,
mpfr_t ymax);
#ifdef DEBUG
void coords_dump(const coords*, const char* msg);
#endif
void precision_change(mpfr_t x, mp_prec_t p);
#endif
Oops, something went wrong.

0 comments on commit 554c574

Please sign in to comment.