Fix #124842: Fix CPU compositor sampling errors and make it match GPU #125149

Closed
Bill-Spitzak wants to merge 6 commits from Bill-Spitzak:resolveshift into main

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

Fixes a number of errors with cropping and with 0.5 offsets in the coordinates. Some code cleanup and reuse.

Fixes a number of errors with cropping and with 0.5 offsets in the coordinates. Some code cleanup and reuse.
Bill-Spitzak requested review from Omar Emara 2024-07-21 01:00:54 +02:00
Omar Emara requested changes 2024-07-22 10:04:06 +02:00
Omar Emara left a comment
Member

Your patch seems to include many unrelated changes that are mostly unrelated to #124842. So it is unlikely to be merged in its current form. The patch is also undercounted and the description is lacking the necessary information for review.
See https://developer.blender.org/docs/handbook/contributing/.

I would recommend you only change the minimal amount of code to fix the issue with clear patch description on what the problem is and how you solved it.

Your patch seems to include many unrelated changes that are mostly unrelated to #124842. So it is unlikely to be merged in its current form. The patch is also undercounted and the description is lacking the necessary information for review. See https://developer.blender.org/docs/handbook/contributing/. I would recommend you only change the minimal amount of code to fix the issue with clear patch description on what the problem is and how you solved it.
@ -218,2 +218,4 @@
/* border = false: Extend if wrap is false
* border = true: Clip if wrap is false */
template<bool border>
BLI_INLINE void bilinear_fl_impl(const float *buffer,
Member

What are the changes in this function supposed to do?

What are the changes in this function supposed to do?
Author
Contributor

These are just code cleanup from an aborted attempt to make the same changes to the bicubic sampler. I gave up on that as being too intrusive, in particular because the bicubic one always does Extend. Can remove them if desired.

These are just code cleanup from an aborted attempt to make the same changes to the bicubic sampler. I gave up on that as being too intrusive, in particular because the bicubic one always does Extend. Can remove them if desired.
@ -252,50 +252,7 @@ class MemoryBuffer {
void read_elem_bilinear(float x, float y, float *out) const
{
/* Only clear past +/-1 borders to be able to smooth edges. */
Member

What are the functional changes associated with all of those changes?

What are the functional changes associated with all of those changes?
Author
Contributor

The Extend version of the samplers is used (except for Bilinear which will use Wrap when requested because it was doing it correctly). Clip is done by here so it can be enabled per-axis and it performs the correct calculation, Extend is passed to the samplers. This did require significant code rearrangement as I did not want to change the behavior of the existing per-sampler calls, since they are used elsewhere in COM.

The `Extend` version of the samplers is used (except for Bilinear which will use Wrap when requested because it was doing it correctly). Clip is done by here so it can be enabled per-axis and it performs the correct calculation, Extend is passed to the samplers. This did require significant code rearrangement as I did not want to change the behavior of the existing per-sampler calls, since they are used elsewhere in COM.
@ -64,3 +63,1 @@
r_bounds.xmax = ceil(maxx);
r_bounds.ymin = floor(miny);
r_bounds.ymax = ceil(maxy);
r_bounds.xmin = floor(minx + 0.1f);
Member

Why those biases?

Why those biases?
Author
Contributor

This is a mistake, they only fixed the Scale. It appears the errors in Rotate are much larger but I also think it is less vital to fix them.

This is a mistake, they only fixed the Scale. It appears the errors in Rotate are much larger but I also think it is less vital to fix them.
@ -167,3 +167,3 @@
const float rel_scale_y = *it.in(1) * scale_y_factor;
const float scaled_x = scale_coord_inverted(
from_scale_offset_x + canvas_.xmin + it.x, scale_center_x, rel_scale_x);
from_scale_offset_x + canvas_.xmin + 0.5f + it.x, scale_center_x, rel_scale_x) - 0.5f;
Member

How are those related to #124842?

How are those related to #124842?
Author
Contributor

The translation is wrong without these .5 offsets and did not match the GPU, and made the edges up to .5 too dark.

The translation is wrong without these .5 offsets and did not match the GPU, and made the edges up to .5 too dark.
Bill-Spitzak force-pushed resolveshift from e5720fd4d4 to a0e5840e47 2024-07-23 01:59:08 +02:00 Compare
Author
Contributor

I tried to update this patch but it does not seem to have worked correctly. Closing this and making a new pull request.

I tried to update this patch but it does not seem to have worked correctly. Closing this and making a new pull request.
Bill-Spitzak closed this pull request 2024-07-23 02:04:40 +02:00
Author
Contributor
https://projects.blender.org/blender/blender/pulls/125267

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