03.05.2024, 21:10
Hello Selur,
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:
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).
I attached the new RC7.
Thanks,
Dan
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:
Code:
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).
I attached the new RC7.
Thanks,
Dan