forge
Explore
Log in

Don't you dare go Hollow

stream: pin the encode's frame count in the intrabc rect/census family

Browse files at this commit

8644bc7656d99ff1714367b445eaa8a43a101764Ahmet Kaan GümüşParent: 6867062
Seven sites across the coded-rect-intrabc gate (both the arms and skip_arms
loops), the sb128 screen intrabc gate, the two intrabc censuses, the mixed
vart-tx tree gate and the tx-mode-select gate. All encode through
screen_intrabc_stream_at_depth, which renders '-t 0.2' at rate 25 with
'-vf tile=2x2' (5 frames in, 1 tiled frame out) and runs aomenc with
'--limit=1', so every arm codes exactly 1 frame.

The two censuses are report-only about their COUNTS, but their Ok arms assert
pixel-exactness, so the budget handed to ffmpeg there is pinned for the same
reason as everywhere else. The skip_arms loop re-decodes the same bytes at
each recon-thread count, so one assert covers both of that loop's sites.

count-vacuity sweep: 36 unpinned -> 29.
crates/ec-av1/src/stream.rsmodified+53 -0
@@ -11880,6 +11880,11 @@ pub(crate) mod tests {
1188011880 reader for this orientation is untested (coded horz/vert = {coded:?})",
1188111881 if *want_orient == 0 { "HORZ" } else { "VERT" }
1188211882 );
11883+ // The ENCODE's frame count: the per-arm render (11756) uses `-t 0.2`
11884+ // at TS256/TS512's `rate=25` (11700, 11701) -- 5 input frames -- and
11885+ // the aomenc args carry `--limit=1` (11797), so all three arms code
11886+ // exactly 1 frame. Asserted ABOVE the oracle call.
11887+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1188311888 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());
1188411889 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
1188511890 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12023,6 +12028,16 @@ pub(crate) mod tests {
1202312028 !frames.is_empty(),
1202412029 "{NAME}: {arm} decoded no frame at {threads} recon thread(s)"
1202512030 );
12031+ // The ENCODE's frame count: the skip_arms encode (11904) renders
12032+ // TS512 with `-t 0.2` at `rate=25` (11907) and its aomenc runs
12033+ // with `--limit=1` (11945), so the stream holds 1 coded frame --
12034+ // and this loop re-decodes those SAME bytes at each `threads`
12035+ // value, so the count is arm-invariant. Asserted ABOVE the call.
12036+ assert_eq!(
12037+ frames.len(),
12038+ 1,
12039+ "{NAME}: {arm} key frame at {threads} recon thread(s)"
12040+ );
1202612041 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());
1202712042 assert_eq!(
1202812043 frames.len(),
@@ -12265,6 +12280,14 @@ pub(crate) mod tests {
1226512280 let blocks = crate::decode::intrabc_hits();
1226612281 blocks_total += blocks;
1226712282 blocks_at_depth[usize::from(depth == 10)] += blocks;
12283+ // The ENCODE's frame count:
12284+ // `screen_intrabc_stream_at_depth` (12203) renders
12285+ // `smptebars=size=128x96:rate=25` with `-t 0.2` and
12286+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame
12287+ // out at 256x192 -- and its aomenc runs with `--limit=1`
12288+ // (12101), so all eight (depth, txs, cq) arms code exactly
12289+ // 1 frame. Asserted ABOVE the oracle call.
12290+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1226812291 let theirs = if depth == 10 {
1226912292 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
1227012293 } else {
@@ -12654,6 +12677,15 @@ pub(crate) mod tests {
1265412677 Ok(frames) => {
1265512678 let sub8 = crate::decode::sub8_split_hits() - sub8_before;
1265612679 sub8_total += sub8;
12680+ // The ENCODE's frame count: `screen_intrabc_stream_with` (12593)
12681+ // renders `smptebars=size=128x96:rate=25` with `-t 0.2` and
12682+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame
12683+ // out -- and its aomenc runs with `--limit=1` (12101), so both
12684+ // cq arms code exactly 1 frame. The census is report-only about
12685+ // the COUNTS, but its Ok arm asserts pixel-exactness, so the
12686+ // budget handed to ffmpeg is pinned here rather than derived
12687+ // from the decode under test.
12688+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1265712689 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1265812690 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
1265912691 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12729,6 +12761,15 @@ pub(crate) mod tests {
1272912761 Ok(frames) => {
1273012762 let vartx = crate::decode::intrabc_vartx_hits();
1273112763 vartx_total += vartx;
12764+ // The ENCODE's frame count: `screen_intrabc_stream` (12679)
12765+ // renders `smptebars=size=128x96:rate=25` with `-t 0.2` and
12766+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame
12767+ // out -- and its aomenc runs with `--limit=1` (12101), so all
12768+ // four cq arms code exactly 1 frame. The census is
12769+ // report-only about the COUNTS, but its Ok arm does assert
12770+ // pixel-exactness, so the budget it hands ffmpeg is pinned
12771+ // here rather than derived from the decode under test.
12772+ assert_eq!(frames.len(), 1, "{NAME}: {arm} key frame");
1273212773 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1273312774 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
1273412775 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12833,6 +12874,12 @@ pub(crate) mod tests {
1283312874 "{NAME}: vacuous -- {trees} var-tx tree(s), {mixed} mixed: the \
1283412875 capability this gate pins was never exercised"
1283512876 );
12877+ // The ENCODE's frame count: `screen_intrabc_stream_with` (12766)
12878+ // renders `testsrc2=size=320x180:rate=25` with `-t 0.2` and
12879+ // `-vf tile=2x2` (12066, 12069) -- 5 frames in, 1 tiled frame out
12880+ // at 640x360 -- and its aomenc runs with `--limit=1` (12101), so
12881+ // the stream codes exactly 1 frame. Asserted ABOVE the call.
12882+ assert_eq!(frames.len(), 1, "{NAME}: key frame");
1283612883 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1283712884 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");
1283812885 let mut mismatched = 0usize;
@@ -13135,6 +13182,12 @@ pub(crate) mod tests {
1313513182 "{NAME}: cq={cq} no longer reads the inter var-tx tree for an intrabc block"
1313613183 );
1313713184 eprintln!("{NAME}: cq={cq} {blocks} intrabc block(s), {vartx} through var-tx");
13185+ // The ENCODE's frame count: `screen_intrabc_stream` (12022) renders
13186+ // `smptebars=size=128x96:rate=25` with `-t 0.2` and `-vf tile=2x2`
13187+ // (12066, 12069) -- 5 frames in, 1 tiled frame out -- and its aomenc
13188+ // runs with `--limit=1` (12101), so both cq arms code exactly 1
13189+ // frame. Asserted ABOVE the oracle call.
13190+ assert_eq!(frames.len(), 1, "{NAME}: cq={cq} key frame");
1313813191 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
1313913192 assert_eq!(frames.len(), theirs.len(), "{NAME}: cq={cq} frame count");
1314013193 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {