Results 1 to 17 of 17

Thread: spectrogram questions

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: spectrogram questions

    The "rasterview" example crashes when ...
    ... reaching a image width or height of 1, leading to an invalid map that devides by 0. Fixed in all branches >= 6.1
    Where can I do that ?.
    https://sourceforge.net/p/qwt/bugs.

    Uwe

  2. #2
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: spectrogram questions

    The issue is already posted here : https://sourceforge.net/p/qwt/bugs/272/

    Otherwise, I'm still curious why is there a segfault whereas the read bounds are correct (existential question) ???!!!???

    Fixed in all branches >= 6.1
    Are you sure, I'm having crashes with Qwt 6.1
    Last edited by embeddedmz; 11th July 2019 at 09:40.

  3. #3
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: spectrogram questions

    Quote Originally Posted by embeddedmz View Post
    Are you sure, I'm having crashes with Qwt 6.1
    With this one ?
    Qt Code:
    1. svn export https://svn.code.sf.net/p/qwt/code/branches/qwt-6.1
    To copy to clipboard, switch view to plain text mode 
    Uwe

  4. #4
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: spectrogram questions

    Hi Uwe,

    No crash with this one.

    So, what is the recommended branch (link please) should I use (We package Qwt in a RPM file, especially for Centos 7. Sadly, for the machine running Ubuntu, the package downloaded with apt is not patched).

    UPDATE:
    I will need the 6.2 version as it contains the features you described in your first reply.
    Last edited by embeddedmz; 11th July 2019 at 16:32.

  5. #5
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: spectrogram questions

    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}}

  6. #6
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: spectrogram questions

    I tried changing the format from RGB to Indexed and the replot crashes only...
    I can see a call stack of an application ( Qwt 6.1 ) that is somewhere inside of the Qt raster paint engine ?
    Like always: use your debugger/sanitizer and/or come up with a small demo code showing the problem.

    When using qmake use:

    CONFIG += sanitizer
    CONFIG += sanitize_address

    otherwise have a look at -fsanitize... in the gcc/clang docs.

    Uwe

    PS1: doing bilinear interpolation is more expensive, than what you get from using a color table
    PS2: Please allow me not respond to questions, where I have nothing to add to what I already wrote before

  7. The following user says thank you to Uwe for this useful post:

    embeddedmz (12th July 2019)

  8. #7
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: spectrogram questions

    Hi Uwe,

    You can easily reproduce the crash with the "rasterview" example, the binary will crash at startup :

    Qt Code:
    1. class ColorMap: public QwtLinearColorMap
    2. {
    3. public:
    4. ColorMap():
    5. QwtLinearColorMap(Qt::darkBlue, Qt::darkRed, QwtColorMap::Indexed) // <=== add this
    6. {
    7. addColorStop( 0.2, Qt::blue );
    8. addColorStop( 0.4, Qt::cyan );
    9. addColorStop( 0.6, Qt::yellow );
    10. addColorStop( 0.8, Qt::red );
    11. }
    12. };
    To copy to clipboard, switch view to plain text mode 

    The 6.2 is in beta right ? is it right to use it in production ?

  9. #8
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: spectrogram questions

    Quote Originally Posted by embeddedmz View Post
    You can easily reproduce the crash with the "rasterview" example, the binary will crash at startup
    Indeed the raster paint engine is running on a nullptr for the color map of the backing store of the canvas. It happens in convertIndexedToARGB32PM painting/qdrawhelper.cpp.
    Seems like there is a bug, when drawing an Indexed8 QImage to a QPixmap. But as this does not happen with the spectrogram example it needs more investigation, what additional side effects are relevant here.

    Like expected the problem does not happen, when using the X11 paint engine, that has been reintroduced with Qt 5.10. Using the X11 paint engine is recommended for all type of vector data ( curves ) as it makes use of hardware acceleration - in opposite to the raster paint engine, that is a pure software renderer. X11 can be enabled with "export QT_XCB_NATIVE_PAINTING=1" ( or "export QT_GRAPHICSSYSTEM=native" with Qt4 ).

    Using X11 for a spectrogram ( or other raster data ) does not make the same difference as for vector data, beside you are running remote X11.
    Note, that using setMaxRGBTableSize is not affected by this problem, as it does not create a Indexed8 image.

    But anyway - there is a crash in the raster paint engine, that needs to understood. Maybe I can find a workaround and/or create a bug report for Qt, but it is kind of random when Qt development does fixes.

    Uwe

  10. The following user says thank you to Uwe for this useful post:

    embeddedmz (12th July 2019)

  11. #9
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: spectrogram questions

    I set DEBUG_RENDER to 1 and compiled/tested Qwt in debug and release mode but qDebug won't work ! any idea how to fix that ? (the stuff in StackOverflow is outdated...) I could change qDebug by std::cout, but I want to know why this kind of stuff doesn't work when needed
    Last edited by embeddedmz; 15th July 2019 at 10:44.

  12. #10
    Join Date
    Feb 2006
    Location
    Munich, Germany
    Posts
    3,313
    Thanked 879 Times in 827 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: spectrogram questions

    Quote Originally Posted by Uwe View Post
    But anyway - there is a crash in the raster paint engine, that needs to understood.
    Bug is understood now and a fix/workaround has been added to all versions of Qwt >= 6.1

    Uwe

  13. #11
    Join Date
    Jun 2019
    Location
    France, Pau
    Posts
    60
    Thanks
    32
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: spectrogram questions

    Cool are the bugfixes included in the qwt downloaded via :

    Qt Code:
    1. svn export svn://svn.code.sf.net/p/qwt/code/branches/qwt-6.1
    To copy to clipboard, switch view to plain text mode 

    ?

Similar Threads

  1. QWT Spectrogram
    By iamzen in forum Qwt
    Replies: 2
    Last Post: 29th March 2012, 20:31
  2. How to use QWT spectrogram in QML
    By jg in forum Qt Quick
    Replies: 1
    Last Post: 20th May 2011, 09:07
  3. Spectrogram
    By Ronayn in forum Qwt
    Replies: 4
    Last Post: 25th April 2011, 20:14
  4. get min and max value from spectrogram
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 2nd December 2009, 14:25
  5. qwt spectrogram example
    By rambo83 in forum Qwt
    Replies: 2
    Last Post: 17th November 2009, 21:13

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.