Fix #124842: Prevent rounding errors from introducing black pixels in Translate #124928

Closed
Bill-Spitzak wants to merge 1 commits from Bill-Spitzak:translate into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
Contributor

Since translate only reads pixels inside the buffer, it is safe to treat Clip as
Extend.

IMHO the actual bug is in COM_MemoryBuffer. wrap_pixel() must treat Clip as Extend,
and code rearranged so calls to it are done after the clipping tests. For Nearest
sampling the sample must be less than -0.5 to produce black. For Bilinear sampling
samples between -1 and 0 must linearly interpolate between black and the edge pixel.

Since translate only reads pixels inside the buffer, it is safe to treat Clip as Extend. IMHO the actual bug is in COM_MemoryBuffer. wrap_pixel() must treat Clip as Extend, and code rearranged so calls to it are done after the clipping tests. For Nearest sampling the sample must be less than -0.5 to produce black. For Bilinear sampling samples between -1 and 0 must linearly interpolate between black and the edge pixel.
Bill-Spitzak requested review from Omar Emara 2024-07-17 22:32:57 +02:00
Bill-Spitzak changed title from Fix #1243549: Prevent rounding errors from introducing black pixels in Translate to Fix #124842: Prevent rounding errors from introducing black pixels in Translate 2024-07-17 22:34:19 +02:00
Bill-Spitzak force-pushed translate from eb690e0b53 to 3a9b68e034 2024-07-17 22:35:08 +02:00 Compare
Iliya Katushenock reviewed 2024-07-17 23:31:55 +02:00
@ -116,1 +116,4 @@
MemoryBufferExtend extend_x = x_extend_mode_;
if (extend_x == MemoryBufferExtend::Clip)
extend_x = MemoryBufferExtend::Extend;
https://developer.blender.org/docs/handbook/guidelines/c_cpp/#always-use-braces
Bill-Spitzak force-pushed translate from 3a9b68e034 to 6280f0f724 2024-07-17 23:48:58 +02:00 Compare
Member

This is not an acceptable workaround, because if wrapping is enabled, we will still get the transparent pixels.

This is not an acceptable workaround, because if wrapping is enabled, we will still get the transparent pixels.
Author
Contributor

It does not change the extend if wrapping is enabled.

However I think this does not work for non-integer translations. Going to test this now.

In my opinion the correct fix is to fix the CPU compositor sampling code. There is just some off-by-½ errors. Going to see if I can fix that instead.

It does not change the extend if wrapping is enabled. However I think this does not work for non-integer translations. Going to test this now. In my opinion the correct fix is to fix the CPU compositor sampling code. There is just some off-by-½ errors. Going to see if I can fix that instead.
Author
Contributor

This does not work for non-integer translations. Cancelling this pull request.

This does not work for non-integer translations. Cancelling this pull request.
Bill-Spitzak closed this pull request 2024-07-19 00:26:30 +02:00
Bill-Spitzak deleted branch translate 2024-07-19 00:27:12 +02:00

Pull request closed

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
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
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#124928
No description provided.