30.10.2024, 15:01
(30.10.2024, 06:22)Selur Wrote: The last resize will always take place if the resulting resolution is not the same as the one specified under Corp/Resize, this is necessary, so that Hybrid knows what the resolution is after the resizing. Is the resolution of your resizing is the same as specified, the last resize will not take place.
I uploaded a dev version where I removed the mod8 restriction. => try how that behaves and let me know.
Cu Selur
Seems good, thanks alot. I will be testing it actual upscale later today, no resizes for no reason not mod8 , Code seems fine:
frame = clip.get_frame(0)
# setting color matrix to 709.
clip = core.std.SetFrameProps(clip, _Matrix=vs.MATRIX_BT709)
# setting color transfer (vs.TRANSFER_BT709), if it is not set.
if validate.transferIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Transfer=vs.TRANSFER_BT709)
# setting color primaries info (to vs.PRIMARIES_BT470_BG), if it is not set.
if validate.primariesIsInvalid(clip):
clip = core.std.SetFrameProps(clip=clip, _Primaries=vs.PRIMARIES_BT470_BG)
# setting color range to TV (limited) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_LIMITED)
# making sure frame rate is set to 29.97fps
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# making sure the detected scan type is set (detected: progressive)
clip = core.std.SetFrameProps(clip=clip, _FieldBased=vs.FIELD_PROGRESSIVE) # progressive
# changing range from limited to full range for vsVSMLRT
clip = core.resize.Bicubic(clip, range_in_s="limited", range_s="full")
# setting color range to PC (full) range.
clip = core.std.SetFrameProps(clip=clip, _ColorRange=vs.RANGE_FULL)
# adjusting color space from YUV420P10 to RGBH for vsVSMLRT
clip = core.resize.Bicubic(clip=clip, format=vs.RGBH, matrix_in_s="709", range_s="full")
# resizing using VSMLRT, target: 3408x1920
clipref = clip
from vsmlrt import Backend
clip = vsmlrt.inference([clip],network_path="I:/AI_Upscale/.Upscale Projects/Engines/.Models/2x_Ani4Kv2_G6i2_Compact_107500_FP16.onnx", backend=Backend.TRT(fp16=True,device_id=0,num_streams=1,verbose=True,use_cuda_graph=False,workspace=1073741824,builder_optimization_level=3,engine_folder="I:/AI_Upscale/.Upscale Projects/Engines")) # 1704x960
clip = vsmlrt.inference([clip],network_path="I:/AI_Upscale/.Upscale Projects/Engines/.Models/2x_cugan_pro-denoise3x-up2x_op18_fp16_clamp_colorfix.onnx", backend=Backend.TRT(fp16=True,device_id=0,num_streams=1,verbose=True,use_cuda_graph=False,workspace=1073741824,builder_optimization_level=3,engine_folder="I:/AI_Upscale/.Upscale Projects/Engines")) # 3408x1920
# adjusting color space from RGBH to RGBS for vsColorFix
clip = core.resize.Bicubic(clip=clip, format=vs.RGBS, range_s="full")
clipref = core.resize.Bicubic(clip=clipref, format=vs.RGBS, range_s="full")
# fixing colors with ColorFix
clip = vs_colorfix.average(clip=clip, ref=clipref, radius=10, fast=False)
# changing range from full to limited range for vsVSMLRT
clip = core.resize.Bicubic(clip, range_in_s="full", range_s="limited")
# adjusting output color from: RGBS to YUV420P10 for x265Model
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="limited", dither_type="error_diffusion")
# set output frame rate to 29.97fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001)
# output
clip.set_output()