Compared to upstream r7 release, this release introduces support for descaling with custom arbitrary kernel (specified as a Python function and its support).
For example, here is yet another way to implement Debilinear(src, dw, dh)
:
dsed = core.descale.Descale(src, dw, dh, custom=lambda x: max(0, 1-abs(x)), support=1)
Assume custom=f
, the support
argument is the radius of x's support, i.e.
if |x| > support, then f(x) must be zero.
The max support for existing kernels is 4 for spline64, but descale only has optimized code path for 1 and 2.
(see https://github.com/AmusementClub/descale/blob/4a288cf57e65f7c098ac049a2fa34b5cac95c07d/src/descale.c#L166 if you want some kernel function references.)
The corresponding fmtconv change, see r28.A:
scaled = core.fmtc.resample(src, scale=2, custom=lambda x: max(0, 1-abs(x)), support=1) # bilinear upscale
Added parameters: custom
/support
, custom_h
/support_h
, custom_v
/support_v
. They should behave as the rest of fmtconv parameters (including specifying different custom kernel for horizontal/vertical scaling and/or each plane.) Also note that fmtconv will apply an additional anti-aliasing low-pass filter for downscales.
This is experimental and the question of how to actually determine the custom kernel to use is left as an exercise for the users.