Add fast prescale option to upscaler settings (off by default) #16348
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
By default, upscaling will loop several times to upscale incoming images to the target dimensions. This is necessary, as upscaling models work in fixed increments (x4 is common). However, for very small images, such as those generated by ADetailer for inpainting, this can regularly result two upscaling steps. The second step is often expensive, far exceeding the target dimensions, and is particularly wasteful as it will be forcibly downsized by the final part of the
upscale
method anyway.Examining the behaviour, it's often the case that a minor resize using Lanczos before the upscaling loop would guarantee a single upscaling step that hits or slightly exceeds the target dimensions.
This commit introduces an optional value to the upscaler settings allowing this minor resize, should the incoming image fall below a certain threshold compared to the fixed scaling value of the upscaling model. By default, this setting is set to 1.0, disabling it. Values of 1.25-3.0 are recommended.
Screenshots/videos:
N/A
Checklist: