Skip to content

Commit e11a571

Browse files
committed
fix sysmbol with util and upscaler
1 parent 0828530 commit e11a571

File tree

4 files changed

+61
-5
lines changed

4 files changed

+61
-5
lines changed

.idea/workspace.xml

+13-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ add_library(${SD_ABI} SHARED
5151
stable-diffusion-abi.h
5252
${sd_SOURCE_DIR}/stable-diffusion.h
5353
${sd_SOURCE_DIR}/stable-diffusion.cpp
54+
${sd_SOURCE_DIR}/util.cpp
55+
${sd_SOURCE_DIR}/upscaler.cpp
5456
)
5557

5658
target_include_directories(${SD_ABI} PUBLIC .)

stable-diffusion-abi.cpp

+34
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,37 @@ uint32_t get_image_height(const sd_image_t* images, int index) {
1717
uint32_t get_image_channel(const sd_image_t* images, int index) {
1818
return images[index].channel;
1919
}
20+
21+
void sd_images_free(const sd_image_t* images) {
22+
if (images != nullptr) {
23+
delete []images;
24+
}
25+
images = nullptr;
26+
}
27+
28+
void sd_image_free(sd_image_t* image) {
29+
if (image != nullptr) {
30+
delete image;
31+
}
32+
image = nullptr;
33+
}
34+
35+
// sd_image_t new_image() {
36+
//
37+
// }
38+
//
39+
// void set_image_data(sd_image_t image, uint8_t* data) {
40+
// image.data = data;
41+
// }
42+
//
43+
// void set_image_width(sd_image_t image, uint32_t width) {
44+
// image.width = width;
45+
// }
46+
//
47+
// void set_image_height(sd_image_t image, uint32_t height) {
48+
// imageheight = height;
49+
// }
50+
//
51+
// void set_image_channel(sd_image_t image, uint32_t channel) {
52+
// image->channel = channel;
53+
// }

stable-diffusion-abi.h

+12
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
extern "C" {
2222
#endif
2323

24+
// STABLE_DIFFUSION_API void set_image_data(sd_image_t* image, uint8_t* data);
25+
//
26+
// STABLE_DIFFUSION_API void set_image_width(sd_image_t* image, uint32_t width);
27+
//
28+
// STABLE_DIFFUSION_API void set_image_height(sd_image_t* image, uint32_t height);
29+
//
30+
// STABLE_DIFFUSION_API void set_image_channel(sd_image_t* image, uint32_t channel);
31+
2432
STABLE_DIFFUSION_API uint8_t* get_image_data(const sd_image_t* images, int index);
2533

2634
STABLE_DIFFUSION_API uint32_t get_image_width(const sd_image_t* images, int index);
@@ -29,6 +37,10 @@ STABLE_DIFFUSION_API uint32_t get_image_height(const sd_image_t* images, int ind
2937

3038
STABLE_DIFFUSION_API uint32_t get_image_channel(const sd_image_t* images, int index);
3139

40+
STABLE_DIFFUSION_API void sd_images_free(const sd_image_t* images);
41+
42+
STABLE_DIFFUSION_API void sd_image_free(sd_image_t* image);
43+
3244
#ifdef __cplusplus
3345
}
3446
#endif

0 commit comments

Comments
 (0)