Results 1 to 11 of 11

Thread: Slow plotting of spectrogram

Hybrid View

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

    Default Re: Slow plotting of spectrogram

    Quote Originally Posted by Anton1 View Post
    Is it possible to do not lose these single maximums on the spectrogram?
    This is a problem of the nearest neighbor resampling. It is very fast, but of course might miss peaks.

    QwtPlotMatrixData offers another resampling algo - interpolating between the samples - but it might be too expensive for your use case and you lose the pixel hint optimization. Guess you need to find your own strategy, but in any case you would have to overload:

    Qt Code:
    1. virtual double QwtRasterData::value( double x, double y );
    To copy to clipboard, switch view to plain text mode 

    But be careful: this method is called for each pixel of the image. Doing expensive operations here will slow down the image composition.

    Uwe

  2. #2
    Join Date
    Aug 2016
    Posts
    6
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Slow plotting of spectrogram

    Hello!

    After I changed the display to the one with higher resolution (1920 Ñ… 1080) the spectrogram slowed down.

    So now I'd like to return to the approach you suggesed erlier "Incremental image composition". Do I understand it right that it is possible to plot only part of the spectrogram OR to add data to the spectrogram?

    I looked at the topic "Incremental Spectrogram".
    I do not understand how to properly reimplement method QwtPlotSpectrogram::renderImage.

    For example, I have a spectrogram, filling from left to right by columns. I want to render only new part of the picture (Today for display I use overloading method QwtRasterData::value and replot all picture).
    1. What triggers the method QwtPlotSpectrogram::renderImage? Repaint, replot etc.? Or do I need to call it myself?
    2. How to set the return value in an overloaded method?
    3. Do I need an analog for method QwtRasterData::value,that i used when call replot?
    4. Can you provide a brief description of how to make incremental spectrogram data plotting?

    Thank you in advance.

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

    Default Re: Slow plotting of spectrogram

    The very first thing I recommend to do is - again - enable DEBUG_RENDER in qwt_plot_spectrogram.cpp and check the time needed for your image composition.
    What type of values have been reported ( of course in release mode ) ?

    Uwe

  4. #4
    Join Date
    Aug 2016
    Posts
    6
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Slow plotting of spectrogram

    I set enable DEBUG_RENDER in qwt_plot_spectrogram.cpp.
    If the spectrogram takes nearly full screen, there is the following result - renderImage QSize(1818, 909) 179
    If the spectrogram takes small part of screen, there is the following result - renderImage QSize(705, 80) 11
    Initial screen resolution is 1920x1080. The data size exceeds the size of the spectrogram.
    Can you say what should be done?
    Thank you in advance.

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

    Default Re: Slow plotting of spectrogram

    Quote Originally Posted by Anton1 View Post
    QSize(1818, 909) 179
    QSize(705, 80) 11
    With the spectrogram example I can see on my box ( i7-3770T CPU @ 2.50GHz with 4 cores ) values like:


    • QSize(484, 343) 3
    • QSize(1804, 1075) 27


    As my system is far away from being a burner I guess we are talking about some slow embedded device on your side ?
    To compare the systems: could you check the numbers of the spectrogram example on your box ?

    --

    Concerning the "Incremental image composition":

    Qt Code:
    1. class YourSpectrogram: public QwtPlotSpectrogram
    2. {
    3. ....
    4.  
    5. protected:
    6. virtual QImage renderImage(
    7. const QwtScaleMap &xMap, const QwtScaleMap &yMap,
    8. const QRectF &area, const QSize &imageSize ) const override
    9. {
    10. if ( m_image.isNull() )
    11. {
    12. m_image = QwtPlotSpectrogram::renderImage(
    13. xMap, yMap, area, imageSize );
    14. }
    15. else
    16. {
    17. // find the new area, not being part of the previous image
    18. // and the width/height in pixels
    19.  
    20. subArea = ...;
    21. subImageSize = ...
    22.  
    23. QImage subImage = QwtPlotSpectrogram::renderImage(
    24. xMap, yMap, subArea, subImageSize );
    25.  
    26. // shift the pixels in m_image and copy in those from subImage
    27. m_image = ...
    28. }
    29.  
    30. return m_image;
    31. }
    32.  
    33. private:
    34. QImage m_image;
    35. };
    To copy to clipboard, switch view to plain text mode 
    HTH,
    Uwe

    PS: if you have a good example for a waterfall plot that could be used as an example ( no huge data files ) you could send me your slow implementation. I would do the optimized implementation then.

  6. #6
    Join Date
    Aug 2016
    Posts
    6
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Slow plotting of spectrogram

    Hello Uwe!
    In the spectrogram example I see values like: renderImage QSize(1745, 910) 36.
    My computer have parameters i7-3770 CPU @ 3.40GHz with 4 cores.
    I'm working on a model for a waterfall plot, I think that I can send it to you early next week.
    Thank you in advance.

  7. #7
    Join Date
    Aug 2016
    Posts
    6
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Slow plotting of spectrogram

    Good day, Uwe.
    I've done program that could be an example after some changes.
    I give a link to the archive: https://cloud.mail.ru/public/LPcx/a7VbvrFGx
    Now the program is running slowly, but I hope that it is possible to optimize.
    Thank you in advance.

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

    Default Re: Slow plotting of spectrogram

    Not sure what this tarball is supposed to be - looks like some downstripped version of your application, but without doing anything. To be honest I was interested in some simple data factory, that can be used for a waterfall plot - and this part is unfortunately missing.

    But at least it shows the implementation of your SpectrogramData::value(), that explains why you have a worse image composition performance than the spectrogram example. Regardless of any further optimization I recommend to speed this one up. As it is called for every pixel it is worth to spend some time on writing it in a performant way.

    Uwe

Similar Threads

  1. MINI2440 ARM9, QGraphicsView Plotting slow
    By abhinit in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 28th April 2011, 14:25
  2. Spectrogram
    By Ronayn in forum Qwt
    Replies: 4
    Last Post: 25th April 2011, 20:14
  3. get min and max value from spectrogram
    By rambo83 in forum Qwt
    Replies: 1
    Last Post: 2nd December 2009, 14:25
  4. qwt spectrogram example
    By rambo83 in forum Qwt
    Replies: 2
    Last Post: 17th November 2009, 21:13
  5. Spectrogram too slow
    By a_kaa in forum Qwt
    Replies: 2
    Last Post: 9th January 2009, 16:57

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
  •  
Qt is a trademark of The Qt Company.