I do agree with you that moving inside vsdeoldify the grain/noise removal it will be possible to use a more "bold" approach.
I opted for writing the following degrain function:
def vs_degrain(clip: vs.VideoNode = None, strength: int = 0) -> vs.VideoNode:
if strength == 0:
return clip
else:
import havsfunc
match strength:
case 1:
dstr = 1.0
case 2:
dstr = 1.5
case 3:
dstr = 2.5
case 4:
dstr = 3.5
case _:
raise vs.Error("ddeoldify: not supported strength value: " + mode)
clip = clip.resize.Bicubic(format=vs.YUV444PS, matrix_s="709", range_s="full")
clip = havsfunc.KNLMeansCL(clip=clip, d=1, a=2, s=4, h=dstr, device_type="gpu", device_id=0)
clip = clip.resize.Bicubic(format=vs.RGB24, matrix_in_s="709", range_s="full", dither_type="error_diffusion")
return clip
I decided to use KNLMeansCL because it is fast and can remove both grain and noise. I simplified the input and to the functions ddeoldify_main() and ddeoldify() I added only 1 parameter, that control the strenght of grain/noise removal, called "degrain_strength" (if = 0, is disabled).
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page. Offline between (including) 29th of June and 5th of July => RochHarz Festival
Okay, took a look.
Unless I overlook something, this is different from what I suggested. (filtering for deoldify, but keeping the luma details)
=> not implementing this
This is the same as applying the denoising before deoldify which Hybrid already can do, but in Hybrid you can use any denoiser not just KNLMeansCL.
This does make sense when deoldify is used outside of Hybrid, but in Hybrid, adding this seems like a step back.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page. Offline between (including) 29th of June and 5th of July => RochHarz Festival
Since it was decided to remove the flag "chroma_resize", now this flag is always enabled.
This implies that no matter all the changes that are made to the luma by the filters, at the end the original luma is always restored.
Dan
P.S.
I discovered a bug in managing the exception on vs_degrain, I attached the correct version.
which hopefully does the correct thing and is similar fast do Vapoursynth ShufflePlanes.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page. Offline between (including) 29th of June and 5th of July => RochHarz Festival
Ps.: uploaded a test version which does include KNLMeans, but not havsfunc.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page. Offline between (including) 29th of June and 5th of July => RochHarz Festival
No, problem will release a new Hybrid tomorrow then, assuming you release a new DeOldify.
Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page. Offline between (including) 29th of June and 5th of July => RochHarz Festival
(04.05.2024, 12:55)Selur Wrote: Ps.: uploaded a test version which does include KNLMeans, but not havsfunc.
I rewrote the "degrain" function as following
def vs_degrain(clip: vs.VideoNode = None, strength: int = 0, device_id: int = 0) -> vs.VideoNode:
if strength == 0:
return clip
match strength:
case 1:
dstr = 1.5
dtmp = 1
case 2:
dstr = 2.5
dtmp = 1
case 3:
dstr = 3.5
dtmp = 1
case 4:
dstr = 5.5
dtmp = 2
case 5:
dstr = 8.5
dtemp = 2
case _:
raise vs.Error("ddeoldify: not supported strength value: " + strength)
clip = clip.resize.Bicubic(format=vs.YUV444PS, matrix_s="709", range_s="full")
clip = vs.core.knlm.KNLMeansCL(clip=clip, d=dtemp, a=2, s=4, h=dstr, channels='Y', device_type="gpu", device_id=device_id)
clip = clip.resize.Bicubic(format=vs.RGB24, matrix_in_s="709", range_s="full", dither_type="error_diffusion")
return clip
I prefer that in Hybrid the Degrain will display only integer values from 1 to 5.
So that in the future I can decide to implement a different mapping and/or denoise/degrain function, without the need to change the input.
If you prefer you can call this parameter also "DegrainFactor".
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page. Offline between (including) 29th of June and 5th of July => RochHarz Festival