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

+12
View File
@@ -405,6 +405,18 @@ struct FakeMultimodal : IMultimodal {
*out = std::move(it);
return RAD_OK;
}
/* The keyframe path shows the tower the canvas frame itself, not the file: counted, with each
* frame's side, so a test can confirm the tower saw the very pixels the VAE was handed. */
int n_pframe = 0;
std::vector<std::pair<int32_t, int32_t>> pframe_wh;
int prepare_frame(const mm::Frame& f, std::shared_ptr<mm::Item>* out, std::string*) override {
++n_pframe;
pframe_wh.emplace_back(f.w, f.h);
auto it = std::make_shared<mm::Item>();
it->expand = expand;
*out = std::move(it);
return RAD_OK;
}
/* The video/audio VAE form, which the server fills only when a generator declares `encodes`.
* Synthetic frames and a mono tone of a fixed length, each call counted, so a test can watch the
* server decode each reference, spread the mono tone across the encoder's channels and hand it to