comparison base/ColumnOp.cpp @ 1283:2f468f43c02c 3.0-integration

Warn when out-of-range bin requested
author Chris Cannam
date Wed, 23 Nov 2016 10:38:53 +0000
parents 1d8418cca63a
children 6681027ff2ff
comparison
equal deleted inserted replaced
1282:56c06dc0937c 1283:2f468f43c02c
16 #include "ColumnOp.h" 16 #include "ColumnOp.h"
17 17
18 #include <cmath> 18 #include <cmath>
19 #include <algorithm> 19 #include <algorithm>
20 #include <iostream> 20 #include <iostream>
21
22 #include "base/Debug.h"
21 23
22 using namespace std; 24 using namespace std;
23 25
24 ColumnOp::Column 26 ColumnOp::Column
25 ColumnOp::fftScale(const Column &in, int fftSize) 27 ColumnOp::fftScale(const Column &in, int fftSize)
144 sy1 = bins; 146 sy1 = bins;
145 } 147 }
146 148
147 int by0 = int(sy0 + 0.0001); 149 int by0 = int(sy0 + 0.0001);
148 int by1 = int(sy1 + 0.0001); 150 int by1 = int(sy1 + 0.0001);
151
152 if (by0 < 0 || by0 >= bins || by1 > bins) {
153 SVCERR << "ERROR: bin index out of range in ColumnOp::distribute: by0 = " << by0 << ", by1 = " << by1 << ", sy0 = " << sy0 << ", sy1 = " << sy1 << ", y = " << y << ", binfory[y] = " << binfory[y] << ", minbin = " << minbin << ", bins = " << bins << endl;
154 continue;
155 }
149 156
150 for (int bin = by0; bin == by0 || bin < by1; ++bin) { 157 for (int bin = by0; bin == by0 || bin < by1; ++bin) {
151 158
152 float value = in[bin]; 159 float value = in[bin];
153 160