Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Waveforms needs some optimization/caching #7084

Open
mixxxbot opened this issue Aug 22, 2022 · 8 comments
Open

Waveforms needs some optimization/caching #7084

mixxxbot opened this issue Aug 22, 2022 · 8 comments

Comments

@mixxxbot
Copy link
Collaborator

Reported by: xorik
Date: 2013-06-25T11:38:11Z
Status: Confirmed
Importance: Wishlist
Launchpad Issue: lp1194456
Tags: waveform


Hi all!

I think mixxx need to optimize waveform display code, beacuse it uses many percents of CPU at now.
I have Intel(R) Celeron(R) CPU E3400 @ 2.60GHz GenuineIntel and x86_64 gentoo linux. I'm use "top" in terminal for measuring CPU percents.

I load 2 tracks into decks and paused them and set waveform FPS limit to 30
Empty waveform: 18% CPU
Filtered - Qt: 57% CPU
HSV: 45% CPU

If I increase FPS limit, the numbers will be much bigger (70-80% CPU for HSV and filtered waveform).
I think this is because of many calculations, while drawing waveform, without caching. I thing caching isn't hard to code, but saves many CPU percents (and battery life) when mixing.

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2013-06-25T12:44:38Z


I agree that there is much space for Improvements. But I do not agree that caching isn't hard to code.

We have already a blueprint for this.
https://blueprints.launchpad.net/mixxx/+spec/tiling-waveform

If you want to adopt parts of this issue, a first step is to create a new page at www.mixxx.org/wiki link it to the blueprint and outline your ideas there.

I have currently a waveform dejerk branch in progress with also some CPU savings.

Filtered Qt and HSV are not well optimized. What are your results of the GL waveforms?

An other first step: you could make a pure GL HSV version.

@mixxxbot
Copy link
Collaborator Author

Commented by: xorik
Date: 2013-06-25T13:00:30Z


Other waveforms is ~20-40% of my CPU on 30 FPS.

you could make a pure GL HSV version
I think MOST part of CPU using not for the drawing, but for the calculations (it is easy to check, just comment the drawing code and compare CPU usage).

I think we can create arrays in memory for needed song parts (which visible in this moment) e.g. each array contain 1second of song's waveform data. Is song is paused, we don't need to do the calculations, but if song is playing, we will be calculate every 1 second of song, when we need. I think this saves big amount of CPU%.

What you think about this?

@mixxxbot
Copy link
Collaborator Author

Commented by: xorik
Date: 2013-06-25T13:01:54Z


sorry, i mean "If song is paused", not "is"

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2013-06-25T13:39:53Z


I think MOST part of CPU using not for the drawing, but for the calculations (it is easy to check, just comment the drawing code and compare CPU usage).

Can't believe, have you mad the posit check, just comment the calculation code?

We have also a nice benchmark feature in Mixxx.
If you start Mixxx with --developer, you can use ScopedTimer in src/util/timer.h for measurements.

Your idea is not bad, but I would prefer a balanced CPU solution where only the part is calculated or redawn, that is new for every frame.

@mixxxbot
Copy link
Collaborator Author

Commented by: rryan
Date: 2013-06-25T13:38:22Z


Hey Xorik,

In fact, it's the opposite! We pre-calculate the entire waveform during
analysis. All of the CPU usage you are seeing is from the drawing code.
(There is some glue code that helps the drawing figure out what to draw,
though).

On Tue, Jun 25, 2013 at 9:00 AM, xorik wrote:

Other waveforms is ~20-40% of my CPU on 30 FPS.

you could make a pure GL HSV version
I think MOST part of CPU using not for the drawing, but for the
calculations (it is easy to check, just comment the drawing code and
compare CPU usage).

I think we can create arrays in memory for needed song parts (which
visible in this moment) e.g. each array contain 1second of song's
waveform data. Is song is paused, we don't need to do the calculations,
but if song is playing, we will be calculate every 1 second of song,
when we need. I think this saves big amount of CPU%.

What you think about this?

--
You received this bug notification because you are a member of Mixxx
Development Team, which is subscribed to Mixxx.
https://bugs.launchpad.net/bugs/1194456

Title:
Waveforms needs some optimization/caching

To manage notifications about this bug go to:
https://bugs.launchpad.net/mixxx/+bug/1194456/+subscriptions

@mixxxbot
Copy link
Collaborator Author

Commented by: xorik
Date: 2013-06-25T13:56:03Z


Hmmm... ok, I will try to test calculation and draw time soon...

@mixxxbot
Copy link
Collaborator Author

Commented by: xorik
Date: 2013-06-28T10:08:51Z


You was right! Drawing is used most part of CPU, not calculations :)

But why "simple - GL" waveform is used 22 percent, and "filtered - GL" is 65 percent CPU?
Why so big difference?

@mixxxbot
Copy link
Collaborator Author

Commented by: esbrandt
Date: 2014-01-05T17:45:11Z


I found that "filtered - GL" wasted much time during color conversation from HSL to RGB, if the selected skin.xml does not provide a color for <SignalHighColor>, <SignalMidColor>,  <SignalLowColor> ) like in Deere & Latenight skins.

In waveformsignalcolor.cpp, the fallBackFromSignalColor uses the HSL color space, which is converted to RGB in glwaveformrendererfilteredsignal.cpp .

@mixxxbot mixxxbot transferred this issue from another repository Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant