mtmd: add chunk save/load function (#26645)

* mtmd: add chunk save/load function

* nits

* add tests

* rn _MAX --> _COUNT
This commit is contained in:
Xuan-Son Nguyen
2026-08-06 19:46:40 +02:00
committed by GitHub
parent 6a32c29a74
commit 15586e2d71
4 changed files with 334 additions and 0 deletions
+8
View File
@@ -591,6 +591,8 @@ struct clip_image_u8 {
}
};
struct mtmd_serialization; // forward declaration
// For images, buf.size() == nx*ny*3
// Memory layout: RGBRGBRGB...
// For seq, buf.size() == nx*ny*3*nt
@@ -671,6 +673,9 @@ struct clip_image_f32 {
return buf.empty();
}
void serialize(struct mtmd_serialization & ser) const;
void deserialize(struct mtmd_serialization & ser);
private:
std::vector<float> buf;
int nx_ = 0;
@@ -752,6 +757,9 @@ struct clip_image_f32_batch {
}
return new_batch;
}
void serialize(struct mtmd_serialization & ser) const;
void deserialize(struct mtmd_serialization & ser);
};
//