From f5830838eb992adf55b88b66fd0c2862078e4b1b Mon Sep 17 00:00:00 2001 From: Ting Lou Date: Wed, 26 Feb 2025 18:05:02 +0800 Subject: [PATCH 1/2] add struct for FFI bindgen --- examples/llava/clip.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/llava/clip.h b/examples/llava/clip.h index ce6f61944ce16..f320c21b269b1 100644 --- a/examples/llava/clip.h +++ b/examples/llava/clip.h @@ -74,8 +74,10 @@ CLIP_API void clip_image_f32_free(struct clip_image_f32 * img); CLIP_API void clip_image_u8_batch_free (struct clip_image_u8_batch * batch); CLIP_API void clip_image_f32_batch_free(struct clip_image_f32_batch * batch); -/** build image from pixels decoded by other libraries instead of stb_image.h for better performance. The memory layout is RGBRGBRGB..., input buffer length must be 3*nx*ny bytes */ -CLIP_API void clip_build_img_from_pixels(const unsigned char * rgb_pixels, int nx, int ny, clip_image_u8 * img); +/** build image from pixels decoded by other libraries instead of stb_image.h for better performance. + * The memory layout is RGBRGBRGB..., input buffer length must be 3*nx*ny bytes + */ +CLIP_API void clip_build_img_from_pixels(const unsigned char * rgb_pixels, int nx, int ny, struct clip_image_u8 * img); CLIP_API bool clip_image_load_from_file(const char * fname, struct clip_image_u8 * img); From c3ba65976105e37444f6c9789db166e12abc9559 Mon Sep 17 00:00:00 2001 From: Xuan-Son Nguyen Date: Wed, 26 Feb 2025 14:36:24 +0100 Subject: [PATCH 2/2] Apply suggestions from code review --- examples/llava/clip.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/llava/clip.h b/examples/llava/clip.h index f320c21b269b1..002c419653a01 100644 --- a/examples/llava/clip.h +++ b/examples/llava/clip.h @@ -74,8 +74,9 @@ CLIP_API void clip_image_f32_free(struct clip_image_f32 * img); CLIP_API void clip_image_u8_batch_free (struct clip_image_u8_batch * batch); CLIP_API void clip_image_f32_batch_free(struct clip_image_f32_batch * batch); -/** build image from pixels decoded by other libraries instead of stb_image.h for better performance. - * The memory layout is RGBRGBRGB..., input buffer length must be 3*nx*ny bytes +/** + * Build image from pixels decoded by other libraries instead of stb_image.h for better performance. + * The memory layout is RGBRGBRGB..., input buffer length must be 3*nx*ny bytes */ CLIP_API void clip_build_img_from_pixels(const unsigned char * rgb_pixels, int nx, int ny, struct clip_image_u8 * img);