04.05.2024, 09:36
The implemented denoise/degrain will preserve the luma details.
The main code is the following:
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.
The main code is the following:
def ddeoldify(
clip: vs.VideoNode, method: int = 2, mweight: float = 0.5, deoldify_p: list = [0, 24, 1.0, 0.0], ddcolor_p: list = [1, 24, 1.0, 0.0, True], dotweak: bool = False, dotweak_p: list = [0.0, 1.0, 1.0, False, 0.2, 0.5, 1.5, 0.5], ddtweak: bool = False, ddtweak_p: list = [0.0, 1.0, 2.5, True, 0.3, 0.6, 1.5, 0.5, "300:360|0.8,0.1"], degrain_strength: int = 0, cmc_tresh: float = 0.2, lmm_p: list = [0.2, 0.8, 1.0], alm_p: list = [0.8, 1.0, 0.15], cmb_sw: bool = False, device_index: int = 0, torch_dir: str = model_dir) -> vs.VideoNode:
...
...
chroma_resize = True # always enabled
...
...
if chroma_resize:
frame_size = min(max(ddcolor_rf, deoldify_rf) * 16, clip.width) # frame size calculation for inference()
clip_orig = clip;
clip = clip.resize.Spline64(width=frame_size, height=frame_size)
try:
d_clip = vs_degrain(clip, degrain_strength)
except:
vs.core.log_message(2, "Degrain filter: havsfunc.KNLMeansCL is not installed/loaded properly")
d_clip = clip
clip = d_clip
...
...
if chroma_resize:
return _clip_chroma_resize(clip_orig, clip_colored)
else:
return clip_colored
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.