@@ -41,14 +41,14 @@ struct mtmd_context {
4141};
4242
4343struct mtmd_image_tokens_data {
44- clip_image_f32_batch_ptr batch_f32; // preprocessed image patches
44+ clip_image_f32_batch batch_f32; // preprocessed image patches
4545};
4646
4747struct mtmd_image_tokens {
4848 uint32_t nx; // number of tokens in x direction
4949 uint32_t ny; // number of tokens in y direction
5050 uint32_t n_tokens () const { return nx * ny; }
51- clip_image_f32_batch_ptr batch_f32; // preprocessed image patches
51+ clip_image_f32_batch batch_f32; // preprocessed image patches
5252};
5353
5454mtmd_context * mtmd_init_from_file (const char * mmproj_fname,
@@ -141,8 +141,8 @@ mtmd_input_chunks * mtmd_tokenize(mtmd_context * ctx,
141141 std::memcpy (img_u8->buf .data (), bitmaps[i_img].data .data (), img_u8->nx * img_u8->ny * 3 );
142142
143143 // preprocess image
144- clip_image_f32_batch_ptr batch_f32 ( new clip_image_f32_batch) ;
145- bool ok = clip_image_preprocess (ctx->ctx_clip , img_u8.get (), batch_f32. get () );
144+ clip_image_f32_batch batch_f32;
145+ bool ok = clip_image_preprocess (ctx->ctx_clip , img_u8.get (), & batch_f32);
146146 if (!ok) {
147147 LOG_ERR (" Unable to preprocess image\n " );
148148 return nullptr ;
@@ -181,7 +181,7 @@ int32_t mtmd_encode(mtmd_context * ctx, const mtmd_image_tokens * image_tokens)
181181 bool ok = clip_image_batch_encode (
182182 ctx->ctx_clip ,
183183 ctx->n_threads ,
184- image_tokens->batch_f32 . get () ,
184+ & image_tokens->batch_f32 ,
185185 ctx->image_embd_v .data ());
186186 return ok ? 0 : 1 ;
187187}
0 commit comments