Going back to your first reply, I want to do an analogy with VTK color mapping classes : vtk_color_mapping.png

From what I understood, using QwtColorMap::RGB format, is like using the VTK class vtkColorTransferFunction (take a look at the picture above), which requires the computation of an RGB color based on the value of the raster pixel.

This is slower than looking up colors in a 256 color array which can be done by setting the format to QwtColorMap::Indexed. In VTK, the corresponding class would be vtkLookupTable. However, the VTK's look up table size can be changed which is not possible with QwtColorMap::Indexed.

In Qwt 6.2, as you said, you added a method QwtPlotSpectrogram::setMaxRGBTableSize, I took a look to the code, and, from what I understood, the mode QwtColorMap::RGB now uses a look up table (like vtkLookupTable) instead of computing RGB values (interpolation) with each replot (if the data changes), so it's a little bit faster than the older versions.

Is DEBUG_RENDER a compilation macro ? Do I need to rebuild the library in order to use it ?

I tried changing the format from RGB to Indexed and the replot crashes only if the QwtMatrixRasterData's setResampleMode is set to NearestNeighbour. Otherwise, with BilinearInterpolation the replot doesn't crash. Below the callstack of the crash :

Thread 1 (Thread 0x7fffcf98f980 (LWP 26954)):
#0 0x00007fffddc44348 in convertIndexedToARGB32PM(unsigned int*, unsigned int const*, int, QVector<unsigned int> const*, QDitherInfo*) () at /lib64/libQt5Gui.so.5
#1 0x00007fffddc4e581 in blend_untransformed_generic(int, QT_FT_Span_ const*, void*) () at /lib64/libQt5Gui.so.5
#2 0x00007fffddc7b6c6 in fillRect_normalized(QRect const&, QSpanData*, QRasterPaintEnginePrivate*) () at /lib64/libQt5Gui.so.5
#3 0x00007fffddc80d9d in QRasterPaintEngine::drawImage(QRectF const&, QImage const&, QRectF const&, QFlags<Qt::ImageConversionFlag>) [clone .part.109] () at /lib64/libQt5Gui.so.5
#4 0x00007fffddc9a3b7 in QPainter::drawImage(QRectF const&, QImage const&, QRectF const&, QFlags<Qt::ImageConversionFlag>) () at /lib64/libQt5Gui.so.5
#5 0x00007fffea6f5ef8 in QwtPainter::drawImage(QPainter*, QRectF const&, QImage const&) (image=..., r=<synthetic pointer>, this=0x7fffffffb540) at /usr/include/qt5/QtGui/qpainter.h:848
#6 0x00007fffea6f5ef8 in QwtPainter::drawImage(QPainter*, QRectF const&, QImage const&) (painter=painter@entry=0x7fffffffb540, rect=..., image=...) at ../../qwt-6.1/src/qwt_painter.cpp:665
#7 0x00007fffea7581b2 in QwtPlotRasterItem::draw(QPainter*, QwtScaleMap const&, QwtScaleMap const&, QRectF const&) const (this=<optimized out>, painter=0x7fffffffb540, xMap=..., yMap=..., canvasRect=...) at ../../qwt-6.1/src/qwt_plot_rasteritem.cpp:761
yInterval = {d_minValue = 9750, d_maxValue = 10750, d_borderFlags = {i = 2}}
paintRect = {xp = 0, yp = 0, w = 1229, h = 714}
area = {xp = 0, yp = 9750, w = 500, h = 1000}
imageRect = {xp = 0, yp = 1, w = 1228, h = 713}
yyMap = {d_s1 = 9750, d_s2 = 10750, d_p1 = 713, d_p2 = 0, d_cnv = -0.71299999999999997, d_ts1 = 9750, d_transform = 0x0}
xInterval = {d_minValue = 0, d_maxValue = 500, d_borderFlags = {i = 2}}
xxMap = {d_s1 = 0, d_s2 = 500, d_p1 = 0, d_p2 = 1228, d_cnv = 2.456, d_ts1 = 0, d_transform = 0x0}
br = {xp = 0, yp = 9750, w = 500, h = 1000}
image = <incomplete type>
pixelRect = {xp = 0, yp = 9750, w = 2, h = 7.8125}
#8 0x00007fffea740495 in QwtPlotSpectrogram::draw(QPainter*, QwtScaleMap const&, QwtScaleMap const&, QRectF const&) const (this=this@entry=0xd92010, painter=painter@entry=0x7fffffffb540, xMap=..., yMap=..., canvasRect=...) at ../../qwt-6.1/src/qwt_plot_spectrogram.cpp:645
#9 0x00007fffea721c00 in QwtPlot::drawItems(QPainter*, QRectF const&, QwtScaleMap const*) const (this=<optimized out>, painter=0x7fffffffb540, canvasRect=..., maps=0x7fffffffb320) at ../../qwt-6.1/src/qwt_plot.cpp:790
item = 0xd92010
it = {i = 0xd92b18}
itmList = @0xaf5e50: {<QListSpecialMethods<QwtPlotItem*>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {_M_i = -1}, <No data fields>}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0xd92b00}, d = 0xd92b00}}
#10 0x00007fffea721e75 in QwtPlot::drawCanvas(QPainter*) (this=0x976300, painter=0x7fffffffb540) at ../../qwt-6.1/src/qwt_plot.cpp:755
maps = {{d_s1 = 9750, d_s2 = 10750, d_p1 = 713, d_p2 = 0, d_cnv = -0.71299999999999997, d_ts1 = 9750, d_transform = 0x0}, {d_s1 = -0.021730000153183937, d_s2 = 1.2283560037612915, d_p1 = 713, d_p2 = 0, d_cnv = -570.36075739376076, d_ts1 = -0.021730000153183937, d_transform = 0x0}, {d_s1 = 0, d_s2 = 500, d_p1 = 0, d_p2 = 1228, d_cnv = 2.456, d_ts1 = 0, d_transform = 0x0}, {d_s1 = 0, d_s2 = 1000, d_p1 = 0, d_p2 = 1228, d_cnv = 1.228, d_ts1 = 0, d_transform = 0x0}}
#11 0x00007fffea75176a in QwtPlotCanvas::drawCanvas(QPainter*, bool) (this=this@entry=0xa9ba40, painter=painter@entry=0x7fffffffb540, withBackground=withBackground@entry=false) at ../../qwt-6.1/src/qwt_plot_canvas.cpp:920
hackStyledBackground = <optimized out>
#12 0x00007fffea75398e in QwtPlotCanvas:aintEvent(QPaintEvent*) (this=0xa9ba40, event=<optimized out>) at ../../qwt-6.1/src/qwt_plot_canvas.cpp:761
p = {static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x7fffdddc5de0, data = 0x7fffdddc5d20, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0xea0290}}
bs = @0xa9b4b0: <incomplete type>
pixelRatio = <optimized out>
painter = {static staticMetaObject = {d = {superdata = 0x0, stringdata = 0x7fffdddc5de0, data = 0x7fffdddc5d20, static_metacall = 0x0, relatedMetaObjects = 0x0, extradata = 0x0}}, d_ptr = {d = 0xb81410}}