comparison layer/Colour3DPlotRenderer.cpp @ 1450:6cf3cb6641e1 single-point

Tweak peak-cache allocations etc in the hope of making long spectrograms a little faster to re-render
author Chris Cannam
date Wed, 01 May 2019 14:41:28 +0100
parents 79032214f79d
children f72fb7fac92a
comparison
equal deleted inserted replaced
1449:ce5f80a7c697 1450:6cf3cb6641e1
111 #ifdef DEBUG_COLOUR_PLOT_REPAINT 111 #ifdef DEBUG_COLOUR_PLOT_REPAINT
112 SVDEBUG << "Predicted time for width " << rect.width() << " = " 112 SVDEBUG << "Predicted time for width " << rect.width() << " = "
113 << predicted << " (" << m_secondsPerXPixel << " x " 113 << predicted << " (" << m_secondsPerXPixel << " x "
114 << rect.width() << ")" << endl; 114 << rect.width() << ")" << endl;
115 #endif 115 #endif
116 if (predicted < 0.2) { 116 if (predicted < 0.175) {
117 #ifdef DEBUG_COLOUR_PLOT_REPAINT 117 #ifdef DEBUG_COLOUR_PLOT_REPAINT
118 SVDEBUG << "Predicted time looks fast enough: no partial renders" 118 SVDEBUG << "Predicted time looks fast enough: no partial renders"
119 << endl; 119 << endl;
120 #endif 120 #endif
121 timeConstrained = false; 121 timeConstrained = false;
299 paint.drawImage(pr.x(), pr.y(), m_cache.getImage(), 299 paint.drawImage(pr.x(), pr.y(), m_cache.getImage(),
300 pr.x(), pr.y(), pr.width(), pr.height()); 300 pr.x(), pr.y(), pr.width(), pr.height());
301 301
302 if (!timeConstrained && (pr != rect)) { 302 if (!timeConstrained && (pr != rect)) {
303 SVCERR << "WARNING: failed to render entire requested rect " 303 SVCERR << "WARNING: failed to render entire requested rect "
304 << "even when not time-constrained" << endl; 304 << "even when not time-constrained: requested "
305 << rect.x() << "," << rect.y() << " "
306 << rect.width() << "x" << rect.height() << ", have "
307 << pr.x() << "," << pr.y() << " "
308 << pr.width() << "x" << pr.height()
309 << endl;
305 } 310 }
306 311
307 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0); 312 MagnitudeRange range = m_magCache.getRange(reqx0, reqx1 - reqx0);
308 313
309 #ifdef DEBUG_COLOUR_PLOT_REPAINT 314 #ifdef DEBUG_COLOUR_PLOT_REPAINT
597 int binResolution = model->getResolution(); 602 int binResolution = model->getResolution();
598 603
599 for (int ix = 0; in_range_for(m_sources.peakCaches, ix); ++ix) { 604 for (int ix = 0; in_range_for(m_sources.peakCaches, ix); ++ix) {
600 int bpp = m_sources.peakCaches[ix]->getColumnsPerPeak(); 605 int bpp = m_sources.peakCaches[ix]->getColumnsPerPeak();
601 ZoomLevel equivZoom(ZoomLevel::FramesPerPixel, binResolution * bpp); 606 ZoomLevel equivZoom(ZoomLevel::FramesPerPixel, binResolution * bpp);
607 #ifdef DEBUG_COLOUR_PLOT_REPAINT
608 SVDEBUG << "getPreferredPeakCache: zoomLevel = " << zoomLevel
609 << ", cache " << ix << " has bpp = " << bpp
610 << " for equivZoom = " << equivZoom << endl;
611 #endif
602 if (zoomLevel >= equivZoom) { 612 if (zoomLevel >= equivZoom) {
603 // this peak cache would work, though it might not be best 613 // this peak cache would work, though it might not be best
604 if (bpp > binsPerPeak) { 614 if (bpp > binsPerPeak) {
605 // ok, it's better than the best one we've found so far 615 // ok, it's better than the best one we've found so far
606 peakCacheIndex = ix; 616 peakCacheIndex = ix;
610 } 620 }
611 621
612 #ifdef DEBUG_COLOUR_PLOT_REPAINT 622 #ifdef DEBUG_COLOUR_PLOT_REPAINT
613 SVDEBUG << "getPreferredPeakCache: zoomLevel = " << zoomLevel 623 SVDEBUG << "getPreferredPeakCache: zoomLevel = " << zoomLevel
614 << ", binResolution " << binResolution 624 << ", binResolution " << binResolution
615 << ", binsPerPeak " << binsPerPeak
616 << ", peakCacheIndex " << peakCacheIndex
617 << ", peakCaches " << m_sources.peakCaches.size() 625 << ", peakCaches " << m_sources.peakCaches.size()
626 << ": preferring peakCacheIndex " << peakCacheIndex
627 << " for binsPerPeak " << binsPerPeak
618 << endl; 628 << endl;
619 #endif 629 #endif
620 } 630 }
621 631
622 void 632 void
1261 m_secondsPerXPixel = secondsPerXPixel; 1271 m_secondsPerXPixel = secondsPerXPixel;
1262 m_secondsPerXPixelValid = true; 1272 m_secondsPerXPixelValid = true;
1263 1273
1264 #ifdef DEBUG_COLOUR_PLOT_REPAINT 1274 #ifdef DEBUG_COLOUR_PLOT_REPAINT
1265 SVDEBUG << "across " << xPixelCount << " x-pixels, seconds per x-pixel = " 1275 SVDEBUG << "across " << xPixelCount << " x-pixels, seconds per x-pixel = "
1266 << m_secondsPerXPixel << endl; 1276 << m_secondsPerXPixel << " (total = "
1277 << (xPixelCount * m_secondsPerXPixel) << endl;
1267 #endif 1278 #endif
1268 } 1279 }
1269 } 1280 }
1270 1281
1271 void 1282 void