forge
Explore
Log in

Don't you dare go Hollow

Pin Option<MiInfo> at 32 bytes or less

Browse files at this commit

4bb93100b64ae1170c1e890087a96ec867197226Ahmet Kaan GümüşParent: 77576dd
  • test
    • pin Option<MiInfo> at 32 bytes or less
Show full message
test(av1): pin Option<MiInfo> at 32 bytes or less

The 4K mi grid is ~518k cells refilled per frame and walked by every mv-stack
scan, so a widened field here is a measurable throughput regression rather
than a free change.
crates/ec-av1/src/mvstack.rsmodified+13 -0
@@ -2390,6 +2390,19 @@ pub(crate) fn comp_reference_type_ctx(
2390 2390
2391 #[cfg(test)]2391 #[cfg(test)]
2392 mod tests {2392 mod tests {
2393+ /// lane-mi: a 4K frame's grid is ~518k cells, refilled per frame, and
2394+ /// every mv-stack scan walks it -- `size`/`size_h` as `u8` keep the
2395+ /// option under 32 bytes. Widening a field here is a measurable
2396+ /// regression, not a free change.
2397+ #[test]
2398+ fn mi_info_stays_small_enough_for_a_4k_grid() {
2399+ assert!(
2400+ std::mem::size_of::<Option<MiInfo>>() <= 32,
2401+ "Option<MiInfo> grew to {} bytes",
2402+ std::mem::size_of::<Option<MiInfo>>()
2403+ );
2404+ }
2405+
2393 use super::*;2406 use super::*;
2394 2407
2395 fn inter(mv: (i32, i32)) -> MiInfo {2408 fn inter(mv: (i32, i32)) -> MiInfo {