adjust soft clamp

This commit is contained in:
Concedo 2026-02-12 21:31:45 +08:00
parent 261d78eaaa
commit 58ebff4c74

View file

@ -846,11 +846,11 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
extra_image_data.push_back(img2img_data);
}
const int default_res_limit = 8192; // arbitrary, just to simplify the code
const int default_res_limit = 2048; // arbitrary, just to simplify the code
// avoid crashes due to bugs/limitations on certain models
// although it can be possible for a single side to exceed 1024, the total resolution of the image
// cannot exceed (832x832) for sd1/sd2 or (2048x2048) for sdxl/sd3/flux, to prevent crashing the server
const int hard_megapixel_res_limit = (loadedsdver==SDVersion::VERSION_SD1 || loadedsdver==SDVersion::VERSION_SD2)?832:2048;
int hard_megapixel_res_limit = default_res_limit;
int img_hard_limit = default_res_limit;
if (cfg_side_limit > 0) {
@ -859,7 +859,7 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
int img_soft_limit = default_res_limit;
if (cfg_square_limit <= 0) {
cfg_square_limit = 1024; //defaults to 1 megapixel soft e.g. 1024x1024 if unspecified
cfg_square_limit = ((loadedsdver==SDVersion::VERSION_SD1 || loadedsdver==SDVersion::VERSION_SD2)?832:1024); //defaults to 1 megapixel soft e.g. 1024x1024 if unspecified
}
img_soft_limit = std::max(std::min(cfg_square_limit, default_res_limit), 64);
img_soft_limit = std::min(hard_megapixel_res_limit, img_soft_limit);