# HG changeset patch # User Chris Cannam # Date 1568285597 -3600 # Node ID 62aad7969f8b838d1084ab383b5b5c1945fcc180 # Parent 5d179afc036608808191bf72145954a1df4f5257 Pass the cache pointer through rather than looking it up afresh from the model id for each column diff -r 5d179afc0366 -r 62aad7969f8b layer/Colour3DPlotRenderer.cpp --- a/layer/Colour3DPlotRenderer.cpp Wed Sep 11 20:36:04 2019 +0100 +++ b/layer/Colour3DPlotRenderer.cpp Thu Sep 12 11:53:17 2019 +0100 @@ -36,6 +36,7 @@ using namespace std::rel_ops; //#define DEBUG_COLOUR_PLOT_REPAINT 1 +//#define DEBUG_COLOUR_PLOT_CACHE_SELECTION 1 using namespace std; @@ -387,7 +388,7 @@ ColumnOp::Column Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins, - int peakCacheIndex) const + shared_ptr source) const { // order: // get column -> scale -> normalise -> record extents -> @@ -400,15 +401,15 @@ if (m_params.showDerivative && sx > 0) { - auto prev = getColumnRaw(sx - 1, minbin, nbins, peakCacheIndex); - column = getColumnRaw(sx, minbin, nbins, peakCacheIndex); + auto prev = getColumnRaw(sx - 1, minbin, nbins, source); + column = getColumnRaw(sx, minbin, nbins, source); for (int i = 0; i < nbins; ++i) { column[i] -= prev[i]; } } else { - column = getColumnRaw(sx, minbin, nbins, peakCacheIndex); + column = getColumnRaw(sx, minbin, nbins, source); } if (m_params.colourScale.getScale() == ColourScaleType::Phase && @@ -423,7 +424,7 @@ ColumnOp::Column Colour3DPlotRenderer::getColumnRaw(int sx, int minbin, int nbins, - int peakCacheIndex) const + shared_ptr source) const { Profiler profiler("Colour3DPlotRenderer::getColumn"); @@ -438,24 +439,9 @@ } if (fullColumn.empty()) { - - if (peakCacheIndex >= 0) { - auto peakCache = ModelById::getAs - (m_sources.peakCaches[peakCacheIndex]); - if (!peakCache) { - return vector(nbins, 0.f); - } - fullColumn = peakCache->getColumn(sx); - } else { - auto model = ModelById::getAs - (m_sources.source); - if (!model) { - return vector(nbins, 0.f); - } - fullColumn = model->getColumn(sx); - } + fullColumn = source->getColumn(sx); } - + column = vector(fullColumn.data() + minbin, fullColumn.data() + minbin + nbins); return column; @@ -526,7 +512,7 @@ // peak pick -> distribute/interpolate -> apply display gain // this does the first three: - preparedColumn = getColumn(sx, minbin, nbins, -1); + preparedColumn = getColumn(sx, minbin, nbins, model); magRange.sample(preparedColumn); @@ -645,7 +631,7 @@ if (!peakCache) continue; int bpp = peakCache->getColumnsPerPeak(); ZoomLevel equivZoom(ZoomLevel::FramesPerPixel, binResolution * bpp); -#ifdef DEBUG_COLOUR_PLOT_REPAINT +#ifdef DEBUG_COLOUR_PLOT_CACHE_SELECTION SVDEBUG << "render " << m_sources.source << ": getPreferredPeakCache: zoomLevel = " << zoomLevel << ", cache " << ix << " has bpp = " << bpp @@ -661,7 +647,7 @@ } } -#ifdef DEBUG_COLOUR_PLOT_REPAINT +#ifdef DEBUG_COLOUR_PLOT_CACHE_SELECTION SVDEBUG << "render " << m_sources.source << ": getPreferredPeakCache: zoomLevel = " << zoomLevel << ", binResolution " << binResolution @@ -1119,7 +1105,7 @@ // this does the first three: ColumnOp::Column column = getColumn(sx, minbin, nbins, - peakCacheIndex); + sourceModel); magRange.sample(column); @@ -1284,7 +1270,7 @@ } if (sx != psx) { - preparedColumn = getColumn(sx, minbin, nbins, -1); + preparedColumn = getColumn(sx, minbin, nbins, fft); magRange.sample(preparedColumn); psx = sx; } diff -r 5d179afc0366 -r 62aad7969f8b layer/Colour3DPlotRenderer.h --- a/layer/Colour3DPlotRenderer.h Wed Sep 11 20:36:04 2019 +0100 +++ b/layer/Colour3DPlotRenderer.h Thu Sep 12 11:53:17 2019 +0100 @@ -33,6 +33,7 @@ class VerticalBinLayer; class RenderTimer; class Dense3DModelPeakCache; +class DenseThreeDimensionalModel; enum class BinDisplay { AllBins, @@ -323,9 +324,9 @@ const; ColumnOp::Column getColumn(int sx, int minbin, int nbins, - int peakCacheIndex) const; // -1 => don't use cache + std::shared_ptr source) const; ColumnOp::Column getColumnRaw(int sx, int minbin, int nbins, - int peakCacheIndex) const; // -1 => don't use cache + std::shared_ptr source) const; void getPreferredPeakCache(const LayerGeometryProvider *, int &peakCacheIndex, int &binsPerPeak) const;