mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 09:14:27 +03:00
Removed variable
This commit is contained in:
parent
7b815a5f1d
commit
1a71faf8ea
|
@ -1265,10 +1265,9 @@ static PyObject*
|
|||
_entropy(ImagingObject* self, PyObject* args)
|
||||
{
|
||||
ImagingHistogram h;
|
||||
PyObject* entropy;
|
||||
int idx, length;
|
||||
long sum;
|
||||
double fentropy, fsum, p;
|
||||
double entropy, fsum, p;
|
||||
union hist_extrema extrema;
|
||||
union hist_extrema* ep;
|
||||
|
||||
|
@ -1295,21 +1294,18 @@ _entropy(ImagingObject* self, PyObject* args)
|
|||
/* Next, normalize the histogram data, */
|
||||
/* using the histogram sum value */
|
||||
fsum = (double)sum;
|
||||
fentropy = 0.0;
|
||||
entropy = 0.0;
|
||||
for (idx = 0; idx < length; idx++) {
|
||||
p = (double)h->histogram[idx] / fsum;
|
||||
if (p != 0.0) {
|
||||
fentropy += p * log(p) * M_LOG2E;
|
||||
entropy += p * log(p) * M_LOG2E;
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally, allocate a PyObject* for return */
|
||||
entropy = PyFloat_FromDouble(-fentropy);
|
||||
|
||||
/* Destroy the histogram structure */
|
||||
ImagingHistogramDelete(h);
|
||||
|
||||
return entropy;
|
||||
return PyFloat_FromDouble(-entropy);
|
||||
}
|
||||
|
||||
#ifdef WITH_MODEFILTER
|
||||
|
|
Loading…
Reference in New Issue
Block a user