# HG changeset patch # User Chris Cannam # Date 1364395909 0 # Node ID eea8049df52622a142c63cb52c90d090cc9c01ac # Parent 2444ef08b7eb8bad9bb46fc297d0fbd729d8849c Fix incorrect retrieval of point in model by row number if point frame values fell between model resolution boundaries diff -r 2444ef08b7eb -r eea8049df526 data/model/SparseModel.h --- 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(); diff -r 2444ef08b7eb -r eea8049df526 transform/FeatureExtractionModelTransformer.cpp --- 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)); }