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 {
11880 reader for this orientation is untested (coded horz/vert = {coded:?})",11880 reader for this orientation is untested (coded horz/vert = {coded:?})",
11881 if *want_orient == 0 { "HORZ" } else { "VERT" }11881 if *want_orient == 0 { "HORZ" } else { "VERT" }
11882 );11882 );
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");
11883 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());11888 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());
11884 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");11889 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
11885 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {11890 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12023,6 +12028,16 @@ pub(crate) mod tests {
12023 !frames.is_empty(),12028 !frames.is_empty(),
12024 "{NAME}: {arm} decoded no frame at {threads} recon thread(s)"12029 "{NAME}: {arm} decoded no frame at {threads} recon thread(s)"
12025 );12030 );
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+ );
12026 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());12041 let theirs = ffmpeg_decode_sequence(&stream, *width, *height, frames.len());
12027 assert_eq!(12042 assert_eq!(
12028 frames.len(),12043 frames.len(),
@@ -12265,6 +12280,14 @@ pub(crate) mod tests {
12265 let blocks = crate::decode::intrabc_hits();12280 let blocks = crate::decode::intrabc_hits();
12266 blocks_total += blocks;12281 blocks_total += blocks;
12267 blocks_at_depth[usize::from(depth == 10)] += blocks;12282 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");
12268 let theirs = if depth == 10 {12291 let theirs = if depth == 10 {
12269 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())12292 ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len())
12270 } else {12293 } else {
@@ -12654,6 +12677,15 @@ pub(crate) mod tests {
12654 Ok(frames) => {12677 Ok(frames) => {
12655 let sub8 = crate::decode::sub8_split_hits() - sub8_before;12678 let sub8 = crate::decode::sub8_split_hits() - sub8_before;
12656 sub8_total += sub8;12679 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");
12657 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());12689 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
12658 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");12690 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
12659 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {12691 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12729,6 +12761,15 @@ pub(crate) mod tests {
12729 Ok(frames) => {12761 Ok(frames) => {
12730 let vartx = crate::decode::intrabc_vartx_hits();12762 let vartx = crate::decode::intrabc_vartx_hits();
12731 vartx_total += vartx;12763 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");
12732 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());12773 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
12733 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");12774 assert_eq!(frames.len(), theirs.len(), "{NAME}: {arm} frame count");
12734 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {12775 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
@@ -12833,6 +12874,12 @@ pub(crate) mod tests {
12833 "{NAME}: vacuous -- {trees} var-tx tree(s), {mixed} mixed: the \12874 "{NAME}: vacuous -- {trees} var-tx tree(s), {mixed} mixed: the \
12834 capability this gate pins was never exercised"12875 capability this gate pins was never exercised"
12835 );12876 );
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");
12836 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());12883 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
12837 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");12884 assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");
12838 let mut mismatched = 0usize;12885 let mut mismatched = 0usize;
@@ -13135,6 +13182,12 @@ pub(crate) mod tests {
13135 "{NAME}: cq={cq} no longer reads the inter var-tx tree for an intrabc block"13182 "{NAME}: cq={cq} no longer reads the inter var-tx tree for an intrabc block"
13136 );13183 );
13137 eprintln!("{NAME}: cq={cq} {blocks} intrabc block(s), {vartx} through var-tx");13184 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");
13138 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());13191 let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
13139 assert_eq!(frames.len(), theirs.len(), "{NAME}: cq={cq} frame count");13192 assert_eq!(frames.len(), theirs.len(), "{NAME}: cq={cq} frame count");
13140 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {13193 for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {