VSE: bilinear upscaling no longer adds transparent border around the image #117717
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
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#117717
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "aras_p/blender:vse_filter_aa"
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?
Part of overall "improve image filtering situation" (#116980), this PR addresses two issues:
As to why that happens, no one remembers the reasons. Ever since low level "bilinear/bicubic" interpolation functions were added back in 2007 (
9298357670
), they had different behavior in how a pixel that is right on the edge of an image is treated: bilinear was blending in transparent black, whereas bicubic was clamping samples to the image edge.So what we do here is:
IMB_transform
).border
to their names to make it clear that they treat image as if it had a transparent black border around it. The old functions are still used in CPU compositor and a handful other places.IMB_transform
, i.e. walk over the pixels right at the edges and adjust their transparency based on approximate coverage. This does not affect things that are not rotated and placed at non-fractional pixel positions. This is not correct coverage calculation, but is fast and quite simple (doing fully correct anti-aliased raster seems to be quite involved, judging by amount of code Skia has for it).Here's throwing in an image into a VSE that is 6x larger resolution: note that black outline appears around the edges.
And here's the same with this PR:
And here's a more synthetic test that shows image upscaled in several ways, Bilinear on the left side, Cubic on the right side. Current main branch:
And with this PR: note that edge anti-aliasing is consistent between bilinear and cubic (whereas before "too much fading" was in bilinear case, and no anti-aliasing at all in cubic case). The gap between rotated but neighboring strips (top left) is much smaller too.
Note: buildbot will be failing compositor render tests (that I have very recently added), as expected. The images need to be updated together with merging of this PR.
WIP: VSE: bilinear no longer adds an edge of transparency, instead all filters anti-alias one pixel edgeto WIP: VSE: bilinear upscaling no longer adds transparent border around the image@blender-bot build
WIP: VSE: bilinear upscaling no longer adds transparent border around the imageto VSE: bilinear upscaling no longer adds transparent border around the imageThis seems to be giving results closer what one would expect on user level!
Did you check if it has any measurable impact on the render time of VSE edits you have?
It does not. Both forms of bilinear sampling are pretty much the same performance, and the "walk 4 edges of lines for AA" is peanuts compared to everything else. And also I skip walking said lines if they are completely horizontal or vertical and placed at integer pixel positions (i.e. would not alter the edge at all), which for the edit data sets I have happens "all the time" since nothing is rotated.
@ -70,1 +74,4 @@
BLI_INLINE __m128i min_i_simd(__m128i a, __m128i b)
{
# if defined(__SSE4_1__) || defined(__ARM_NEON) && defined(WITH_SSE2NEON)
This check is coming from some older code, but it seems to be spreading out in a lot of other cases. The confusing part of it is the order of operations. Can we make them explicit, like
defined(__SSE4_1__) || (defined(__ARM_NEON) && defined(WITH_SSE2NEON))
?Added
BLI_HAVE_SSE4
toBLI_simd.h
and use that.@ -362,0 +439,4 @@
}
}
}
else {
ImBuf
can have both float and byte buffers. The commonly typical approach in the ImBuf's transfomration is to handle both cases:Hmm, a lot of existing code (at least within sequencer/transform) have different logic, i.e. it does "float buffer exists? do that, otehrwise do this". Or, put it different way, pretty much none of the code within sequencer is prepared to work with images that have both byte and float buffers.
Sequencer will do that because it has some strong opinion on what the source of truth of pixels is, and will ensure that the result does not have both float and byte buffers in an inconsistent states. Generic transform code in
ImBuf
does not know what the caller will consider that source of truth, so it applies transform on both buffers.Some recent additions to the
ImBuf
seems to diverge from this, but I do not think it is that great of idea. It just leads to a silent inconsistency, which is likely to case problems later on. What is even more sad is that some of those additions will modify float buffer, and will not even tag byte buffer as dirty (it probably still would lead to incorrect result somewhere, but at least you'd have an indication that something is in fact out of date). If we say only one of those buffers can exist, then it needs to become a part of overall design.Ah ok! Makes sense, will do.