forge
Explore
Log in

Don't you dare go Hollow

stream: pin four more oracle counts, one of them off the wire itself

Browse files at this commit

31ca7609a2a742af3f288879dee205c821ea8c79Ahmet Kaan GümüşParent: 6e9d8a0
a_real_aomenc_stream_with_cdf_update_disabled is the one site whose spec is
NOT a literal: the arm overrides screen_intrabc_stream_at_depth's '--limit=1'
with '--limit=3', and aomenc keeps the LAST occurrence of a repeated flag, so
'3' would be a claim about flag precedence rather than a fact about a stream.
The gate already parses this stream's own OBU frame headers with Av1Parser in
the loop sitting above the call, so the assert compares frames.len() against
that header count -- derived from the bitstream, not from a rule and not from
our decode. The mutation run in the lane report prints both sides (3 vs 4),
so the pin is shown to bite.

Also pins the rect-strip-palette gate, whose 'no frame-count assert here'
comment is deleted: frames.len() == 1 is a fact about the encode, taken before
frames.len() is spent as ffmpeg's budget, so it was never the tautology that
comment described -- and ten_bit_tool_gate, whose count is its own 'frames'
PARAMETER, the same value handed to encode_10bit_gradients_seed: 1 for the
key-frame callers, 24 for the --lag-in-frames=16 inter ones.

count-vacuity sweep: 29 unpinned -> 25.
crates/ec-av1/src/stream.rsmodified+38 -4
@@ -13249,6 +13249,21 @@ pub(crate) mod tests {
13249 "{NAME}: only {headers} frame headers in the fixture"13249 "{NAME}: only {headers} frame headers in the fixture"
13250 );13250 );
13251 let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {e}"));13251 let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {e}"));
13252+ // The frame count, and it comes from the WIRE, not from our decode: the
13253+ // loop above parsed this stream's own OBU frame headers with
13254+ // `Av1Parser` and counted `headers` of them (>= 3, from the arm's
13255+ // `--limit=3` at 13127, which overrides the helper's `--limit=1` because
13256+ // aomenc keeps the last occurrence of a repeated flag). Asserted ABOVE
13257+ // the oracle call, so a decode that showed fewer frames than the bitstream
13258+ // codes reds naming the wire instead of asking ffmpeg for the same short
13259+ // count. Deriving it from `headers` rather than a literal keeps the pin
13260+ // honest if aomenc's frame count ever drifts.
13261+ assert_eq!(
13262+ frames.len(),
13263+ headers,
13264+ "{NAME}: the stream codes {headers} frame(s), the decode showed {}",
13265+ frames.len()
13266+ );
13252 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());13267 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
13253 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");13268 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");
13254 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {13269 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -13454,15 +13469,19 @@ pub(crate) mod tests {
13454 Err(e) => panic!("{NAME}: decode failed on {arm} at {depth}-bit: {e}"),13469 Err(e) => panic!("{NAME}: decode failed on {arm} at {depth}-bit: {e}"),
13455 };13470 };
13456 let fired = decode::rect4_palette_hits() - before;13471 let fired = decode::rect4_palette_hits() - before;
13472+ // The ENCODE's frame count, asserted ABOVE the oracle call: the
13473+ // y4m renders 5 frames (`-t 0.2` at every arm's `rate=25`,
13474+ // 13275) but aomenc is given `--limit=1` (13313), so the stream
13475+ // codes exactly 1 frame at both depths on every arm. Asserted
13476+ // here it is NOT the tautology the old comment below claimed:
13477+ // `frames.len() == 1` is a fact about the encode, checked before
13478+ // `frames.len()` is spent as ffmpeg's frame budget.
13479+ assert_eq!(frames.len(), 1, "{NAME}: {arm} at {depth}-bit key frame");
13457 let ffmpeg_frames = if depth == 10 {13480 let ffmpeg_frames = if depth == 10 {
13458 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())13481 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
13459 } else {13482 } else {
13460 ffmpeg_decode_sequence(&stream, width, height, frames.len())13483 ffmpeg_decode_sequence(&stream, width, height, frames.len())
13461 };13484 };
13462- // No frame-count assert here: `ffmpeg_decode_sequence{,_10bit}`
13463- // was handed `frames.len()` as its frame budget, so
13464- // `ffmpeg_frames.len() == frames.len()` holds by construction
13465- // and the assert was tautological.
13466 assert!(13485 assert!(
13467 !frames.is_empty(),13486 !frames.is_empty(),
13468 "{NAME}: {arm} at {depth}-bit decoded no frame"13487 "{NAME}: {arm} at {depth}-bit decoded no frame"
@@ -15592,6 +15611,21 @@ pub(crate) mod tests {
15592 .map(|((label, _), d)| format!("{label}={d}"))15611 .map(|((label, _), d)| format!("{label}={d}"))
15593 .collect();15612 .collect();
15594 let fired = fired.join(" ");15613 let fired = fired.join(" ");
15614+ // The ENCODE's frame count, and it is this helper's `frames` PARAMETER
15615+ // (15446) -- not our decode's length. It is the same value handed to
15616+ // `encode_10bit_gradients_seed` (15469), which renders
15617+ // `frames / 25.0` seconds at `rate=25` (15928, 15940) and runs
15618+ // aomenc with no `--limit` of its own, so the stream codes exactly
15619+ // `frames` frames: 1 for the single-key-frame callers, 24 for the
15620+ // `--lag-in-frames=16` inter callers. Asserted ABOVE the oracle call,
15621+ // so a decode that showed fewer reds naming the encode rather than
15622+ // handing ffmpeg the same short count.
15623+ assert_eq!(
15624+ decoded.len(),
15625+ frames,
15626+ "{name}: seed {seed}: the encode codes {frames} frame(s), the decode showed {}",
15627+ decoded.len()
15628+ );
15595 let reference = ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len());15629 let reference = ffmpeg_decode_sequence_10bit(&stream, width, height, decoded.len());
15596 assert_eq!(15630 assert_eq!(
15597 decoded.len(),15631 decoded.len(),