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