videos: the tower reads a keyframe's own canvas frame, never a re-decode

The reference feeds the vision tower the same resized tensor it hands the
video VAE: an anchor's identity and its pinned latent are the SAME pixels.
Our port showed the tower the source file at the `match` area instead, so
a keyframe whose native aspect differed from the canvas reached the two
channels differently (parallel PR #236, point 5).

A keyframe now decodes once, onto the exact output canvas, in a pre-loop
that owns every FIRST/LAST_FRAME part: the pixels fill enc_pixels for the
VAE pin as before, and the frame itself rides to the prompt block, where
the anchor loop hands it to the tower through the new IMultimodal
prepare_frame -- implemented by the bridge as Processor::image_from, which
smart-resizes and patchifies the caller's pixels exactly as a prepared
file's would be. A reference picture is unchanged (tower `match`, encoder
grid); the two never share a request. The encode loop's keyframe branch is
gone: its pixels were built above, one decode for both consumers.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
gearwave00001andClaude committed 2026-10-25 06:58:58 -05:00
1 parent baa10db1aa
commit c5483e3241
6 files changed
+114 -34

No files matched your search

+3 -1
View File
@@ -368,7 +368,9 @@ public:
std::string* why, int64_t max_pixels = 0, const ImageMode& mode = ImageMode{}) const;
int video(const uint8_t* bytes, size_t n, std::shared_ptr<Item>* out, std::string* why) const;
/* From an already-decoded picture or frame list; for tests. */
/* From an already-decoded picture or frame list: tests feed synthetic frames, and the video
* server feeds the canvas frame of a keyframe so the tower sees the very pixels the video VAE
* is handed (server/iface.h prepare_frame). The smart-resize and patch staging match image(). */
int image_from(const Frame& f, std::shared_ptr<Item>* out, std::string* why,
const ImageMode& mode = ImageMode{}) const;
int video_from(const Video& v, std::shared_ptr<Item>* out, std::string* why) const;