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() {
29 }29 }
30 };30 };
31 let report = || {31 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+ }
32 let (sc, dp) = ec_av1::decode::reelc_chroma_counters();37 let (sc, dp) = ec_av1::decode::reelc_chroma_counters();
33 println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}");38 println!("reelc_chroma: skip_cfl={sc} dir_1to4_pairs={dp}");
34 let (h, v, c) = ec_av1::stream::rect4_32_counters();39 let (h, v, c) = ec_av1::stream::rect4_32_counters();
crates/ec-av1/src/decode.rsmodified+2 -4
@@ -260,7 +260,6 @@ thread_local! {
260 /// Called by [`crate::stream::decode_stream`] before each frame's tiles with260 /// Called by [`crate::stream::decode_stream`] before each frame's tiles with
261 /// that frame's DECODE-order index.261 /// that frame's DECODE-order index.
262 pub fn set_coeff_trace_frame(idx: usize) {262 pub fn set_coeff_trace_frame(idx: usize) {
263- hit_do! {
264 COEFF_TRACE_FRAME.with(|c| {263 COEFF_TRACE_FRAME.with(|c| {
265 if c.get().is_none() {264 if c.get().is_none() {
266 let want = match crate::envflags::var("EC_TRACE_COEFF_FRAME") {265 let want = match crate::envflags::var("EC_TRACE_COEFF_FRAME") {
@@ -271,7 +270,6 @@ pub fn set_coeff_trace_frame(idx: usize) {
271 c.set(Some(want));270 c.set(Some(want));
272 }271 }
273 });272 });
274- }
275 COEFF_TRACE_CUR.with(|c| c.set(idx));273 COEFF_TRACE_CUR.with(|c| c.set(idx));
276 if crate::envflags::env_flag!("EC_TRACE_COEFF") {274 if crate::envflags::env_flag!("EC_TRACE_COEFF") {
277 eprintln!("EC_COEFF_FRAME decode_idx={idx}");275 eprintln!("EC_COEFF_FRAME decode_idx={idx}");
@@ -24924,7 +24922,7 @@ fn decode_inter_block(
24924 // (8x4 / 4x8 at the even strip's origin) and is coded only by the odd24922 // (8x4 / 4x8 at the even strip's origin) and is coded only by the odd
24925 // strip (`is_chroma_reference`); every other block keeps its own.24923 // strip (`is_chroma_reference`); every other block keeps its own.
24926 let strip_chroma = fctx.inter_strip_chroma.with(std::cell::Cell::take);24924 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));
24928 let has_chroma = strip_chroma.is_none_or(|s| s.has_chroma);24926 let has_chroma = strip_chroma.is_none_or(|s| s.has_chroma);
24929 let (cpx, cpy) = match strip_chroma {24927 let (cpx, cpy) = match strip_chroma {
24930 Some(s) if s.has_chroma => (s.pair_mi.1 * MI / 2, s.pair_mi.0 * MI / 2),24928 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(
26934 // PREVIOUS strip's `mv`/`ref_frame`/`interp_filters`26932 // PREVIOUS strip's `mv`/`ref_frame`/`interp_filters`
26935 // (reconinter_template.inc:75-82); record them for the next 1:426933 // (reconinter_template.inc:75-82); record them for the next 1:4
26936 // strip, which is the only reader.26934 // 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))));
26938 // lane-defer8: the sub-8x8 chroma piece's own reference resolved to26936 // lane-defer8: the sub-8x8 chroma piece's own reference resolved to
26939 // a SIZE here and to pixels inside the closure, like the block's own.26937 // a SIZE here and to pixels inside the closure, like the block's own.
26940 let sub8 = match strip_chroma.filter(|s| s.has_chroma).and_then(|s| s.prev.map(|p| (s.horz, p))) {26938 let sub8 = match strip_chroma.filter(|s| s.has_chroma).and_then(|s| s.prev.map(|p| (s.horz, p))) {