-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[Follow up] Improve performance when rendering sample waveforms #7695
base: master
Are you sure you want to change the base?
Conversation
…ix lag on AutomationEditor
I also noticed there's some unfinished business I have with the draw and generation code possibly. I want to follow up with that too in this PR if that's okay with you. |
Ye sure @sakertooth Btw there are some changes regarding the VisualizeParameters so check that out first |
Glad to see this! @khoidauminh, could you load any samples with a low pitch (kicks, toms, basses, etc) and zoom in on the waveform? I tried this in OFP and it generates a fill on the part of the waveform below 0! Must've missed checking short samples in my testing, as I was so focused on long ones! 🤣 |
@bratpeki I think I know what the issue is. Originally the Peak struct min and max default values are +infinity and -infinity respectively But in a commit it was changed to +infinity and 0 (::max() and ::min() in source code), so max gets stuck at 0 when the waveform sits below 0, making a fill Simply change the min() back to -max() and it's all good (currently away from laptop so can't do yet) |
|
We might want to use |
After that fix has been applied, is this ready for testing? I view it as an extension of 7366, so it only makes sense to take a look at it as well. |
…of Peaks respectively
Hi @bratpeki and @khoidauminh, I pushed a change that uses If you need my assistance with anything though let me know. Feel free to test the new commits @bratpeki. |
Is it just me or the |
Alright! |
You also have to consider that caches are generally small to avoid keeping unnecessary, unwanted data, keeping it "hot" basically. Too big of a size and you run the risk of increasing the memory usage, even when in some cases evicting a thumbnail to store a new fresh one is better than keeping the old one around. That being said, I'm more than happy to help come up with a better size that will better fit the average workload and system. If we have more than 32 thumbnails, there are two things that can happen if another thumbnail is requested to be generated: one is a cache miss if the thumbnail is not cached, the other a cache hit if it is. The cache will only keep regenerating new thumbnails if every request for a new thumbnail after meeting that size limit wasn't cached. Sidebar: We might also want to consider renaming |
Ideally, this idea will be extended to all resources, like sample resources and thumbnail resources, and maybe more (essentially anything that is costly to regenerate and store a lot of all at once is a resource). |
@sakertooth Looking at the code, from my understanding, when the cache gets full, the unused thumbnails will be destroyed, but the least still used thumbnails will be detached instead. Existing clips will hold on to this detached cache until all of them are destroyed. So I'm guessing it's not as bad as I'm concerned. All good then |
I guess it should be using an LRU eviction policy actually. I wont stop you from making changes, but there are plans to overhaul resource management in the future anyways as mentioned. Maybe since its really needed I might start work on it soon. |
This PR adds additional changes on top of #7366:
Details
In the old code, `m_paintPixmap` in `SampleClipView` is allocated to the size of the whole clip, and painted at (0, 0) no matter what. On large samples, when the width exceeds 32768 (QPixmap's resolution limit), garbage data will be shown.In this PR,
m_paintPixmap
is allocated to the paintEvent's size (but with the clip's height), and painted onto the clip at the paintEvent's X coordinate. To make sure the m_paintPixmap doesn't get drawn on the wrong coordinate (due to something overlaying the clip and changing the paintEvent region), we paint on the coordinate obtained from the last full redraw.This change allows some fields of VisualizeParameters to be omitted (drawRect).
Fixes lagging in Automation Editor by specifying the viewportRect.
Simplify and enhance the implementation.
Should resolve the sample clips part of #3378