Bug 435716 - Flattening animated layer with Transform mask is resource intensive
Summary: Flattening animated layer with Transform mask is resource intensive
Status: CONFIRMED
Alias: None
Product: krita
Classification: Applications
Component: Animation (show other bugs)
Version: git master (please specify the git hash!)
Platform: Manjaro Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 438547 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-14 09:26 UTC by Vladimir Savic
Modified: 2022-07-01 01:50 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Savic 2021-04-14 09:26:08 UTC
SUMMARY

I have to write disclaimer first: it might be a feature request or a bug report, depends on how you look at it. Skipping to the next section, and then write my comments and a possible workaround.

Prerequisites: already existing animation (made in Krita preferably 🙂) with a "bigger" resolution (in my case 2048×1080px) and newer version of software that can animate Transform mask.

STEPS TO REPRODUCE
1. Import animation frames (~400) as animated layer
2. Add Transform mask
3. Simulate exaggerated camera zoom effect using Transform mask (let's say, from original size to 400% enlargement) on whole span of animation

OBSERVED RESULTS
Good: cache generated at reasonable speed and therefore playback works as expected
Bad: try flattening the layer (apply Transform mask); I was almost certain that Krita died and that it got stuck at "flattening layer: 0%" message at status bar. When asking for directions on IRC, after about an hour later, I eventually hit 1%.
Ugly: the "workaround" - hide everything, except the layer of interest for the case, render anim as frame-images and reimport the resulting frame array in place of original pixel layer and it's Transform mask.


EXPECTED RESULT
Somehow faster flattening operation. I suspect the problem is, at least partially, that "zoomed in" layer hast a lot of pixel data outside of the image boundary. If that's the case, can Krita ask the user if cropping should appear?

Btw, operation was cancelable, but it lasted at least so long to cancel as it did to calculate to that 1%.
Comment 1 Eoin O'Neill 2021-05-27 00:39:53 UTC
Hi Vladimir,

There have been some changes to the transform mask on master that may have changed this merge request. Could you check again if you have the time?

We had some recursion / infinite loop issues in the rendering task that needed to be sorted out. They've been resolved now, thanks to dmitry, but I would like more people to try it out. I seemed to have better performance on some of my animation test files.

Thanks for reporting this bug!
Comment 2 Vladimir Savic 2021-05-27 09:12:56 UTC
Hi Eoin,

It's better but unfortunately still crawling. Where can I send you a test file privately (it contains an animation from an upcoming movie, therefore I'm not allowed to share it publicly, yet)? I can also find you on IRC, just give me a nick, please if that method would work for you.

Thanks for all the invested time,
Vladimir
Comment 3 Eoin O'Neill 2021-06-02 02:24:04 UTC
I'll continue to look into it.

I think the main difference is that each frame needs to be threaded separately, if possible. That might be a rather large change with the way the flatten layer pipeline works right now, but it should be possible without too much source code changes (I think). :)
Comment 4 Vladimir Savic 2021-06-02 10:25:32 UTC
Thanks for still looking into it! ;)

If you still need a reliable test case, my offer stays open.
Comment 5 Eoin O'Neill 2021-06-15 01:36:50 UTC
*** Bug 438547 has been marked as a duplicate of this bug. ***
Comment 6 kousakiaya 2022-07-01 01:50:05 UTC
Can be reproduced with a much lower resolution(1080p animation sequence).
I can provide a sample file, but it is too large for the attachment limitation.

You can reproduce it with:
1. Import some sequence (from Blender Render output, for example)
2. Create a Transform mask for that layer
3. Flatten it, observe the time used in this operation

The op is using a layer with 400 frames,
mine is just 32 / 72 frames.