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> {
8299 Some(bits)8299 Some(bits)
8300 }8300 }
8301 8301
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+
8302 /// Whether an extra reference (GOLDEN/ALTREF) is offered a `NEWMV` of its8313 /// Whether an extra reference (GOLDEN/ALTREF) is offered a `NEWMV` of its
8303 /// own -- a second motion search per block against that reference's picture,8314 /// own -- a second motion search per block against that reference's picture,
8304 /// priced off that reference's own stack. `EC_AV1_MV_EXTRA_NEW=0` turns it8315 /// priced off that reference's own stack. `EC_AV1_MV_EXTRA_NEW=0` turns it
@@ -9410,8 +9421,15 @@ fn search_inter_block(
9410 // prices out `margin` times better than LAST's best vector does --9421 // prices out `margin` times better than LAST's best vector does --
9411 // one candidate evaluation (`motion::cost_at`) standing in for a9422 // one candidate evaluation (`motion::cost_at`) standing in for a
9412 // whole search of ~50.9423 // 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());
9413 let margin = extra_new_skip_margin();9431 let margin = extra_new_skip_margin();
9414- let skip_search = extra_ref_new_mv()9432+ let skip_search = searched
9415 && margin > 0.09433 && margin > 0.0
9416 && motion::cost_at(9434 && motion::cost_at(
9417 &g.y,9435 &g.y,
@@ -9429,7 +9447,7 @@ fn search_inter_block(
9429 fctx,9447 fctx,
9430 ) * margin9448 ) * margin
9431 <= found.cost;9449 <= found.cost;
9432- if extra_ref_new_mv() && !skip_search {9450+ if searched && !skip_search {
9433 let (gseeds, gn) = mv_seeds(gstack);9451 let (gseeds, gn) = mv_seeds(gstack);
9434 #[cfg(test)]9452 #[cfg(test)]
9435 let t = stage_start();9453 let t = stage_start();