VSE: Faster processing of alpha-over strip at the bottom of strip stack #127310

Merged
Aras Pranckevicius merged 1 commits from aras_p/blender:vse_alphaover_at_bottom into main 2024-09-09 13:16:27 +02:00

When a strip with alpha-over blend mode (which is default) has an alpha
channel and is at the bottom of the whole stack, there's no point in
blending it with black color; the result will be identical.

So stop doing that. Also, whenever some other case happens at the bottom
of the stack (e.g. some other blend mode), create the fake "black input"
image at the needed color type (float or byte) and with the correct
color space already applied. Otherwise, especially for floats, VSE
spends much time converting this fake black input from byte to float,
and then converting it to sequencer color space.

Test case of two EXR files blended over each other, at 4K resolution,
on Ryzen 5950X (Win10/VS2022):

  • whole sequencer_preview_region_draw 115ms -> 75ms
  • seq_render_give_ibuf part: 64ms -> 24ms

i.e. this saves 40ms per frame, which was done but is not really needed:

  • allocate a 4K byte image,
  • clear it to black,
  • convert it to float,
  • convert that to linear space,
  • blend it with the bottom exr file,
  • free the black image.
When a strip with alpha-over blend mode (which is default) has an alpha channel and is at the bottom of the whole stack, there's no point in blending it with black color; the result will be identical. So stop doing that. Also, whenever some other case happens at the bottom of the stack (e.g. some other blend mode), create the fake "black input" image at the needed color type (float or byte) and with the correct color space already applied. Otherwise, especially for floats, VSE spends much time converting this fake black input from byte to float, and then converting it to sequencer color space. Test case of two EXR files blended over each other, at 4K resolution, on Ryzen 5950X (Win10/VS2022): - whole sequencer_preview_region_draw 115ms -> 75ms - seq_render_give_ibuf part: 64ms -> 24ms i.e. this **saves 40ms per frame**, which was done but is not really needed: - allocate a 4K byte image, - clear it to black, - convert it to float, - convert that to linear space, - blend it with the bottom exr file, - free the black image.
Aras Pranckevicius added 1 commit 2024-09-08 15:59:56 +02:00
VSE: Faster processing of alpha-over strip at the bottom of strip stack
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
978d065b6b
When a strip with alpha-over blend mode (which is default) has an alpha
channel and is at the bottom of the whole stack, there's no point in
blending it with black color; the result will be identical.

So stop doing that. Also, whenever some other case happens at the bottom
of the stack (e.g. some other blend mode), create the fake "black input"
image at the needed color type (float or byte) and with the correct
color space already applied. Otherwise, especially for floats, VSE
spends much time converting this fake black input from byte to float,
and then converting it to sequencer color space.

Test case of two EXR files blended over each other, at 4K resolution,
on Ryzen 5950X (Win10/VS2022):
- whole sequencer_preview_region_draw 115ms -> 75ms
- seq_render_give_ibuf part: 64ms -> 24ms

i.e. this saves 40ms per frame, which was:
- allocate a 4K byte image,
- clear it to black,
- convert it to float,
- convert that to linear space,
- blend it with the bottom exr file,
- free the black image.
Author
Member

@blender-bot build

@blender-bot build
Aras Pranckevicius requested review from Sergey Sharybin 2024-09-08 16:15:19 +02:00
Sergey Sharybin approved these changes 2024-09-09 12:41:16 +02:00
Aras Pranckevicius merged commit 5c259a1bae into main 2024-09-09 13:16:27 +02:00
Aras Pranckevicius deleted branch vse_alphaover_at_bottom 2024-09-09 13:16:30 +02:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Code Documentation
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
FBX
Interest
Freestyle
Interest
Geometry Nodes
Interest
glTF
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Viewport & EEVEE
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Asset System
Module
Core
Module
Development Management
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Module
Viewport & EEVEE
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Severity
High
Severity
Low
Severity
Normal
Severity
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#127310
No description provided.