diff layer/Colour3DPlotRenderer.cpp @ 1374:631897ba9fca zoom

Merge from default branch
author Chris Cannam
date Tue, 06 Nov 2018 08:59:03 +0000
parents 7d28e7522dbd
children 79032214f79d
line wrap: on
line diff
--- a/layer/Colour3DPlotRenderer.cpp	Fri Oct 05 10:25:52 2018 +0100
+++ b/layer/Colour3DPlotRenderer.cpp	Tue Nov 06 08:59:03 2018 +0000
@@ -35,7 +35,7 @@
 #include <utility>
 using namespace std::rel_ops;
 
-#define DEBUG_COLOUR_PLOT_REPAINT 1
+//#define DEBUG_COLOUR_PLOT_REPAINT 1
 
 using namespace std;
 
@@ -353,8 +353,6 @@
 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins,
                                 int peakCacheIndex) const
 {
-    Profiler profiler("Colour3DPlotRenderer::getColumn");
-    
     // order:
     // get column -> scale -> normalise -> record extents ->
     // peak pick -> distribute/interpolate -> apply display gain
@@ -363,7 +361,38 @@
     // get column -> scale -> normalise
 
     ColumnOp::Column column;
-                
+    
+    if (m_params.showDerivative && sx > 0) {
+
+        auto prev = getColumnRaw(sx - 1, minbin, nbins, peakCacheIndex);
+        column = getColumnRaw(sx, minbin, nbins, peakCacheIndex);
+        
+        for (int i = 0; i < nbins; ++i) {
+            column[i] -= prev[i];
+        }
+
+    } else {
+        column = getColumnRaw(sx, minbin, nbins, peakCacheIndex);
+    }
+
+    if (m_params.colourScale.getScale() == ColourScaleType::Phase &&
+        m_sources.fft) {
+        return column;
+    } else {
+        column = ColumnOp::applyGain(column, m_params.scaleFactor);
+        column = ColumnOp::normalize(column, m_params.normalization);
+        return column;
+    }
+}
+
+ColumnOp::Column
+Colour3DPlotRenderer::getColumnRaw(int sx, int minbin, int nbins,
+                                   int peakCacheIndex) const
+{
+    Profiler profiler("Colour3DPlotRenderer::getColumn");
+
+    ColumnOp::Column column;
+
     if (m_params.colourScale.getScale() == ColourScaleType::Phase &&
         m_sources.fft) {
 
@@ -382,10 +411,6 @@
                 
         column = vector<float>(fullColumn.data() + minbin,
                                fullColumn.data() + minbin + nbins);
-
-        column = ColumnOp::applyGain(column, m_params.scaleFactor);
-
-        column = ColumnOp::normalize(column, m_params.normalization);
     }
 
     return column;