Skip to content

Commit 12f48fd

Browse files
committed
refactor: sd api
Signed-off-by: thxCode <thxcode0824@gmail.com>
1 parent 5b66840 commit 12f48fd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

stable-diffusion.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,20 @@ sd_sampling_stream_t* img2img_stream(sd_ctx_t* sd_ctx,
21042104
control_strength);
21052105
}
21062106

2107+
int sd_sampling_stream_sampled_steps(sd_sampling_stream_t* stream) {
2108+
if (stream == nullptr) {
2109+
return 0;
2110+
}
2111+
return stream->sampled_steps;
2112+
}
2113+
2114+
int sd_sampling_stream_steps(sd_sampling_stream_t* stream) {
2115+
if (stream == nullptr) {
2116+
return 0;
2117+
}
2118+
return stream->sample_steps + 1;
2119+
}
2120+
21072121
void sd_sampling_stream_free(sd_sampling_stream_t* stream) {
21082122
if (stream == nullptr) {
21092123
return;

stable-diffusion.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ SD_API sd_sampling_stream_t* img2img_stream(sd_ctx_t* sd_ctx,
258258
int64_t seed,
259259
const sd_image_t* control_cond,
260260
float control_strength);
261+
SD_API int sd_sampling_stream_sampled_steps(sd_sampling_stream_t* stream);
262+
SD_API int sd_sampling_stream_steps(sd_sampling_stream_t* stream);
261263
SD_API void sd_sampling_stream_free(sd_sampling_stream_t* stream);
262264
SD_API bool sd_sampling_stream_sample(sd_ctx_t* sd_ctx, sd_sampling_stream_t* stream);
263265
SD_API sd_image_t sd_samping_stream_get_image(sd_ctx_t* sd_ctx, sd_sampling_stream_t* stream);

0 commit comments

Comments
 (0)