VSE: Delay conversion of color space until it is needed #119501

Open
opened 2024-03-15 10:58:56 +01:00 by Sergey Sharybin · 3 comments

The design of VSE is such that it performs color operations, effects, and such in a special color space, denoted by Sequencer color space in the scene's Color Management settings. This gives more natural control for color graders.

The way it is currently implemented in the sequencer is that all image buffers which go through the VSE are converted to the sequencer color space, even if no color grading, or cross-fade is used. It should be possible to do the conversion on-demand, when an image is accessed for modifier stack, or effect, or requires other color related processing.

From a quick test of rendering 250 Full-HD EXR frames into a movie file avoiding the extra color space conversion gives speedup of about ~23% (rendering such sequence went down from 9 to 7 seconds on M2 Ultra). tested by grabbing the Old Factory footage, and converting it to a sequence of EXR images (not sure it is crucial to have exactly this sequence, is just something I have on my drive for all sorts of tests).

It is not uncommon during production to have an edit which has opaque EXR images which then assembled into a version of final movie, relying on the View Transform to give decent look to the film. Having 23% speedup will help speeding up iteration over the movie edits.

The design of VSE is such that it performs color operations, effects, and such in a special color space, denoted by Sequencer color space in the scene's Color Management settings. This gives more natural control for color graders. The way it is currently implemented in the sequencer is that all image buffers which go through the VSE are converted to the sequencer color space, even if no color grading, or cross-fade is used. It should be possible to do the conversion on-demand, when an image is accessed for modifier stack, or effect, or requires other color related processing. From a quick test of rendering 250 Full-HD EXR frames into a movie file avoiding the extra color space conversion gives speedup of about ~23% (rendering such sequence went down from 9 to 7 seconds on M2 Ultra). tested by grabbing the [Old Factory](https://studio.blender.org/training/track-match-blend/56040f9b044a2a00ad6c660d/) footage, and converting it to a sequence of EXR images (not sure it is crucial to have exactly this sequence, is just something I have on my drive for all sorts of tests). It is not uncommon during production to have an edit which has opaque EXR images which then assembled into a version of final movie, relying on the View Transform to give decent look to the film. Having 23% speedup will help speeding up iteration over the movie edits.
Sergey Sharybin added the
Type
To Do
label 2024-03-15 10:58:56 +01:00
Sergey Sharybin added this to the Video Sequencer project 2024-03-15 10:58:58 +01:00

Just so that I understand what is going on:

Is is that today this would happen:
0. exr files are stored in linear space,

  1. sequencer loads them, converts from float linear -> float srgb (assuming vse colorspace is default "srgb") space,
  2. nothing interesting is done with the image, it is "just" displayed in a single image strip
  3. for rendering the final result out, float srgb image is first converted back to linear, and then converted into byte srgb.

And your proposed savings would be like:

  1. sequencer loads exr file, keeps it in float linear,
  2. for rendering the final result out, it already has float linear, and converts into byte srgb.
Just so that I understand what is going on: Is is that today this would happen: 0. exr files are stored in linear space, 1. sequencer loads them, converts from float linear -> float srgb (assuming vse colorspace is default "srgb") space, 2. nothing interesting is done with the image, it is "just" displayed in a single image strip 3. for rendering the final result out, float srgb image is first converted back to linear, and then converted into byte srgb. And your proposed savings would be like: 1. sequencer loads exr file, keeps it in float linear, 2. for rendering the final result out, it already has float linear, and converts into byte srgb.
Author
Owner

@aras_p Roughly, yes. At least I think it is a very good summary of the higher-level overview of what's going on. I should probably have left some pointers in the code which could be interesting:

  • SEQ_render_imbuf_from_sequencer_space
  • seq_imbuf_to_sequencer_space
  • seq_imbuf_assign_spaces

Making those no-op is what gave speedup in the example i've shown in the description.

@aras_p Roughly, yes. At least I think it is a very good summary of the higher-level overview of what's going on. I should probably have left some pointers in the code which could be interesting: - `SEQ_render_imbuf_from_sequencer_space` - `seq_imbuf_to_sequencer_space` - `seq_imbuf_assign_spaces` Making those no-op is what gave speedup in the example i've shown in the description.

I think this would make sense. Personally, I would implement this by moving responsibility of colorspace conversion to place, where some processing is being done. Most functions that try to do introspection whether something will be done with strip are not very nice to read.

I think this would make sense. Personally, I would implement this by moving responsibility of colorspace conversion to place, where some processing is being done. Most functions that try to do introspection whether something will be done with strip are not very nice to read.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
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, Assets & 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
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
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
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
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 Assignees
3 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#119501
No description provided.