Mercurial > hg > svcore
changeset 777:eea8049df526
Fix incorrect retrieval of point in model by row number if point frame values fell between model resolution boundaries
author | Chris Cannam |
---|---|
date | Wed, 27 Mar 2013 14:51:49 +0000 |
parents | 2444ef08b7eb |
children | d373ced0e6e9 |
files | data/model/SparseModel.h transform/FeatureExtractionModelTransformer.cpp |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/data/model/SparseModel.h Mon Mar 25 12:15:36 2013 +0000 +++ b/data/model/SparseModel.h Wed Mar 27 14:51:49 2013 +0000 @@ -386,6 +386,7 @@ { m_rows.clear(); for (PointListConstIterator i = m_points.begin(); i != m_points.end(); ++i) { +// std::cerr << "rebuildRowVector: row " << m_rows.size() << " -> " << i->frame << std::endl; m_rows.push_back(i->frame); } } @@ -406,6 +407,7 @@ PointListIterator i = i0; for (i = i0; i != i1; ++i) { + if (i->frame < frame) { continue; } if (indexAtFrame > 0) { --indexAtFrame; continue; } return i; } @@ -427,11 +429,14 @@ while (ri > 0 && m_rows[ri-1] == m_rows[row]) { --ri; ++indexAtFrame; } int initialIndexAtFrame = indexAtFrame; +// std::cerr << "getPointListIteratorForRow " << row << ": initialIndexAtFrame = " << initialIndexAtFrame << std::endl; + PointListConstIterator i0, i1; getPointIterators(frame, i0, i1); PointListConstIterator i = i0; for (i = i0; i != i1; ++i) { + if (i->frame < frame) { continue; } if (indexAtFrame > 0) { --indexAtFrame; continue; } return i; } @@ -579,7 +584,7 @@ long end = start + m_resolution; PointType startPoint(start), endPoint(end); - + startItr = m_points.lower_bound(startPoint); endItr = m_points.upper_bound(endPoint); } @@ -603,6 +608,8 @@ PointType startPoint(start), endPoint(end); +// std::cerr << "getPointIterators: start frame " << start << ", end frame " << end << ", m_resolution " << m_resolution << std::endl; + startItr = m_points.lower_bound(startPoint); endItr = m_points.upper_bound(endPoint); } @@ -775,8 +782,8 @@ QString indent, QString extraAttributes) const { - std::cerr << "SparseModel::toXml: extraAttributes = \"" - << extraAttributes.toStdString() << std::endl; +// std::cerr << "SparseModel::toXml: extraAttributes = \"" +// << extraAttributes.toStdString() << std::endl; QString type = getXmlOutputType();
--- a/transform/FeatureExtractionModelTransformer.cpp Mon Mar 25 12:15:36 2013 +0000 +++ b/transform/FeatureExtractionModelTransformer.cpp Wed Mar 27 14:51:49 2013 +0000 @@ -673,6 +673,9 @@ } else { frame = m_output->getEndFrame(); } + +// std::cerr << "Feature hasTimestamp = " << feature.hasTimestamp << ", timestamp = " << feature.timestamp << ", frame works out to " << frame << std::endl; + } // Rather than repeat the complicated tests from the constructor @@ -704,6 +707,8 @@ label = QString("[%1] %2").arg(i+1).arg(label); } + std::cerr << "Adding point at " << frame << " with value " << value << " and label " << label << std::endl; + model->addPoint(SparseTimeValueModel::Point(frame, value, label)); }