comparison 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
comparison
equal deleted inserted replaced
1360:e848ea0850fe 1374:631897ba9fca
33 #include <vector> 33 #include <vector>
34 34
35 #include <utility> 35 #include <utility>
36 using namespace std::rel_ops; 36 using namespace std::rel_ops;
37 37
38 #define DEBUG_COLOUR_PLOT_REPAINT 1 38 //#define DEBUG_COLOUR_PLOT_REPAINT 1
39 39
40 using namespace std; 40 using namespace std;
41 41
42 Colour3DPlotRenderer::RenderResult 42 Colour3DPlotRenderer::RenderResult
43 Colour3DPlotRenderer::render(const LayerGeometryProvider *v, QPainter &paint, QRect rect) 43 Colour3DPlotRenderer::render(const LayerGeometryProvider *v, QPainter &paint, QRect rect)
351 351
352 ColumnOp::Column 352 ColumnOp::Column
353 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins, 353 Colour3DPlotRenderer::getColumn(int sx, int minbin, int nbins,
354 int peakCacheIndex) const 354 int peakCacheIndex) const
355 { 355 {
356 Profiler profiler("Colour3DPlotRenderer::getColumn");
357
358 // order: 356 // order:
359 // get column -> scale -> normalise -> record extents -> 357 // get column -> scale -> normalise -> record extents ->
360 // peak pick -> distribute/interpolate -> apply display gain 358 // peak pick -> distribute/interpolate -> apply display gain
361 359
362 // we do the first bit here: 360 // we do the first bit here:
363 // get column -> scale -> normalise 361 // get column -> scale -> normalise
364 362
365 ColumnOp::Column column; 363 ColumnOp::Column column;
366 364
365 if (m_params.showDerivative && sx > 0) {
366
367 auto prev = getColumnRaw(sx - 1, minbin, nbins, peakCacheIndex);
368 column = getColumnRaw(sx, minbin, nbins, peakCacheIndex);
369
370 for (int i = 0; i < nbins; ++i) {
371 column[i] -= prev[i];
372 }
373
374 } else {
375 column = getColumnRaw(sx, minbin, nbins, peakCacheIndex);
376 }
377
378 if (m_params.colourScale.getScale() == ColourScaleType::Phase &&
379 m_sources.fft) {
380 return column;
381 } else {
382 column = ColumnOp::applyGain(column, m_params.scaleFactor);
383 column = ColumnOp::normalize(column, m_params.normalization);
384 return column;
385 }
386 }
387
388 ColumnOp::Column
389 Colour3DPlotRenderer::getColumnRaw(int sx, int minbin, int nbins,
390 int peakCacheIndex) const
391 {
392 Profiler profiler("Colour3DPlotRenderer::getColumn");
393
394 ColumnOp::Column column;
395
367 if (m_params.colourScale.getScale() == ColourScaleType::Phase && 396 if (m_params.colourScale.getScale() == ColourScaleType::Phase &&
368 m_sources.fft) { 397 m_sources.fft) {
369 398
370 ColumnOp::Column fullColumn = m_sources.fft->getPhases(sx); 399 ColumnOp::Column fullColumn = m_sources.fft->getPhases(sx);
371 400
380 m_sources.source) 409 m_sources.source)
381 ->getColumn(sx); 410 ->getColumn(sx);
382 411
383 column = vector<float>(fullColumn.data() + minbin, 412 column = vector<float>(fullColumn.data() + minbin,
384 fullColumn.data() + minbin + nbins); 413 fullColumn.data() + minbin + nbins);
385
386 column = ColumnOp::applyGain(column, m_params.scaleFactor);
387
388 column = ColumnOp::normalize(column, m_params.normalization);
389 } 414 }
390 415
391 return column; 416 return column;
392 } 417 }
393 418