Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
dtschump committed Feb 1, 2025
2 parents 282645a + 8cbe4d3 commit 92c64f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
21 changes: 8 additions & 13 deletions CImg.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

// Set version number of the library.
#ifndef cimg_version
#define cimg_version 352
#define cimg_version 353

/*-----------------------------------------------------------
#
Expand Down Expand Up @@ -44119,7 +44119,7 @@ namespace cimg_library {
const int
x0 = x - hl, y0 = y - hl, x1 = x + hr, y1 = y + hr,
nx0 = x0<0?0:x0, ny0 = y0<0?0:y0,
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1;
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1;
const Tfloat val0 = (Tfloat)(*this)(x,y,c);
CImg<T> values(n*n);
unsigned int nb_values = 0;
Expand All @@ -44128,14 +44128,13 @@ namespace cimg_library {
if (cimg::abs((*this)(p,q,c) - val0)<=threshold) { *(_ptrd++) = (*this)(p,q,c); ++nb_values; }
res(x,y,c) = nb_values?values.get_shared_points(0,nb_values - 1).median():(*this)(x,y,c);
}
else {
else { // Without threshold
const int
w1 = width() - 1, h1 = height() - 1,
w2 = width() - 2, h2 = height() - 2,
w3 = width() - 3, h3 = height() - 3,
w4 = width() - 4, h4 = height() - 4;
switch (n) { // Without threshold
case 3 : {
if (n==3 && _width>=n && _height>=n) {
cimg_pragma_openmp(parallel for cimg_openmp_if(_spectrum>=2))
cimg_forC(*this,c) {
CImg<T> I(9);
Expand All @@ -44145,8 +44144,7 @@ namespace cimg_library {
res(x,y,c) = get_crop(std::max(0,x - 1),std::max(0,y - 1),0,c,
std::min(w1,x + 1),std::min(h1,y + 1),0,c).median();
}
} break;
case 5 : {
} else if (n==5 && _width>=n && _height>=n) {
cimg_pragma_openmp(parallel for cimg_openmp_if(_spectrum>=2))
cimg_forC(*this,c) {
CImg<T> I(25);
Expand All @@ -44160,8 +44158,7 @@ namespace cimg_library {
res(x,y,c) = get_crop(std::max(0,x - 2),std::max(0,y - 2),0,c,
std::min(w1,x + 2),std::min(h1,y + 2),0,c).median();
}
} break;
case 7 : {
} else if (n==7 && _width>=n && _height>=n) {
cimg_pragma_openmp(parallel for cimg_openmp_if(_spectrum>=2))
cimg_forC(*this,c) {
CImg<T> I(49);
Expand All @@ -44177,19 +44174,17 @@ namespace cimg_library {
res(x,y,c) = get_crop(std::max(0,x - 3),std::max(0,y - 3),0,c,
std::min(w1,x + 3),std::min(h1,y + 3),0,c).median();
}
} break;
default : {
} else {
cimg_pragma_openmp(parallel for cimg_openmp_collapse(2)
cimg_openmp_if(_width>=(cimg_openmp_sizefactor)*16 && _height*_spectrum>=4))
cimg_forXYC(*this,x,y,c) {
const int
x0 = x - hl, y0 = y - hl, x1 = x + hr, y1 = y + hr,
nx0 = x0<0?0:x0, ny0 = y0<0?0:y0,
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1;
nx1 = x1>=width()?width() - 1:x1, ny1 = y1>=height()?height() - 1:y1;
res(x,y,c) = get_crop(nx0,ny0,0,c,nx1,ny1,0,c).median();
}
}
}
}
}
return res;
Expand Down
2 changes: 1 addition & 1 deletion html/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<div class="header">
<a href="index.html"><img alt="Logo" src="img/logo_header.jpg" class="center_image" style="margin-top:1em;"/></a>
<h2 style="padding-bottom: 1em">
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.5.1</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="http://cimg.eu/files/CImg_latest.zip">3.5.2</a></b> (2025/01/28)
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.5.2</a></b> (2025/01/28)
</h2>

<hr/>
Expand Down
2 changes: 1 addition & 1 deletion html/header_doxygen.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<div class="header">
<a href="../index.html"><img alt="Logo" src="../img/logo_header.jpg" class="center_image" style="margin-top:1em;"/></a>
<h2 style="padding-bottom: 1em">
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.5.1</a></b> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Current pre-release: <b><a href="http://cimg.eu/files/CImg_latest.zip">3.5.2</a></b> (2025/01/28)
Latest stable version: <b><a href="http://cimg.eu/files/CImg_.zip">3.5.2</a></b> (2025/01/28)
</h2>

<hr/>
Expand Down

0 comments on commit 92c64f9

Please sign in to comment.