Commit Graph

26 Commits

Author SHA1 Message Date
Andrew Reading f59c9f4b2b Rewrite the Block Analyzer to improve performance.
The block analyzer was doing lots of repeated, out-of-order blits to the
widget's canvas. To improve performance and reduce CPU usage, this has
been rewritten to generate the canvas contents using only a single buffer.
Cache thrashing has been greatly reduced by writing to memory only
sequentially and in one single write pass. Further, the raw format is
now guaranteed to be in a format efficient for Qt.

The results are visually identical to what they were previously, but
result in a CPU usage reduction between 2 and 6 percent depending on refresh
rate and Psychadelic Mode value. In particular, there used to be a ~3 percent
overhead for Psychadelic Mode, and this has been eliminated.

The specific details of the block analyzer and explanations for how it works
(and used to work) have been documented via fairly extensive comments
in blockanalyzer.cpp.
2022-09-01 19:36:03 +01:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Jonas Kvinge 28bbb74c26 Replace use of QColor::dark with QColor::darker 2020-01-04 23:00:40 +01:00
luz.paz fb93ae4b02 Fix misc. source comment typos
Typos found via `codespell`
2019-08-21 23:43:16 -04:00
Santiago Gil 0b34586e52 Fix some warnings shown on start-up (#5679)
* Fix 'RGB parameters out of range' with psychedelic colors

* Fix 'edit-find' icon name

* BlockAnalyzer::drawBackground(): do not attempt to paint on a null background

* Use qBound()
2017-03-27 12:57:24 +01:00
santigl 6c9bc43bbb Refactor analyzers for new FHT modifications. Use QVectors where possible. Make readability changes in the code. 2017-03-13 18:56:37 +00:00
Mark Furneaux c102bf7fe6 Add "Psychedelic Colour" mode to all analyzers
(Well, except Nyanalyzer and Rainbow dash because they are already colourful enough.)

I have added functionality for any 2D analyzer to change any part of its colour palatte with the frequency content of the music, in the same way that Moodbars do.
I find this gives the analyzer a sort of "third dimention".
This is built into Analyzer::Base, so all analyzers can use it and override it as they please. I have thus added support for Block, Boom, Turbine, Sonogram, and Bar, however Boom and Block seem to look the best in my opinion.
This is of course all optional and is toggled by a checkbox in the context menu for the analyzer, disabled by default.
I have not been able to measure any increase in CPU activity with this enabled, even at 60fps.
2015-07-01 11:48:03 -04:00
Mark Furneaux 36d885b73d Bound the Block Analyzer's column count
As it stands, the block analyzer just chops off columns to the right if the window is too small and always internally runs off 256 columns. Since the analyzer is bounded to 256 colums, this qMax bound is totally pointless.
It also makes the demo asymmetrical which trips up my OCD whenever Clementine is idling...
2015-06-20 00:09:38 -04:00
Krzysztof Sobiecki 1cbe135a8d Fix some errors in src/analyzers introduced while fixing cpplint.py errors 2014-11-29 21:05:59 +01:00
Krzysztof Sobiecki dc669eb603 Fix cpplint.py errors, fix copyright notices in src/analyzers, move src/core/fht* to src/analyzers 2014-11-29 20:07:01 +01:00
Mark Furneaux 542dbe8d12 Make framerate notification less nasty
Now uses a virtual function in Analyser::Base to notify any
analyser which whishes to listen
2014-05-13 16:43:46 -04:00
Mark Furneaux 6a882370a6 Fix block analyzer framerate
Block analyzer uses an internal variable m_step to determine how
long to hold a bar up. This is dependant on framerate, however it is
only set on creation or resize of the analyzer. This patch changes
this value whenever the framerate is changed, preventing the analyzer
from appearing wildly fast or extremely slow until a restart.
2014-05-12 18:15:00 -04:00
Mark Furneaux 7d3d0f04cf Fix analyzer framerate when mouseover play scrubber
This patch prevents the framerate of all analyzers from
increasing beyond the framerate set in the interface at all times.
It however will allow the analyser to redraw as often as required
to prevent artifacting when the play scrubber is drawn in front.
2014-04-27 01:54:42 -04:00
Krzysztof A. Sobiecki 0ecf1e76a6 Reformat done with clang-3.5 svn200967 2014-02-07 17:08:31 +01:00
John Maguire bebd781fdf Reformat all non-3rd-party C/C++/Objective-C++.
Command line:
find src ext -regex '.*\.\(h\|cpp\|mm\)' -exec clang-format -i
 -style='{BasedOnStyle: Google, DerivePointerBinding: false}' {} \;
2014-02-07 16:34:20 +01:00
John Maguire 5280038f9a Remove unused debug #define. 2012-06-18 13:56:56 +02:00
David Sansome aa20b6b3e2 Don't shift the rainbow data along when the widget is being repainted as a result of an expose event 2011-06-23 20:36:14 +00:00
John Maguire c801ce1a2d Rollback analyzer changes. 2010-08-28 18:48:16 +00:00
John Maguire 9ca0870268 Fix slowdown of block analyzer. 2010-08-18 18:40:52 +00:00
John Maguire 459a134201 Remove FHT and use gstreamer's FFT for all analyzers. 2010-08-18 18:21:30 +00:00
David Sansome 124ca3fe64 Lock all analyzers to 25fps, should reduce CPU usage quite a bit 2010-04-19 14:24:11 +00:00
David Sansome ad3c77cb5a Fix compilation errors on ubuntu 2010-03-22 13:49:08 +00:00
David Sansome a2c5bebd25 Remove unused includes. Fixes issue #84 2010-03-21 18:13:22 +00:00
David Sansome 530d58b4cf Add some more strings for translation 2010-03-21 15:00:36 +00:00
David Sansome e1c44cdc77 Add options for choosing or disabling the analyzer.
Fixes issue #75.
2010-03-20 22:45:54 +00:00
David Sansome 5b0496bf8f Move everything to trunk 2009-12-24 19:16:07 +00:00