mirror of
https://github.com/LostRuins/koboldcpp.git
synced 2025-09-14 10:59:41 +00:00
try fix segfault in sdcpp
This commit is contained in:
parent
485148b293
commit
2635e4b932
1 changed files with 17 additions and 3 deletions
|
@ -521,9 +521,11 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
|
|||
int img2imgW = sd_params->width; //for img2img input
|
||||
int img2imgH = sd_params->height;
|
||||
int img2imgC = 3; // Assuming RGB image
|
||||
std::vector<uint8_t> resized_image_buf(img2imgW * img2imgH * img2imgC);
|
||||
std::vector<uint8_t> resized_mask_buf(img2imgW * img2imgH * img2imgC);
|
||||
std::vector<std::vector<uint8_t>> resized_extraimage_bufs(max_extra_images, std::vector<uint8_t>(img2imgW * img2imgH * img2imgC));
|
||||
//because the reference image can be larger than the output image, allocate at least enough for 1024x1024
|
||||
const int imgMemNeed = std::max(img2imgW * img2imgH * img2imgC + 512, 1024 * 1024 * img2imgC + 512);
|
||||
std::vector<uint8_t> resized_image_buf(imgMemNeed);
|
||||
std::vector<uint8_t> resized_mask_buf(imgMemNeed);
|
||||
std::vector<std::vector<uint8_t>> resized_extraimage_bufs(max_extra_images, std::vector<uint8_t>(imgMemNeed));
|
||||
|
||||
std::string ts = get_timestamp_str();
|
||||
if(!sd_is_quiet)
|
||||
|
@ -623,6 +625,18 @@ sd_generation_outputs sdtype_generate(const sd_generation_inputs inputs)
|
|||
}
|
||||
}
|
||||
|
||||
//round dims down to 64
|
||||
desiredWidth = rounddown_64(desiredWidth);
|
||||
desiredHeight = rounddown_64(desiredHeight);
|
||||
if(desiredWidth<64)
|
||||
{
|
||||
desiredWidth = 64;
|
||||
}
|
||||
if(desiredHeight<64)
|
||||
{
|
||||
desiredHeight = 64;
|
||||
}
|
||||
|
||||
if(!sd_is_quiet && sddebugmode==1)
|
||||
{
|
||||
printf("Resize Extraimg: %dx%d to %dx%d\n",nx2,ny2,desiredWidth,desiredHeight);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue