mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Visual Studio fixes
This commit is contained in:
parent
5a1bad26a7
commit
9436cb0315
@ -8,6 +8,7 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include "imageops.h"
|
#include "imageops.h"
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
#define SQUARE(x) (x)*(x)
|
#define SQUARE(x) (x)*(x)
|
||||||
#define MAX(x, y) ((x) > (y)) ? (x) : (y)
|
#define MAX(x, y) ((x) > (y)) ? (x) : (y)
|
||||||
@ -245,16 +246,16 @@ int default_convolve_matrix_size(const float radius, const float sigma, const bo
|
|||||||
if(sigma == 0.0) throw std::out_of_range("Zero sigma is invalid for convolution");
|
if(sigma == 0.0) throw std::out_of_range("Zero sigma is invalid for convolution");
|
||||||
|
|
||||||
if(radius > 0.0)
|
if(radius > 0.0)
|
||||||
return((int)(2.0*std::ceil(radius)+1.0));
|
return((int)(2.0*ceil(radius)+1.0));
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS;
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
matrix_size = 5;
|
matrix_size = 5;
|
||||||
do{
|
do{
|
||||||
normalize = 0.0;
|
normalize = 0.0;
|
||||||
for(i=(-matrix_size/2); i <= (matrix_size/2); ++i)
|
for(i=(-matrix_size/2); i <= (matrix_size/2); ++i)
|
||||||
normalize += std::exp(-((float) i*i)/sigma2) / sigmaSQ2PI;
|
normalize += exp(-((float) i*i)/sigma2) / sigmaSQ2PI;
|
||||||
i = matrix_size/2;
|
i = matrix_size/2;
|
||||||
value = std::exp(-((float) i*i)/sigma2) / sigmaSQ2PI / normalize;
|
value = exp(-((float) i*i)/sigma2) / sigmaSQ2PI / normalize;
|
||||||
matrix_size += 2;
|
matrix_size += 2;
|
||||||
} while((int)(max*value) > 0);
|
} while((int)(max*value) > 0);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user