comparison base/ColumnOp.cpp @ 1303:47ee4706055c 3.0-integration

Further fix to decision about when not to interpolate in ColumnOp::distribute
author Chris Cannam
date Mon, 28 Nov 2016 18:09:59 +0000
parents 6681027ff2ff
children 9ef1cc26024c
comparison
equal deleted inserted replaced
1302:9d443c13c5d1 1303:47ee4706055c
97 bool interpolate) 97 bool interpolate)
98 { 98 {
99 vector<float> out(h, 0.f); 99 vector<float> out(h, 0.f);
100 int bins = int(in.size()); 100 int bins = int(in.size());
101 101
102 if (interpolate) {
103 // If the bins are all closer together than the target y
104 // coordinate increments, then we don't want to interpolate
105 // after all. But because the binfory mapping isn't
106 // necessarily linear, just checking e.g. whether bins > h is
107 // not enough -- the bins could still be spaced more widely at
108 // either end of the scale. We are prepared to assume however
109 // that if the bins are closer at both ends of the scale, they
110 // aren't going to diverge mysteriously in the middle.
111 if (h > 1 &&
112 fabs(binfory[1] - binfory[0]) >= 1.0 &&
113 fabs(binfory[h-1] - binfory[h-2]) >= 1.0) {
114 interpolate = false;
115 }
116 }
117
102 for (int y = 0; y < h; ++y) { 118 for (int y = 0; y < h; ++y) {
103 119
104 if (interpolate) { 120 if (interpolate) {
105 121
106 double sy = binfory[y] - minbin - 0.5; 122 double sy = binfory[y] - minbin - 0.5;