Compositor: implement bicubic interpolation for Stabilize2DNode #122288
No reviewers
Labels
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
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
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
Core
Module
Development Management
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
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#122288
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "zazizizou/blender:fix-bicubic-interp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This patch also fixes a crash when image input of
Stabilize2DNode
is unconnected and interpolation is set to bicubic.Differences to GPU compositor:
Todos:
Didn't a similar change introduce bad results according to a past bug report? (I can't find it right now)
Do you remember that report?
@ -291,2 +291,2 @@
math::interpolate_cubic_bspline_fl(
buffer_, out, this->get_width(), this->get_height(), num_channels_, x, y);
if (is_a_single_elem_) {
memcpy(out, buffer_, get_elem_bytes_len());
This probably won't be optimized away by the compiler, so I would rather hard code it using a switch case or something.
This is the same way
read_elem_bilinear()
is implemented. I'll see if there is a better way.From a quick test, the following code slows down Stabilize 2D Node from 220ms to 280ms (disconnected image input) and translate node (image input disconnected, X input connected to image) from 1ms to 20ms on a 8000x4000 image:
So hardcoding doesn't seem faster. Or did you have something else in mind?
Also, I think these are rather exotic cases, in most cases the code inside
if (is_a_single_elem_)
will either get called once (unconnected node) or not at all (node connected to valid input). So I suggest to keep it simple and usememcpy()
That doesn't make sense, see: https://quick-bench.com/q/cgUMr8uXSU4PxLbwjiGohYnzImg.
But since this is copied from similar code, we can look into it later.
My tests only include the case where
datatype_ == Color
and the value to be copied is always the same. Fornumber_of_elements = 4
results look different: https://quick-bench.com/q/FV5Ai_bHNldJ6aw3kLZKEBpWWPU@zazizizou Well the benchmark is not very useful when you set number_of_elements to 4 in the source, because the compiler will detect that and remove the memcpy call entirely. While this is not known at compile time in real world cases.
Ah yes true. It's still not completely random though and that might play a role.
@blender-bot build
Yes, a previous patch for translate node introduced this bug: #121436.
The difference now is the argument
get_relative_x(x)
is given to the functioninterpolate_cubic_bspline_fl()
instead of justx
. So this is the proper fix for the bug above.@blender-bot build