Skip to content

Commit 8a45d0f

Browse files
authored
chore: clean up stb includes (#919)
1 parent 9e28be6 commit 8a45d0f

File tree

2 files changed

+3
-14
lines changed

2 files changed

+3
-14
lines changed

stable-diffusion.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@
1616
#include "tae.hpp"
1717
#include "vae.hpp"
1818

19-
#define STB_IMAGE_IMPLEMENTATION
20-
#define STB_IMAGE_STATIC
21-
#include "stb_image.h"
22-
23-
// #define STB_IMAGE_WRITE_IMPLEMENTATION
24-
// #define STB_IMAGE_WRITE_STATIC
25-
// #include "stb_image_write.h"
26-
2719
const char* model_version_to_str[] = {
2820
"SD 1.x",
2921
"SD 1.x Inpaint",
@@ -1150,7 +1142,7 @@ class StableDiffusionGGML {
11501142
std::vector<int> skip_layers(guidance.slg.layers, guidance.slg.layers + guidance.slg.layer_count);
11511143

11521144
float cfg_scale = guidance.txt_cfg;
1153-
float img_cfg_scale = isfinite(guidance.img_cfg) ? guidance.img_cfg : guidance.txt_cfg;
1145+
float img_cfg_scale = std::isfinite(guidance.img_cfg) ? guidance.img_cfg : guidance.txt_cfg;
11541146
float slg_scale = guidance.slg.scale;
11551147

11561148
if (img_cfg_scale != cfg_scale && !sd_version_is_inpaint_or_unet_edit(version)) {
@@ -1987,7 +1979,7 @@ char* sd_sample_params_to_str(const sd_sample_params_t* sample_params) {
19871979
"eta: %.2f, "
19881980
"shifted_timestep: %d)",
19891981
sample_params->guidance.txt_cfg,
1990-
isfinite(sample_params->guidance.img_cfg)
1982+
std::isfinite(sample_params->guidance.img_cfg)
19911983
? sample_params->guidance.img_cfg
19921984
: sample_params->guidance.txt_cfg,
19931985
sample_params->guidance.distilled_guidance,
@@ -2153,7 +2145,7 @@ sd_image_t* generate_image_internal(sd_ctx_t* sd_ctx,
21532145
seed = rand();
21542146
}
21552147

2156-
if (!isfinite(guidance.img_cfg)) {
2148+
if (!std::isfinite(guidance.img_cfg)) {
21572149
guidance.img_cfg = guidance.txt_cfg;
21582150
}
21592151

util.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@
2626
#include "ggml.h"
2727
#include "stable-diffusion.h"
2828

29-
#define STB_IMAGE_RESIZE_IMPLEMENTATION
30-
#include "stb_image_resize.h"
31-
3229
bool ends_with(const std::string& str, const std::string& ending) {
3330
if (str.length() >= ending.length()) {
3431
return (str.compare(str.length() - ending.length(), ending.length(), ending) == 0);

0 commit comments

Comments
 (0)