From 128c2ddcd6b8a1957f21fa1793cd5f4f8c7022bd Mon Sep 17 00:00:00 2001 From: Setsugennoao <41454651+Setsugennoao@users.noreply.github.com> Date: Sat, 21 Oct 2023 00:27:46 +0200 Subject: [PATCH] Fix Waifu2x.Cunet on scale=1 --- vsscale/scale.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/vsscale/scale.py b/vsscale/scale.py index 8973e41..cee0402 100644 --- a/vsscale/scale.py +++ b/vsscale/scale.py @@ -314,6 +314,7 @@ def scale( # type:ignore _static_args = kwargs.pop('_static_args', self._static_args) force = _static_args.pop('force', False) + do_scale = _static_args.get('scale') > 1 kwargs.update(tiles=self.tiles, tilesize=self.tilesize, overlap=self.overlap) @@ -346,7 +347,7 @@ def scale( # type:ignore mult = 1 if force else max(int(log2(ceil(size))) for size in (width / wclip.width, height / wclip.height)) for _ in range(mult): - if self._model == Waifu2x.Cunet._model: + if do_scale and self._model == Waifu2x.Cunet._model: padding = self.mod_padding(wclip) wclip = padder(wclip, *padding) @@ -355,7 +356,7 @@ def scale( # type:ignore wclip, **_static_args, model=model, backend=self.backend, preprocess=False, **kwargs ) - if self._model == Waifu2x.Cunet._model: + if do_scale and self._model == Waifu2x.Cunet._model: cropped = wclip.std.Crop(*(p * 2 for p in padding)) try: