Merge pull request #5 from nrobidoux/master

as mentioned in an email, this recomments the "cheap" #define in LBB and cleans up comments for it and nohalo
This commit is contained in:
John Cupitt 2011-11-23 06:02:40 -08:00
commit e8a6699296
2 changed files with 50 additions and 38 deletions

View File

@ -3,6 +3,8 @@
* N. Robidoux, C. Racette and J. Cupitt, 23-28/03/2010 * N. Robidoux, C. Racette and J. Cupitt, 23-28/03/2010
* *
* N. Robidoux, 16-19/05/2010 * N. Robidoux, 16-19/05/2010
*
* N. Robidoux, 22/11/2011
*/ */
/* /*
@ -35,13 +37,16 @@
/* /*
* 2010 (c) Nicolas Robidoux, Chantal Racette, John Cupitt. * 2010 (c) Nicolas Robidoux, Chantal Racette, John Cupitt.
* *
* Nicolas Robidoux thanks Adam Turcotte, Geert Jordaens, Ralf Meyer, * N. Robidoux thanks Adam Turcotte, Geert Jordaens, Ralf Meyer,
* Øyvind Kolås, Minglun Gong, Eric Daoust and Sven Neumann for useful * Øyvind Kolås, Minglun Gong, Eric Daoust and Sven Neumann for useful
* comments and code. * comments and code.
* *
* Chantal Racette's image resampling research and programming funded * C. Racette's image resampling research and programming funded in
* in part by a NSERC Discovery Grant awarded to Julien Dompierre * part by an NSERC (National Science and Engineering Research Council
* (20-61098). * of Canada) Alexander Graham Bell Canada Graduate Scholarship, by an
* NSERC Discovery Grant awarded to Julien Dompierre (grant number
* 20-61098) and by N. Robidoux's Laurentian University professional
* allowance.
*/ */
/* /*
@ -53,21 +58,21 @@
* *
* A "sharp" version, which shows a little more staircasing and a * A "sharp" version, which shows a little more staircasing and a
* little less haloing, which is a little cheaper (it uses 6 less * little less haloing, which is a little cheaper (it uses 6 less
* comparisons and 12 less "? :"), and which appears to lead to less * comparisons and 12 less "? :").
* "zebra striping" when two diagonal interfaces are close to each
* other.
* *
* The only difference between the two is that the "soft" versions * The only difference between the two is that the "soft" versions
* uses local minima and maxima computed over 3x3 square blocks, and * uses local minima and maxima computed over 3x3 square blocks, and
* the "sharp" version uses local minima and maxima computed over 3x3 * the "sharp" version uses local minima and maxima computed over 3x3
* crosses. * crosses.
* *
* If you want to use the "soft" (more expensive) version, comment out * If you want to use the "sharp" version, comment out the following
* the following three pre-processor code lines: * three pre-processor code lines:
*/ */
/*
#ifndef __LBB_CHEAP_H__ #ifndef __LBB_CHEAP_H__
#define __LBB_CHEAP_H__ #define __LBB_CHEAP_H__
#endif #endif
*/
/* /*
* LBB (Locally Bounded Bicubic) is a high quality nonlinear variant * LBB (Locally Bounded Bicubic) is a high quality nonlinear variant
@ -83,14 +88,14 @@
* final clamping is needed to stay "in range" (e.g., 0-255 for * final clamping is needed to stay "in range" (e.g., 0-255 for
* standard 8-bit images). * standard 8-bit images).
* *
* LBB was developed by Nicolas Robidoux and Chantal Racette of the * LBB was developed by N. Robidoux and C. Racette at the Department
* Department of Mathematics and Computer Science of Laurentian * of Mathematics and Computer Science of Laurentian University in the
* University in the course of C. Racette's Masters thesis in * course of C. Racette's Masters thesis in Computational
* Computational Sciences. Preliminary work directly leading to the * Sciences. Preliminary work directly leading to the LBB method and
* LBB method and code was performed by C. Racette and N. Robidoux in * code was performed by C. Racette and N. Robidoux in the course of
* the course of her honours thesis, and by N. Robidoux, A. Turcotte * her honours thesis, and by N. Robidoux, A. Turcotte and E. Daoust
* and E. Daoust during Google Summer of Code 2009 (through two awards * during Google Summer of Code 2009 (through two awards made to GIMP
* made to GIMP to improve GEGL). * to improve GEGL).
* *
* LBB is a novel method with the following properties: * LBB is a novel method with the following properties:
* *
@ -186,6 +191,9 @@ typedef struct _VipsInterpolateLbbClass {
} VipsInterpolateLbbClass; } VipsInterpolateLbbClass;
/*
* Absolute value and sign macros:
*/
#define LBB_ABS(x) ( ((x)>=0.) ? (x) : -(x) ) #define LBB_ABS(x) ( ((x)>=0.) ? (x) : -(x) )
#define LBB_SIGN(x) ( ((x)>=0.) ? 1.0 : -1.0 ) #define LBB_SIGN(x) ( ((x)>=0.) ? 1.0 : -1.0 )
/* /*
@ -258,6 +266,9 @@ lbbicubic( const double c00,
* sub-crosses of the 4x4 input stencil, performed with only 22 * sub-crosses of the 4x4 input stencil, performed with only 22
* comparisons and 28 "? :". If you can figure out how to do this * comparisons and 28 "? :". If you can figure out how to do this
* more efficiently, let us know. * more efficiently, let us know.
*
* This is the cheaper (but arguably less desirable in terms of
* quality) version of the computation.
*/ */
const double m1 = (dos_two <= dos_thr) ? dos_two : dos_thr ; const double m1 = (dos_two <= dos_thr) ? dos_two : dos_thr ;
const double M1 = (dos_two <= dos_thr) ? dos_thr : dos_two ; const double M1 = (dos_two <= dos_thr) ? dos_thr : dos_two ;

View File

@ -46,7 +46,7 @@
* 2009-2010 (c) Nicolas Robidoux, Chantal Racette, John Cupitt and * 2009-2010 (c) Nicolas Robidoux, Chantal Racette, John Cupitt and
* Adam Turcotte * Adam Turcotte
* *
* Nicolas Robidoux thanks Geert Jordaens, Ralf Meyer, Øyvind Kolås, * N. Robidoux thanks Geert Jordaens, Ralf Meyer, Øyvind Kolås,
* Minglun Gong, Eric Daoust and Sven Neumann for useful comments and * Minglun Gong, Eric Daoust and Sven Neumann for useful comments and
* code. * code.
* *
@ -54,24 +54,27 @@
* (National Science and Engineering Research Council of Canada) * (National Science and Engineering Research Council of Canada)
* Discovery Grant awarded to him (298424--2004). * Discovery Grant awarded to him (298424--2004).
* *
* Chantal Racette's image resampling research and programming funded * C. Racette's image resampling research and programming funded in
* in part by a NSERC Discovery Grant awarded to Julien Dompierre * part by an NSERC (National Science and Engineering Research Council
* (20-61098). * of Canada) Alexander Graham Bell Canada Graduate Scholarship, by an
* NSERC Discovery Grant awarded to Julien Dompierre (grant number
* 20-61098) and by N. Robidoux's Laurentian University professional
* allowance.
* *
* A. Turcotte's image resampling research on reduced halo funded in * A. Turcotte's image resampling research on reduced halo funded in
* part by an NSERC Alexander Graham Bell Canada Graduate Scholarhip * part by an NSERC Alexander Graham Bell Canada Graduate Scholarhip
* awarded to him and by a Google Summer of Code 2010 award awarded to * awarded to him and by a Google Summer of Code 2010 award awarded to
* GIMP (Gnu Image Manipulation Program). * GIMP (Gnu Image Manipulation Program).
* *
* Nohalo with LBB finishing scheme was developed by Nicolas Robidoux * Nohalo with LBB finishing scheme was developed by N. Robidoux and
* and Chantal Racette of the Department of Mathematics and Computer * C. Racette at the Department of Mathematics and Computer Science of
* Science of Laurentian University in the course of C. Racette's * Laurentian University in the course of C. Racette's Masters thesis
* Masters thesis in Computational Sciences. Preliminary work on * in Computational Sciences. Preliminary work on Nohalo and monotone
* Nohalo and monotone interpolation was performed by C. Racette and * interpolation was performed by C. Racette and N. Robidoux in the
* N. Robidoux in the course of her honours thesis, by N. Robidoux, * course of her honours thesis, by N. Robidoux, A. Turcotte and
* A. Turcotte and E. Daoust during Google Summer of Code 2009 * E. Daoust during Google Summer of Code 2009 (through two awards
* (through two awards made to GIMP to improve GEGL), and, earlier, by * made to GIMP to improve GEGL), and, earlier, by N. Robidoux,
* N. Robidoux, A. Turcotte, J. Cupitt, M. Gong and K. Martinez. * A. Turcotte, J. Cupitt, M. Gong and K. Martinez.
*/ */
/* /*
@ -100,10 +103,6 @@
*/ */
/* /*
commented out 24/2/10, nohalo gets a bit better without it, though
not lbb
#ifndef __NOHALO_CHEAP_H__ #ifndef __NOHALO_CHEAP_H__
#define __NOHALO_CHEAP_H__ #define __NOHALO_CHEAP_H__
#endif #endif
@ -306,6 +305,9 @@ typedef struct _VipsInterpolateNohaloClass {
#define NOHALO_MINMOD(a,b,a_times_a,a_times_b) \ #define NOHALO_MINMOD(a,b,a_times_a,a_times_b) \
( ( (a_times_b)>=0. ) ? ( (a_times_a)<=(a_times_b) ? (a) : (b) ) : 0. ) ( ( (a_times_b)>=0. ) ? ( (a_times_a)<=(a_times_b) ? (a) : (b) ) : 0. )
/*
* Absolute value and sign macros:
*/
#define NOHALO_ABS(x) ( ((x)>=0.) ? (x) : -(x) ) #define NOHALO_ABS(x) ( ((x)>=0.) ? (x) : -(x) )
#define NOHALO_SIGN(x) ( ((x)>=0.) ? 1. : -1. ) #define NOHALO_SIGN(x) ( ((x)>=0.) ? 1. : -1. )
@ -692,10 +694,9 @@ nohalo_subdivision (const double uno_two,
* final clamping is needed to stay "in range" (e.g., 0-255 for * final clamping is needed to stay "in range" (e.g., 0-255 for
* standard 8-bit images). * standard 8-bit images).
* *
* LBB was developed by Nicolas Robidoux and Chantal Racette of the * LBB was developed by N. Robidoux and C. Racette of the Department
* Department of Mathematics and Computer Science of Laurentian * of Mathematics and Computer Science of Laurentian University in the
* University in the course of Chantal's Masters Thesis in * course of C.'s Masters Thesis in Computational Sciences.
* Computational Sciences.
*/ */
/* /*