From 4ec6eb469306b1a0afbd2ce9c13886219d0d010c Mon Sep 17 00:00:00 2001 From: deadprogram Date: Tue, 21 Oct 2025 18:37:33 +0200 Subject: [PATCH] mtmd: add mtmd_get_vision_image_size() and mtmd_get_vision_patch_size() functions Signed-off-by: deadprogram --- tools/mtmd/mtmd.cpp | 16 ++++++++++++++++ tools/mtmd/mtmd.h | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/tools/mtmd/mtmd.cpp b/tools/mtmd/mtmd.cpp index 4d487581ae0a0..fc9e646ec2360 100644 --- a/tools/mtmd/mtmd.cpp +++ b/tools/mtmd/mtmd.cpp @@ -834,6 +834,22 @@ int mtmd_get_audio_bitrate(mtmd_context * ctx) { return 16000; // 16kHz } +int mtmd_get_vision_image_size(mtmd_context * ctx) { + if (!ctx->ctx_v) { + return -1; + } + + return clip_get_image_size(ctx->ctx_v); +} + +int mtmd_get_vision_patch_size(mtmd_context * ctx) { + if (!ctx->ctx_v) { + return -1; + } + + return clip_get_patch_size(ctx->ctx_v); +} + // // public API functions // diff --git a/tools/mtmd/mtmd.h b/tools/mtmd/mtmd.h index f4ea07d3ad521..15a3553598200 100644 --- a/tools/mtmd/mtmd.h +++ b/tools/mtmd/mtmd.h @@ -112,6 +112,14 @@ MTMD_API bool mtmd_support_audio(mtmd_context * ctx); // return -1 if audio is not supported MTMD_API int mtmd_get_audio_bitrate(mtmd_context * ctx); +// get vision image size in pixels, for example 1024 +// return -1 if vision is not supported +MTMD_API int mtmd_get_vision_image_size(mtmd_context * ctx); + +// get vision patch size, for example 14 +// return -1 if vision is not supported +MTMD_API int mtmd_get_vision_patch_size(mtmd_context * ctx); + // mtmd_bitmap // // if bitmap is image: