mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-29 16:09:10 +00:00
Quick fix for special case no-upscale 1.0 upscale
This commit is contained in:
parent
b37acfa31d
commit
c2f1e43656
@ -625,29 +625,33 @@ class Upscaler:
|
|||||||
remaining_scaling_ratio = math.ceil(output_scale)
|
remaining_scaling_ratio = math.ceil(output_scale)
|
||||||
self.scaling_jobs = []
|
self.scaling_jobs = []
|
||||||
|
|
||||||
while remaining_scaling_ratio > 1:
|
# special case for 1.0 upscale ratio
|
||||||
for ratio in supported_scaling_ratios:
|
if remaining_scaling_ratio == 1:
|
||||||
if ratio >= remaining_scaling_ratio:
|
self.scaling_jobs.append(1)
|
||||||
self.scaling_jobs.append(ratio)
|
else:
|
||||||
remaining_scaling_ratio /= ratio
|
while remaining_scaling_ratio > 1:
|
||||||
break
|
for ratio in supported_scaling_ratios:
|
||||||
|
if ratio >= remaining_scaling_ratio:
|
||||||
else:
|
self.scaling_jobs.append(ratio)
|
||||||
|
remaining_scaling_ratio /= ratio
|
||||||
found = False
|
|
||||||
for i in supported_scaling_ratios:
|
|
||||||
for j in supported_scaling_ratios:
|
|
||||||
if i * j >= remaining_scaling_ratio:
|
|
||||||
self.scaling_jobs.extend([i, j])
|
|
||||||
remaining_scaling_ratio /= i * j
|
|
||||||
found = True
|
|
||||||
break
|
|
||||||
if found is True:
|
|
||||||
break
|
break
|
||||||
|
|
||||||
if found is False:
|
else:
|
||||||
self.scaling_jobs.append(supported_scaling_ratios[-1])
|
|
||||||
remaining_scaling_ratio /= supported_scaling_ratios[-1]
|
found = False
|
||||||
|
for i in supported_scaling_ratios:
|
||||||
|
for j in supported_scaling_ratios:
|
||||||
|
if i * j >= remaining_scaling_ratio:
|
||||||
|
self.scaling_jobs.extend([i, j])
|
||||||
|
remaining_scaling_ratio /= i * j
|
||||||
|
found = True
|
||||||
|
break
|
||||||
|
if found is True:
|
||||||
|
break
|
||||||
|
|
||||||
|
if found is False:
|
||||||
|
self.scaling_jobs.append(supported_scaling_ratios[-1])
|
||||||
|
remaining_scaling_ratio /= supported_scaling_ratios[-1]
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.scaling_jobs = [output_scale]
|
self.scaling_jobs = [output_scale]
|
||||||
|
Loading…
Reference in New Issue
Block a user