add mtmd_helper_init_opt

This commit is contained in:
Xuan Son Nguyen
2026-08-27 11:27:48 +02:00
parent c619e22d0f
commit 4e69771682
8 changed files with 108 additions and 76 deletions
+9 -9
View File
@@ -87,6 +87,9 @@ struct mtmd_cli_context {
mtmd::bitmaps bitmaps;
std::vector<mtmd_helper::video_ptr> videos;
mtmd_helper_init_opt init_opt = mtmd_helper_init_opt_default();
std::string video_ffmpeg_bin_dir;
mtmd::batch_ptr mbatch;
// chat template
@@ -171,14 +174,11 @@ struct mtmd_cli_context {
exit(1);
}
{
auto video_params = mtmd_helper_video_get_default_params();
video_params.fps_target = params.video_fps;
video_params.timestamp_interval_ms = params.video_timestamp_interval_ms;
video_params.ffmpeg_bin_dir = params.video_ffmpeg_bin_dir.empty()
? nullptr : params.video_ffmpeg_bin_dir.c_str();
mtmd_helper_video_set_default_params(video_params);
}
video_ffmpeg_bin_dir = params.video_ffmpeg_bin_dir;
init_opt.video_params.fps_target = params.video_fps;
init_opt.video_params.timestamp_interval_ms = params.video_timestamp_interval_ms;
init_opt.video_params.ffmpeg_bin_dir = video_ffmpeg_bin_dir.empty()
? nullptr : video_ffmpeg_bin_dir.c_str();
}
bool check_antiprompt(const llama_tokens & generated_tokens) {
@@ -193,7 +193,7 @@ struct mtmd_cli_context {
}
bool load_media(const std::string & fname) {
auto res = mtmd_helper_bitmap_init_from_file(ctx_vision.get(), fname.c_str(), false);
auto res = mtmd_helper_bitmap_init_from_file(ctx_vision.get(), fname.c_str(), false, init_opt);
if (!res.bitmap) {
return false;
}