Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CImg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ians-nmh-siebert
extern
CImg
Commits
548744b4
Commit
548744b4
authored
Jul 4, 2018
by
David Tschumperlé
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
8139fcd3
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CImg.h
+61
-35
61 additions, 35 deletions
CImg.h
html/header.html
+1
-1
1 addition, 1 deletion
html/header.html
html/header_reference.html
+1
-1
1 addition, 1 deletion
html/header_reference.html
with
63 additions
and
37 deletions
CImg.h
+
61
−
35
View file @
548744b4
...
...
@@ -5295,15 +5295,62 @@ namespace cimg_library_suffixed {
return (float)std::fabs((double)a);
}
//! Return hyperbolic arcosine of a value.
inline double acosh(const double x) {
#if defined(cimg_use_cpp11) && !defined(_MSC_VER)
return std::acosh(x);
#else
return std::log(x + std::sqrt(x*x - 1));
#endif
}
//! Return hyperbolic arcsine of a value.
inline double asinh(const double x) {
#if defined(cimg_use_cpp11) && !defined(_MSC_VER)
return std::asinh(x);
#else
return std::log(x + std::sqrt(x*x + 1));
#endif
}
//! Return hyperbolic arctangent of a value.
inline double atanh(const double x) {
#if defined(cimg_use_cpp11) && !defined(_MSC_VER)
return std::atanh(x);
#else
return 0.5*std::log((1.0 + x)/(1.0 - x));
#endif
}
//! Return the sinc of a given value.
inline double sinc(const double x) {
return x?std::sin(x)/x:1;
}
//! Return base-2 logarithm of a value.
inline double log2(const double x) {
#if defined(cimg_use_cpp11) && !defined(_MSC_VER)
return std::log2(x);
#else
const double base2 = std::log(2.0);
return std::log(x)/base2;
#endif
}
//! Return square of a value.
template<typename T>
inline T sqr(const T& val) {
return val*val;
}
//! Return <tt>1 + log_10(x)</tt> of a value \c x.
inline int xln(const int x) {
return x>0?(int)(1 + std::log10((double)x)):1;
//! Return cubic root of a value.
template<typename T>
inline double cbrt(const T& x) {
#if cimg_use_cpp11==1
return std::cbrt(x);
#else
return x>=0?std::pow((double)x,1.0/3):-std::pow(-(double)x,1.0/3);
#endif
}
//! Return the minimum between three values.
...
...
@@ -5344,11 +5391,6 @@ namespace cimg_library_suffixed {
return i;
}
//! Return the sinc of a given value.
inline double sinc(const double x) {
return x?std::sin(x)/x:1;
}
//! Return the modulo of a value.
/**
\param x Input value.
...
...
@@ -5403,12 +5445,6 @@ namespace cimg_library_suffixed {
return a*b<=0?0:(a>0?(a<b?a:b):(a<b?b:a));
}
//! Return base-2 logarithm of a value.
inline double log2(const double x) {
const double base = std::log(2.0);
return std::log(x)/base;
}
template<typename T>
inline T round(const T& x) {
return (T)std::floor((_cimg_Tfloat)x + 0.5f);
...
...
@@ -5425,7 +5461,7 @@ namespace cimg_library_suffixed {
inline T round(const T& x, const double y, const int rounding_type=0) {
if (y<=0) return x;
if (y==1) switch (rounding_type) {
case 0 : return round(x);
case 0 : return
cimg::
round(x);
case 1 : return (T)std::ceil((_cimg_Tfloat)x);
default : return (T)std::floor((_cimg_Tfloat)x);
}
...
...
@@ -5433,16 +5469,6 @@ namespace cimg_library_suffixed {
return (T)(y*(rounding_type<0?floor:rounding_type>0?std::ceil(sx):delta<0.5?floor:std::ceil(sx)));
}
//! Return x^(1/3).
template<typename T>
inline double cbrt(const T& x) {
#if cimg_use_cpp11==1
return std::cbrt(x);
#else
return x>=0?std::pow((double)x,1.0/3):-std::pow(-(double)x,1.0/3);
#endif
}
// Code to compute fast median from 2,3,5,7,9,13,25 and 49 values.
// (contribution by RawTherapee: http://rawtherapee.com/).
template<typename T>
...
...
@@ -17349,7 +17375,7 @@ namespace cimg_library_suffixed {
_cimg_mp_op("Function 'acosh()'");
arg1 = compile(ss6,se1,depth1,0,is_single);
if (_cimg_mp_is_vector(arg1)) _cimg_mp_vector1_v(mp_acosh,arg1);
if (_cimg_mp_is_constant(arg1)) _cimg_mp_constant(
std
::acosh(mem[arg1]));
if (_cimg_mp_is_constant(arg1)) _cimg_mp_constant(
cimg
::acosh(mem[arg1]));
_cimg_mp_scalar1(mp_acosh,arg1);
}
...
...
@@ -17357,7 +17383,7 @@ namespace cimg_library_suffixed {
_cimg_mp_op("Function 'asinh()'");
arg1 = compile(ss6,se1,depth1,0,is_single);
if (_cimg_mp_is_vector(arg1)) _cimg_mp_vector1_v(mp_asinh,arg1);
if (_cimg_mp_is_constant(arg1)) _cimg_mp_constant(
std
::asinh(mem[arg1]));
if (_cimg_mp_is_constant(arg1)) _cimg_mp_constant(
cimg
::asinh(mem[arg1]));
_cimg_mp_scalar1(mp_asinh,arg1);
}
...
...
@@ -17365,7 +17391,7 @@ namespace cimg_library_suffixed {
_cimg_mp_op("Function 'atanh()'");
arg1 = compile(ss6,se1,depth1,0,is_single);
if (_cimg_mp_is_vector(arg1)) _cimg_mp_vector1_v(mp_atanh,arg1);
if (_cimg_mp_is_constant(arg1)) _cimg_mp_constant(
std
::atanh(mem[arg1]));
if (_cimg_mp_is_constant(arg1)) _cimg_mp_constant(
cimg
::atanh(mem[arg1]));
_cimg_mp_scalar1(mp_atanh,arg1);
}
...
...
@@ -20215,15 +20241,15 @@ namespace cimg_library_suffixed {
}
static double mp_acosh(_cimg_math_parser& mp) {
return
std
::acosh(_mp_arg(2));
return
cimg
::acosh(_mp_arg(2));
}
static double mp_asinh(_cimg_math_parser& mp) {
return
std
::asinh(_mp_arg(2));
return
cimg
::asinh(_mp_arg(2));
}
static double mp_atanh(_cimg_math_parser& mp) {
return
std
::atanh(_mp_arg(2));
return
cimg
::atanh(_mp_arg(2));
}
static double mp_arg(_cimg_math_parser& mp) {
...
...
@@ -23579,7 +23605,7 @@ namespace cimg_library_suffixed {
- The \inplace of this method statically casts the computed values to the pixel type \c T.
- The \newinstance returns a \c CImg<float> image, if the pixel type \c T is \e not float-valued.
**/
_cimg_create_pointwise_functions(log2,
std
::log2,4096)
_cimg_create_pointwise_functions(log2,
cimg
::log2,4096)
//! Compute the base-10 logarithm of each pixel value.
/**
...
...
@@ -23760,7 +23786,7 @@ namespace cimg_library_suffixed {
- The \inplace of this method statically casts the computed values to the pixel type \c T.
- The \newinstance returns a \c CImg<float> image, if the pixel type \c T is \e not float-valued.
**/
_cimg_create_pointwise_functions(acosh,
std
::acosh,8192)
_cimg_create_pointwise_functions(acosh,
cimg
::acosh,8192)
//! Compute the hyperbolic arcsine of each pixel value.
/**
...
...
@@ -23770,7 +23796,7 @@ namespace cimg_library_suffixed {
- The \inplace of this method statically casts the computed values to the pixel type \c T.
- The \newinstance returns a \c CImg<float> image, if the pixel type \c T is \e not float-valued.
**/
_cimg_create_pointwise_functions(asinh,
std
::asinh,8192)
_cimg_create_pointwise_functions(asinh,
cimg
::asinh,8192)
//! Compute the hyperbolic arctangent of each pixel value.
/**
...
...
@@ -23780,7 +23806,7 @@ namespace cimg_library_suffixed {
- The \inplace of this method statically casts the computed values to the pixel type \c T.
- The \newinstance returns a \c CImg<float> image, if the pixel type \c T is \e not float-valued.
**/
_cimg_create_pointwise_functions(atanh,
std
::atanh,8192)
_cimg_create_pointwise_functions(atanh,
cimg
::atanh,8192)
//! In-place pointwise multiplication.
/**
This diff is collapsed.
Click to expand it.
html/header.html
+
1
−
1
View file @
548744b4
...
...
@@ -45,7 +45,7 @@
<a
href=
"http://cimg.eu"
><img
src=
"http://cimg.eu/img/CImgLogo2.jpg"
alt=
""
border=
"0"
/></a><br/>
</center>
<center><font
size=
"-1"
color=
"#777777"
>
Latest stable version:
<b><a
href=
"http://cimg.eu/files"
>
2.3.
2
</a></b>
Latest stable version:
<b><a
href=
"http://cimg.eu/files"
>
2.3.
3
</a></b>
</font></center>
</td></tr>
<tr
bgcolor=
"#FFFFFF"
><td><hr
noshade
size=
"1"
style=
"border-top: 1px solid #ccc;"
/></td></tr>
...
...
This diff is collapsed.
Click to expand it.
html/header_reference.html
+
1
−
1
View file @
548744b4
...
...
@@ -44,7 +44,7 @@
<a
href=
"http://cimg.eu"
><img
src=
"http://cimg.eu/img/CImgLogo2.jpg"
alt=
""
border=
"0"
/></a><br/>
</center>
<center><font
size=
"-1"
color=
"#777777"
>
Latest stable version:
<b><a
href=
"http://cimg.eu/files"
>
2.3.
2
</a></b>
Latest stable version:
<b><a
href=
"http://cimg.eu/files"
>
2.3.
3
</a></b>
</font></center>
</td></tr>
<tr
bgcolor=
"#FFFFFF"
><td><hr
noshade
size=
"1"
style=
"border-top: 1px solid #ccc;"
/></td></tr>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment