Skip to content

Commit 4ec6eb4

Browse files
committed
mtmd: add mtmd_get_vision_image_size() and mtmd_get_vision_patch_size() functions
Signed-off-by: deadprogram <[email protected]>
1 parent 03792ad commit 4ec6eb4

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

tools/mtmd/mtmd.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,22 @@ int mtmd_get_audio_bitrate(mtmd_context * ctx) {
834834
return 16000; // 16kHz
835835
}
836836

837+
int mtmd_get_vision_image_size(mtmd_context * ctx) {
838+
if (!ctx->ctx_v) {
839+
return -1;
840+
}
841+
842+
return clip_get_image_size(ctx->ctx_v);
843+
}
844+
845+
int mtmd_get_vision_patch_size(mtmd_context * ctx) {
846+
if (!ctx->ctx_v) {
847+
return -1;
848+
}
849+
850+
return clip_get_patch_size(ctx->ctx_v);
851+
}
852+
837853
//
838854
// public API functions
839855
//

tools/mtmd/mtmd.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ MTMD_API bool mtmd_support_audio(mtmd_context * ctx);
112112
// return -1 if audio is not supported
113113
MTMD_API int mtmd_get_audio_bitrate(mtmd_context * ctx);
114114

115+
// get vision image size in pixels, for example 1024
116+
// return -1 if vision is not supported
117+
MTMD_API int mtmd_get_vision_image_size(mtmd_context * ctx);
118+
119+
// get vision patch size, for example 14
120+
// return -1 if vision is not supported
121+
MTMD_API int mtmd_get_vision_patch_size(mtmd_context * ctx);
122+
115123
// mtmd_bitmap
116124
//
117125
// if bitmap is image:

0 commit comments

Comments
 (0)