Skip to content

filters: update ewa_lanczossharp blur value

Kacper Michajłow requested to merge kasper93/libplacebo:f into master

For consistency and with the value that is actually reproducible

Same as before, code for reference:

import mpmath as mp

mp.mp.dps = 1000
print(mp.mp)

def j(x):
    return mp.besselj(1, x) / x

R1 = mp.findroot(j, 3)
R3 = mp.findroot(j, 10)

r1 = R1 / mp.pi
r3 = R3 / mp.pi

def jinc(x):
    return mp.besselj(1, mp.pi * x) / x

def wind(x):
    return mp.besselj(1, x * (R1 / r3)) / x

def l(x):
    if x < r3:
        return wind(x) * jinc(x)
    else:
        return 0

def f(r):
    return [
        r,
        mp.sqrt(mp.mpf('1.0') + 1) * r,
        2 * r,
        mp.sqrt(mp.mpf('1.0') + 4) * r,
        mp.sqrt(mp.mpf('4.0') + 4) * r,
        3 * r,
        mp.sqrt(mp.mpf('9.0') + 1) * r,
        mp.sqrt(mp.mpf('9.0') + 4) * r,
        4 * r,
        mp.sqrt(mp.mpf('16.0') + 1) * r,
        mp.sqrt(mp.mpf('9.0') + 9) * r,
        mp.sqrt(mp.mpf('16.0') + 4) * r,
        5 * r
    ]

z = l(mp.mpf("1e-128"))

def rite(r):
    return (
        l(f(r)[0]) +
        2 * (
            l(f(r)[1]) +
            l(f(r)[3]) +
            l(f(r)[6])
        )
    ) / (z + 4 * (
        l(f(r)[0]) +
        l(f(r)[1]) +
        l(f(r)[2]) +
        l(f(r)[4]) +
        l(f(r)[5]) +
        l(f(r)[8]) +
        l(f(r)[10]) +
        l(f(r)[12]) +
        2 * (
            l(f(r)[3]) +
            l(f(r)[6]) +
            l(f(r)[7]) +
            l(f(r)[9]) +
            l(f(r)[11])
        )
    ))

root = mp.findroot(rite, 1)
blur = mp.mpf('1.0') / root

print(f'root: {mp.nstr(root, 50)}')
print(f'blur: {mp.nstr(blur, 50)}')
Edited by Kacper Michajłow

Merge request reports

Loading