15 return oldPeak + (newSlices - oldSlices)/2;
21 std::vector<int>& newVec,
const int newSlices)
23 const int oldSlices = oldVec.size();
24 const int offset = (newSlices - oldSlices)/2;
25 newVec.resize(newSlices);
26 for (
int sl = 0; sl < newSlices; ++sl) {
27 const int oldSl = sl -
offset;
28 if (oldSl < 0) newVec[sl] = oldVec[0];
29 else if (oldSl >= oldSlices) newVec[sl] = oldVec[oldSlices - 1];
30 else newVec[sl] = oldVec[oldSl];
37 std::vector<unsigned int>& newVec,
40 const int oldSlices = oldVec.size();
41 const int offset = (newSlices - oldSlices)/2;
42 newVec.resize(newSlices);
43 for (
int sl = 0; sl < newSlices; ++sl) {
44 const int oldSl = sl -
offset;
45 if (oldSl < 0) newVec[sl] = oldVec[0];
46 else if (oldSl >= oldSlices) newVec[sl] = oldVec[oldSlices - 1];
47 else newVec[sl] = oldVec[oldSl];