comparison layer/Colour3DPlotRenderer.cpp @ 1136:9ff838a64461 spectrogram-minor-refactor

Re-enable (little-used) normalise-visible-range option in spectrogram layer
author Chris Cannam
date Wed, 03 Aug 2016 16:16:23 +0100
parents 628cd329c241
children 998e31e92dbe
comparison
equal deleted inserted replaced
1135:628cd329c241 1136:9ff838a64461
672 int sourceLeft = targetLeft - scaledLeft; 672 int sourceLeft = targetLeft - scaledLeft;
673 if (sourceLeft < 0) { 673 if (sourceLeft < 0) {
674 sourceLeft = 0; 674 sourceLeft = 0;
675 } 675 }
676 676
677 int sourceWidth = targetWidth;
678
679 cerr << "repaintWidth = " << repaintWidth 677 cerr << "repaintWidth = " << repaintWidth
680 << ", targetWidth = " << targetWidth << endl; 678 << ", targetWidth = " << targetWidth << endl;
681 679
682 if (targetWidth > 0) { 680 if (targetWidth > 0) {
681 // we are copying from an image that has already been scaled,
682 // hence using the same width in both geometries
683 m_cache.drawImage(targetLeft, targetWidth, 683 m_cache.drawImage(targetLeft, targetWidth,
684 scaled, 684 scaled,
685 sourceLeft, sourceWidth); 685 sourceLeft, targetWidth);
686 } 686 }
687 687
688 for (int i = 0; i < targetWidth; ++i) { 688 for (int i = 0; i < targetWidth; ++i) {
689 int sourceIx = int((double(i) / targetWidth) * sourceWidth); 689 // but the mag range vector has not been scaled
690 int sourceIx = int((double(i + sourceLeft) / scaled.width())
691 * int(m_magRanges.size()));
692 // int sourceIx = int((double(i) / targetWidth) * sourceWidth);
693 cerr << "mag range target ix = " << i << ", source ix = "
694 << sourceIx << ", of " << m_magRanges.size() << endl;
690 if (in_range_for(m_magRanges, sourceIx)) { 695 if (in_range_for(m_magRanges, sourceIx)) {
691 m_magCache.sampleColumn(i, m_magRanges.at(sourceIx)); 696 m_magCache.sampleColumn(i, m_magRanges.at(sourceIx));
692 } 697 }
693 } 698 }
694 } 699 }
785 // normalise -> peak pick -> distribute/interpolate -> 790 // normalise -> peak pick -> distribute/interpolate ->
786 // apply display gain 791 // apply display gain
787 792
788 ColumnOp::Column fullColumn = sourceModel->getColumn(sx); 793 ColumnOp::Column fullColumn = sourceModel->getColumn(sx);
789 794
790 cerr << "x " << x << ", sx " << sx << ", col height " << fullColumn.size() 795 // cerr << "x " << x << ", sx " << sx << ", col height " << fullColumn.size()
791 << ", minbin " << minbin << ", nbins " << nbins << endl; 796 // << ", minbin " << minbin << ", nbins " << nbins << endl;
792 797
793 ColumnOp::Column column = 798 ColumnOp::Column column =
794 vector<float>(fullColumn.data() + minbin, 799 vector<float>(fullColumn.data() + minbin,
795 fullColumn.data() + minbin + nbins); 800 fullColumn.data() + minbin + nbins);
796 801