Skip to content

HomeOfVapourSynthEvolution/havsfunc

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

This was a bug of my own committing.

In short, the original Expr logic didn't work as first intended.

We're replacing a bitwise-and, and the original addition approach simply
didn't work.

Here's an example:
For two pixels in the binarized mask clips (using 8-bit values for reference,
but all bitdepths scale appropriately):

Expected:
x | y | result
--------------
0   | 0   | 0
0   | 255 | 0
255 | 0   | 0
255 | 255 | 255

Actual (old code for 11+ bit depth)
Expr = "x y +"
x | y | result
--------------
0   | 0   | 0
0   | 255 | 255
255 | 0   | 255
255 | 255 | 255 (because Expr clamps to bit depth peak)

Actual (new code for 11+ bit depth)
Expr = "x y + (255 + 1) < 0 255 ?" (examples in 8 bit depth, but scales to higher)
Aka - if the sum of two pixels is less than the peak + 1 (aka <= the peak), then output 0, else output the peak.
I'm simplying using "peak + 1" here to save some cycles, taking the "<=" down to just a "<"
x | y | result
--------------
0   | 0   | 0
0   | 255 | 0
255 | 0   | 0
255 | 255 | 255 (because Expr clamps to bit depth peak)
7f0a9a7

Git stats

Files

Permalink
Failed to load latest commit information.