forge
Explore
Log in

Don't you dare go Hollow

EC_AV1_LAST2_NEW -- the search-free LAST2 arm

Browse files at this commit

bcfe7e8d261b134840438ac12fa8fc179029fd61Ahmet Kaan GümüşParent: 9563c9f
  • feat
    • EC_AV1_LAST2_NEW -- the search-free LAST2 arm
    • native gate prints the reference census
Show full message
feat(av1): EC_AV1_LAST2_NEW -- the search-free LAST2 arm; native gate prints the reference census
crates/ec-av1/src/encode.rsmodified+20 -2
@@ -8299,6 +8299,17 @@ fn mv_component_bits(diff: i32) -> Option<f64> {
82998299 Some(bits)
83008300 }
83018301
8302+/// Whether `LAST2_FRAME` gets a `NEWMV` search of its own beside the
8303+/// neighbour-derived modes ([`extra_ref_new_mv`]'s per-reference switch,
8304+/// `EC_AV1_LAST2_NEW=0`): the charter's "free arm", i.e. the reference's
8305+/// value without the second motion search's wall.
8306+fn last2_new_mv() -> bool {
8307+ match std::env::var("EC_AV1_LAST2_NEW").ok() {
8308+ Some(v) => v != "0",
8309+ None => true,
8310+ }
8311+}
8312+
83028313 /// Whether an extra reference (GOLDEN/ALTREF) is offered a `NEWMV` of its
83038314 /// own -- a second motion search per block against that reference's picture,
83048315 /// priced off that reference's own stack. `EC_AV1_MV_EXTRA_NEW=0` turns it
@@ -9410,8 +9421,15 @@ fn search_inter_block(
94109421 // prices out `margin` times better than LAST's best vector does --
94119422 // one candidate evaluation (`motion::cost_at`) standing in for a
94129423 // whole search of ~50.
9424+ // lane-last2: the SEARCH-FREE arm for the second past leaf picture
9425+ // (`EC_AV1_LAST2_NEW=0`) -- LAST2 is then coded only at a vector some
9426+ // neighbour already found, which is how GOLDEN/ALTREF were offered
9427+ // before `EXTRA_REF_NEW_MV`, and it is what separates the reference's
9428+ // own value from the second motion search's wall.
9429+ let searched = extra_ref_new_mv()
9430+ && (ref_frame != crate::mvstack::LAST2_FRAME || last2_new_mv());
94139431 let margin = extra_new_skip_margin();
9414- let skip_search = extra_ref_new_mv()
9432+ let skip_search = searched
94159433 && margin > 0.0
94169434 && motion::cost_at(
94179435 &g.y,
@@ -9429,7 +9447,7 @@ fn search_inter_block(
94299447 fctx,
94309448 ) * margin
94319449 <= found.cost;
9432- if extra_ref_new_mv() && !skip_search {
9450+ if searched && !skip_search {
94339451 let (gseeds, gn) = mv_seeds(gstack);
94349452 #[cfg(test)]
94359453 let t = stage_start();