forge
Explore
Log in

Don't you dare go Hollow

Inter_last_mc and the coeff-trace latch are state, not counters -- unwrap them

Browse files at this commit

3c710ecbadca4830d4d0c6a4319bfc51a07887d7Ahmet Kaan GümüşParent: 04187f1
  • fix
    • inter_last_mc and the coeff-trace latch are state, not counters -- unwrap them
Show full message
fix(av1): inter_last_mc and the coeff-trace latch are state, not counters -- unwrap them
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
@@ -29,6 +29,11 @@ fn main() {
2929 }
3030 };
3131 let report = || {
32+ // The census below reads ec-av1's gate counters; without the crate's
33+ // `gate-counters` feature every one of them is compiled out and reads 0.
34+ if !cfg!(feature = "gate-counters") {
35+ println!("counters disabled (built without the gate-counters feature)");
36+ }
3237 let (sc, dp) = ec_av1::decode::reelc_chroma_counters();
3338 println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}");
3439 let (h, v, c) = ec_av1::stream::rect4_32_counters();
crates/ec-av1/src/decode.rsmodified+12 -14
@@ -260,18 +260,16 @@ thread_local! {
260260 /// Called by [`crate::stream::decode_stream`] before each frame's tiles with
261261 /// that frame's DECODE-order index.
262262 pub fn set_coeff_trace_frame(idx: usize) {
263- hit_do! {
264- COEFF_TRACE_FRAME.with(|c| {
265- if c.get().is_none() {
266- let want = match crate::envflags::var("EC_TRACE_COEFF_FRAME") {
267- Ok(v) => v.parse::<usize>().unwrap_or(usize::MAX),
268- // unset: keep tracing every frame, as before this rung existed
269- Err(_) => usize::MAX - 1,
270- };
271- c.set(Some(want));
272- }
273- });
274- }
263+ COEFF_TRACE_FRAME.with(|c| {
264+ if c.get().is_none() {
265+ let want = match crate::envflags::var("EC_TRACE_COEFF_FRAME") {
266+ Ok(v) => v.parse::<usize>().unwrap_or(usize::MAX),
267+ // unset: keep tracing every frame, as before this rung existed
268+ Err(_) => usize::MAX - 1,
269+ };
270+ c.set(Some(want));
271+ }
272+ });
275273 COEFF_TRACE_CUR.with(|c| c.set(idx));
276274 if crate::envflags::env_flag!("EC_TRACE_COEFF") {
277275 eprintln!("EC_COEFF_FRAME decode_idx={idx}");
@@ -24924,7 +24922,7 @@ fn decode_inter_block(
2492424922 // (8x4 / 4x8 at the even strip's origin) and is coded only by the odd
2492524923 // strip (`is_chroma_reference`); every other block keeps its own.
2492624924 let strip_chroma = fctx.inter_strip_chroma.with(std::cell::Cell::take);
24927- hit_do! { fctx.inter_last_mc.with(|c| c.set(None)); }
24925+ fctx.inter_last_mc.with(|c| c.set(None));
2492824926 let has_chroma = strip_chroma.is_none_or(|s| s.has_chroma);
2492924927 let (cpx, cpy) = match strip_chroma {
2493024928 Some(s) if s.has_chroma => (s.pair_mi.1 * MI / 2, s.pair_mi.0 * MI / 2),
@@ -26934,7 +26932,7 @@ fn decode_inter_block(
2693426932 // PREVIOUS strip's `mv`/`ref_frame`/`interp_filters`
2693526933 // (reconinter_template.inc:75-82); record them for the next 1:4
2693626934 // strip, which is the only reader.
26937- hit_do! { fctx.inter_last_mc.with(|c| c.set(Some((ref_frame, mv, h_filter, v_filter)))); }
26935+ fctx.inter_last_mc.with(|c| c.set(Some((ref_frame, mv, h_filter, v_filter))));
2693826936 // lane-defer8: the sub-8x8 chroma piece's own reference resolved to
2693926937 // a SIZE here and to pixels inside the closure, like the block's own.
2694026938 let sub8 = match strip_chroma.filter(|s| s.has_chroma).and_then(|s| s.prev.map(|p| (s.horz, p))) {