wip(av1): r6 -- sweep clean, class sweep clean, CURRENT_OP scaffolding removed
Browse files at this commita3b0b8a9aa87fb39b8bc94105c3ce2e4963f1c5dParent: 2b9615f2 changed files +0 -119
- crates/ec-av1/src/decode.rs +0 -102
- crates/ec-av1/src/msac.rs +0 -17
crates/ec-av1/src/decode.rsmodified+0 -102
| @@ -521,7 +521,6 @@ fn read_eob(dec: &mut SymbolDecoder, coding: &mut TxbTables, class: TxClass) -> | |||
| 521 | (TxClass::TwoD, _) | (_, None) => coding.eob_pt, | 521 | (TxClass::TwoD, _) | (_, None) => coding.eob_pt, |
| 522 | (_, Some(class1)) => class1, | 522 | (_, Some(class1)) => class1, |
| 523 | }; | 523 | }; |
| 524 | - crate::msac::CURRENT_OP.with(|c| c.set("L524")); | ||
| 525 | let group = dec.symbol(eob_pt) + 1; | 524 | let group = dec.symbol(eob_pt) + 1; |
| 526 | if trace { | 525 | if trace { |
| 527 | eprintln!("TRACE eob_pt value={group}"); | 526 | eprintln!("TRACE eob_pt value={group}"); |
| @@ -529,7 +528,6 @@ fn read_eob(dec: &mut SymbolDecoder, coding: &mut TxbTables, class: TxClass) -> | |||
| 529 | let bits = OFFSET_BITS[group]; | 528 | let bits = OFFSET_BITS[group]; |
| 530 | let mut offset = 0u32; | 529 | let mut offset = 0u32; |
| 531 | if bits > 0 { | 530 | if bits > 0 { |
| 532 | - crate::msac::CURRENT_OP.with(|c| c.set("L531")); | ||
| 533 | let top = dec.symbol(&mut coding.eob_extra[group - 3]) as u32; | 531 | let top = dec.symbol(&mut coding.eob_extra[group - 3]) as u32; |
| 534 | if trace { | 532 | if trace { |
| 535 | eprintln!("TRACE eob_extra ctx={} value={top}", group - 3); | 533 | eprintln!("TRACE eob_extra ctx={} value={top}", group - 3); |
| @@ -592,7 +590,6 @@ fn read_coeffs( | |||
| 592 | let trace = std::env::var_os("EC_AV1_TRACE").is_some(); | 590 | let trace = std::env::var_os("EC_AV1_TRACE").is_some(); |
| 593 | let side = coding.side; | 591 | let side = coding.side; |
| 594 | let mut grid = vec![0i32; side * side]; | 592 | let mut grid = vec![0i32; side * side]; |
| 595 | - crate::msac::CURRENT_OP.with(|c| c.set("L593")); | ||
| 596 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; | 593 | let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; |
| 597 | if trace { | 594 | if trace { |
| 598 | eprintln!("TRACE all_zero ctx={skip_ctx} value={}", all_zero as i32); | 595 | eprintln!("TRACE all_zero ctx={skip_ctx} value={}", all_zero as i32); |
| @@ -606,7 +603,6 @@ fn read_coeffs( | |||
| 606 | // `TX_SET_INTRA_1`, 5 (6 slots) the reduced `TX_SET_INTRA_2` (the | 603 | // `TX_SET_INTRA_1`, 5 (6 slots) the reduced `TX_SET_INTRA_2` (the |
| 607 | // inter sets we read share set 2's symbol order). | 604 | // inter sets we read share set 2's symbol order). |
| 608 | let set1 = tx_type_cdf.len() == 8; | 605 | let set1 = tx_type_cdf.len() == 8; |
| 609 | - crate::msac::CURRENT_OP.with(|c| c.set("L606")); | ||
| 610 | let t = dec.symbol(tx_type_cdf); | 606 | let t = dec.symbol(tx_type_cdf); |
| 611 | if trace { | 607 | if trace { |
| 612 | eprintln!("TRACE tx_type value={t} set1={set1}"); | 608 | eprintln!("TRACE tx_type value={t} set1={set1}"); |
| @@ -640,7 +636,6 @@ fn read_coeffs( | |||
| 640 | let (row, col) = (pos / side, pos % side); | 636 | let (row, col) = (pos / side, pos % side); |
| 641 | let level = if scan_idx == eob - 1 { | 637 | let level = if scan_idx == eob - 1 { |
| 642 | let ctx = eob_coeff_ctx(scan_idx, side * side); | 638 | let ctx = eob_coeff_ctx(scan_idx, side * side); |
| 643 | - crate::msac::CURRENT_OP.with(|c| c.set("L639")); | ||
| 644 | let v = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1; | 639 | let v = dec.symbol(&mut coding.base_eob[ctx]) as i32 + 1; |
| 645 | if trace { | 640 | if trace { |
| 646 | eprintln!( | 641 | eprintln!( |
| @@ -650,7 +645,6 @@ fn read_coeffs( | |||
| 650 | v | 645 | v |
| 651 | } else { | 646 | } else { |
| 652 | let ctx = base_ctx(&levels, side, row, col, class); | 647 | let ctx = base_ctx(&levels, side, row, col, class); |
| 653 | - crate::msac::CURRENT_OP.with(|c| c.set("L648")); | ||
| 654 | let v = dec.symbol(&mut coding.base[ctx]) as i32; | 648 | let v = dec.symbol(&mut coding.base[ctx]) as i32; |
| 655 | if trace { | 649 | if trace { |
| 656 | eprintln!( | 650 | eprintln!( |
| @@ -664,7 +658,6 @@ fn read_coeffs( | |||
| 664 | let mut level = level; | 658 | let mut level = level; |
| 665 | let mut sent = 0; | 659 | let mut sent = 0; |
| 666 | loop { | 660 | loop { |
| 667 | - crate::msac::CURRENT_OP.with(|c| c.set("L661")); | ||
| 668 | let k = dec.symbol(&mut coding.br[ctx]) as i32; | 661 | let k = dec.symbol(&mut coding.br[ctx]) as i32; |
| 669 | if trace { | 662 | if trace { |
| 670 | eprintln!( | 663 | eprintln!( |
| @@ -690,7 +683,6 @@ fn read_coeffs( | |||
| 690 | continue; | 683 | continue; |
| 691 | } | 684 | } |
| 692 | let negative = if pos == 0 { | 685 | let negative = if pos == 0 { |
| 693 | - crate::msac::CURRENT_OP.with(|c| c.set("L686")); | ||
| 694 | let v = dec.symbol(&mut coding.dc_sign[sign_ctx]) == 1; | 686 | let v = dec.symbol(&mut coding.dc_sign[sign_ctx]) == 1; |
| 695 | if trace { | 687 | if trace { |
| 696 | eprintln!("TRACE dc_sign ctx={sign_ctx} value={}", v as i32); | 688 | eprintln!("TRACE dc_sign ctx={sign_ctx} value={}", v as i32); |
| @@ -1265,7 +1257,6 @@ fn filter_intra_size_class(side: usize) -> Option<usize> { | |||
| 1265 | /// delta [`crate::intra::predict`] wants; bumps [`ANGLE_DELTA_HITS`] whenever | 1257 | /// delta [`crate::intra::predict`] wants; bumps [`ANGLE_DELTA_HITS`] whenever |
| 1266 | /// it lands away from zero, for gate tests to prove a real stream fired one. | 1258 | /// it lands away from zero, for gate tests to prove a real stream fired one. |
| 1267 | fn read_angle_delta(dec: &mut SymbolDecoder, cdf: &mut [u16]) -> i32 { | 1259 | fn read_angle_delta(dec: &mut SymbolDecoder, cdf: &mut [u16]) -> i32 { |
| 1268 | - crate::msac::CURRENT_OP.with(|c| c.set("L1260")); | ||
| 1269 | let symbol = dec.symbol(cdf); | 1260 | let symbol = dec.symbol(cdf); |
| 1270 | if symbol != ANGLE_DELTA_ZERO { | 1261 | if symbol != ANGLE_DELTA_ZERO { |
| 1271 | ANGLE_DELTA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 1262 | ANGLE_DELTA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| @@ -1291,14 +1282,12 @@ fn read_intra_mode( | |||
| 1291 | Option<usize>, | 1282 | Option<usize>, |
| 1292 | )> { | 1283 | )> { |
| 1293 | let trace = std::env::var_os("EC_AV1_TRACE").is_some(); | 1284 | let trace = std::env::var_os("EC_AV1_TRACE").is_some(); |
| 1294 | - crate::msac::CURRENT_OP.with(|c| c.set("L1285")); | ||
| 1295 | let skip = dec.symbol(&mut cdfs.skip[0]) != 0; | 1285 | let skip = dec.symbol(&mut cdfs.skip[0]) != 0; |
| 1296 | if trace { | 1286 | if trace { |
| 1297 | eprintln!("TRACE skip value={}", skip as i32); | 1287 | eprintln!("TRACE skip value={}", skip as i32); |
| 1298 | } | 1288 | } |
| 1299 | let above_ctx = INTRA_MODE_CTX[above_mode]; | 1289 | let above_ctx = INTRA_MODE_CTX[above_mode]; |
| 1300 | let left_ctx = INTRA_MODE_CTX[left_mode]; | 1290 | let left_ctx = INTRA_MODE_CTX[left_mode]; |
| 1301 | - crate::msac::CURRENT_OP.with(|c| c.set("L1291")); | ||
| 1302 | let mode = dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]); | 1291 | let mode = dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]); |
| 1303 | if trace { | 1292 | if trace { |
| 1304 | eprintln!("TRACE y_mode ctx=({above_ctx},{left_ctx}) value={mode}"); | 1293 | eprintln!("TRACE y_mode ctx=({above_ctx},{left_ctx}) value={mode}"); |
| @@ -1316,10 +1305,8 @@ fn read_intra_mode( | |||
| 1316 | 0 | 1305 | 0 |
| 1317 | }; | 1306 | }; |
| 1318 | let uv_mode = if cfl { | 1307 | let uv_mode = if cfl { |
| 1319 | - crate::msac::CURRENT_OP.with(|c| c.set("L1308")); | ||
| 1320 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) | 1308 | dec.symbol(&mut cdfs.uv_mode_cfl[mode]) |
| 1321 | } else { | 1309 | } else { |
| 1322 | - crate::msac::CURRENT_OP.with(|c| c.set("L1310")); | ||
| 1323 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) | 1310 | dec.symbol(&mut cdfs.uv_mode_no_cfl[mode]) |
| 1324 | }; | 1311 | }; |
| 1325 | if trace { | 1312 | if trace { |
| @@ -1363,7 +1350,6 @@ fn read_intra_mode( | |||
| 1363 | && enable_filter_intra | 1350 | && enable_filter_intra |
| 1364 | && let Some(class) = filter_intra_size_class(side) | 1351 | && let Some(class) = filter_intra_size_class(side) |
| 1365 | { | 1352 | { |
| 1366 | - crate::msac::CURRENT_OP.with(|c| c.set("L1353")); | ||
| 1367 | let use_filter_intra = dec.symbol(&mut cdfs.filter_intra[class]) != 0; | 1353 | let use_filter_intra = dec.symbol(&mut cdfs.filter_intra[class]) != 0; |
| 1368 | if trace { | 1354 | if trace { |
| 1369 | eprintln!( | 1355 | eprintln!( |
| @@ -1373,7 +1359,6 @@ fn read_intra_mode( | |||
| 1373 | } | 1359 | } |
| 1374 | if use_filter_intra { | 1360 | if use_filter_intra { |
| 1375 | FILTER_INTRA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 1361 | FILTER_INTRA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 1376 | - crate::msac::CURRENT_OP.with(|c| c.set("L1362")); | ||
| 1377 | let fi_mode = dec.symbol(&mut cdfs.filter_intra_mode); | 1362 | let fi_mode = dec.symbol(&mut cdfs.filter_intra_mode); |
| 1378 | if trace { | 1363 | if trace { |
| 1379 | eprintln!("TRACE filter_intra_mode value={fi_mode}"); | 1364 | eprintln!("TRACE filter_intra_mode value={fi_mode}"); |
| @@ -1404,7 +1389,6 @@ const UV_CFL_PRED: usize = 13; | |||
| 1404 | /// joint sign the same way. Returns each plane's final signed `alpha_q3` | 1389 | /// joint sign the same way. Returns each plane's final signed `alpha_q3` |
| 1405 | /// (`cfl_idx_to_alpha`, cfl.c): magnitude `idx + 1`, sign-zero collapsing to 0. | 1390 | /// (`cfl_idx_to_alpha`, cfl.c): magnitude `idx + 1`, sign-zero collapsing to 0. |
| 1406 | fn read_cfl_alphas(dec: &mut SymbolDecoder, cdfs: &mut Cdfs) -> (i32, i32) { | 1391 | fn read_cfl_alphas(dec: &mut SymbolDecoder, cdfs: &mut Cdfs) -> (i32, i32) { |
| 1407 | - crate::msac::CURRENT_OP.with(|c| c.set("L1392")); | ||
| 1408 | let joint_sign = dec.symbol(&mut cdfs.cfl_sign) as i32; | 1392 | let joint_sign = dec.symbol(&mut cdfs.cfl_sign) as i32; |
| 1409 | let sign_u = ((joint_sign + 1) * 11) >> 5; | 1393 | let sign_u = ((joint_sign + 1) * 11) >> 5; |
| 1410 | let sign_v = (joint_sign + 1) - 3 * sign_u; | 1394 | let sign_v = (joint_sign + 1) - 3 * sign_u; |
| @@ -1412,7 +1396,6 @@ fn read_cfl_alphas(dec: &mut SymbolDecoder, cdfs: &mut Cdfs) -> (i32, i32) { | |||
| 1412 | 0 | 1396 | 0 |
| 1413 | } else { | 1397 | } else { |
| 1414 | let ctx_u = (joint_sign + 1 - 3) as usize; | 1398 | let ctx_u = (joint_sign + 1 - 3) as usize; |
| 1415 | - crate::msac::CURRENT_OP.with(|c| c.set("L1399")); | ||
| 1416 | let mag = dec.symbol(&mut cdfs.cfl_alpha[ctx_u]) as i32 + 1; | 1399 | let mag = dec.symbol(&mut cdfs.cfl_alpha[ctx_u]) as i32 + 1; |
| 1417 | if sign_u == 2 { mag } else { -mag } | 1400 | if sign_u == 2 { mag } else { -mag } |
| 1418 | }; | 1401 | }; |
| @@ -1420,7 +1403,6 @@ fn read_cfl_alphas(dec: &mut SymbolDecoder, cdfs: &mut Cdfs) -> (i32, i32) { | |||
| 1420 | 0 | 1403 | 0 |
| 1421 | } else { | 1404 | } else { |
| 1422 | let ctx_v = (sign_v * 3 + sign_u - 3) as usize; | 1405 | let ctx_v = (sign_v * 3 + sign_u - 3) as usize; |
| 1423 | - crate::msac::CURRENT_OP.with(|c| c.set("L1406")); | ||
| 1424 | let mag = dec.symbol(&mut cdfs.cfl_alpha[ctx_v]) as i32 + 1; | 1406 | let mag = dec.symbol(&mut cdfs.cfl_alpha[ctx_v]) as i32 + 1; |
| 1425 | if sign_v == 2 { mag } else { -mag } | 1407 | if sign_v == 2 { mag } else { -mag } |
| 1426 | }; | 1408 | }; |
| @@ -2607,19 +2589,15 @@ fn read_tx_size( | |||
| 2607 | let ctx = tx_size_context(n, at_mi, side); | 2589 | let ctx = tx_size_context(n, at_mi, side); |
| 2608 | let depth = match side { | 2590 | let depth = match side { |
| 2609 | 8 => { | 2591 | 8 => { |
| 2610 | - crate::msac::CURRENT_OP.with(|c| c.set("L2591")); | ||
| 2611 | dec.symbol(&mut cdfs.tx_size_cat0[ctx]) | 2592 | dec.symbol(&mut cdfs.tx_size_cat0[ctx]) |
| 2612 | } | 2593 | } |
| 2613 | 16 => { | 2594 | 16 => { |
| 2614 | - crate::msac::CURRENT_OP.with(|c| c.set("L2592")); | ||
| 2615 | dec.symbol(&mut cdfs.tx_size_cat1[ctx]) | 2595 | dec.symbol(&mut cdfs.tx_size_cat1[ctx]) |
| 2616 | } | 2596 | } |
| 2617 | 32 => { | 2597 | 32 => { |
| 2618 | - crate::msac::CURRENT_OP.with(|c| c.set("L2593")); | ||
| 2619 | dec.symbol(&mut cdfs.tx_size_cat2[ctx]) | 2598 | dec.symbol(&mut cdfs.tx_size_cat2[ctx]) |
| 2620 | } | 2599 | } |
| 2621 | 64 => { | 2600 | 64 => { |
| 2622 | - crate::msac::CURRENT_OP.with(|c| c.set("L2594")); | ||
| 2623 | dec.symbol(&mut cdfs.tx_size_cat3[ctx]) | 2601 | dec.symbol(&mut cdfs.tx_size_cat3[ctx]) |
| 2624 | } | 2602 | } |
| 2625 | _ => unreachable!("decode_block/decode_leaf8 only call this at 8/16/32/64"), | 2603 | _ => unreachable!("decode_block/decode_leaf8 only call this at 8/16/32/64"), |
| @@ -3330,7 +3308,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3330 | // mirroring [`crate::tile::sb_coeff_key_frame_tile`]'s own | 3308 | // mirroring [`crate::tile::sb_coeff_key_frame_tile`]'s own |
| 3331 | // three-way write exactly. | 3309 | // three-way write exactly. |
| 3332 | let part = if has_cols && has_rows { | 3310 | let part = if has_cols && has_rows { |
| 3333 | - crate::msac::CURRENT_OP.with(|c| c.set("L3303")); | ||
| 3334 | let p = dec.symbol(&mut cdfs.partition_w64[ctx]); | 3311 | let p = dec.symbol(&mut cdfs.partition_w64[ctx]); |
| 3335 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3312 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3336 | eprintln!("TRACE partition_w64 ctx={ctx} value={p}"); | 3313 | eprintln!("TRACE partition_w64 ctx={ctx} value={p}"); |
| @@ -3339,11 +3316,9 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3339 | } else { | 3316 | } else { |
| 3340 | match (has_cols, has_rows) { | 3317 | match (has_cols, has_rows) { |
| 3341 | (true, false) => { | 3318 | (true, false) => { |
| 3342 | - crate::msac::CURRENT_OP.with(|c| c.set("L3311")); | ||
| 3343 | dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], VERT_ALIKE)); | 3319 | dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], VERT_ALIKE)); |
| 3344 | } | 3320 | } |
| 3345 | (false, true) => { | 3321 | (false, true) => { |
| 3346 | - crate::msac::CURRENT_OP.with(|c| c.set("L3314")); | ||
| 3347 | dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], HORZ_ALIKE)); | 3322 | dec.symbol_fixed(&gather(&cdfs.partition_w64[ctx], HORZ_ALIKE)); |
| 3348 | } | 3323 | } |
| 3349 | _ => {} | 3324 | _ => {} |
| @@ -3390,7 +3365,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3390 | has_half(r32 * BLOCK_MI, BLOCK_MI, mi_rows), | 3365 | has_half(r32 * BLOCK_MI, BLOCK_MI, mi_rows), |
| 3391 | ); | 3366 | ); |
| 3392 | let part32 = if has_cols32 && has_rows32 { | 3367 | let part32 = if has_cols32 && has_rows32 { |
| 3393 | - crate::msac::CURRENT_OP.with(|c| c.set("L3360")); | ||
| 3394 | let p = dec.symbol(&mut cdfs.partition_w32[ctx32]); | 3368 | let p = dec.symbol(&mut cdfs.partition_w32[ctx32]); |
| 3395 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3369 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3396 | eprintln!( | 3370 | eprintln!( |
| @@ -3403,14 +3377,12 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3403 | } else { | 3377 | } else { |
| 3404 | match (has_cols32, has_rows32) { | 3378 | match (has_cols32, has_rows32) { |
| 3405 | (true, false) => { | 3379 | (true, false) => { |
| 3406 | - crate::msac::CURRENT_OP.with(|c| c.set("L3372")); | ||
| 3407 | dec.symbol_fixed(&gather( | 3380 | dec.symbol_fixed(&gather( |
| 3408 | &cdfs.partition_w32[ctx32], | 3381 | &cdfs.partition_w32[ctx32], |
| 3409 | VERT_ALIKE, | 3382 | VERT_ALIKE, |
| 3410 | )); | 3383 | )); |
| 3411 | } | 3384 | } |
| 3412 | (false, true) => { | 3385 | (false, true) => { |
| 3413 | - crate::msac::CURRENT_OP.with(|c| c.set("L3378")); | ||
| 3414 | dec.symbol_fixed(&gather( | 3386 | dec.symbol_fixed(&gather( |
| 3415 | &cdfs.partition_w32[ctx32], | 3387 | &cdfs.partition_w32[ctx32], |
| 3416 | HORZ_ALIKE, | 3388 | HORZ_ALIKE, |
| @@ -3463,7 +3435,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3463 | let at16 = (sr, sc); | 3435 | let at16 = (sr, sc); |
| 3464 | let ctx16 = neighbours.partition_ctx(at16, SUB); | 3436 | let ctx16 = neighbours.partition_ctx(at16, SUB); |
| 3465 | if has_cols16 && has_rows16 { | 3437 | if has_cols16 && has_rows16 { |
| 3466 | - crate::msac::CURRENT_OP.with(|c| c.set("L3430")); | ||
| 3467 | let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]); | 3438 | let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]); |
| 3468 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3439 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3469 | eprintln!( | 3440 | eprintln!( |
| @@ -3518,7 +3489,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3518 | (mi_row0 + (i / 2) * 2, mi_col0 + (i % 2) * 2); | 3489 | (mi_row0 + (i / 2) * 2, mi_col0 + (i % 2) * 2); |
| 3519 | let leaf_mi = (mr as usize, mc as usize); | 3490 | let leaf_mi = (mr as usize, mc as usize); |
| 3520 | let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8); | 3491 | let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8); |
| 3521 | - crate::msac::CURRENT_OP.with(|c| c.set("L3485")); | ||
| 3522 | let part8 = | 3492 | let part8 = |
| 3523 | dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); | 3493 | dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); |
| 3524 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3494 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| @@ -3569,13 +3539,11 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3569 | )); | 3539 | )); |
| 3570 | } | 3540 | } |
| 3571 | if has_cols16 { | 3541 | if has_cols16 { |
| 3572 | - crate::msac::CURRENT_OP.with(|c| c.set("L3534")); | ||
| 3573 | dec.symbol_fixed(&gather( | 3542 | dec.symbol_fixed(&gather( |
| 3574 | &cdfs.partition_w16[ctx16], | 3543 | &cdfs.partition_w16[ctx16], |
| 3575 | VERT_ALIKE, | 3544 | VERT_ALIKE, |
| 3576 | )); | 3545 | )); |
| 3577 | } else { | 3546 | } else { |
| 3578 | - crate::msac::CURRENT_OP.with(|c| c.set("L3539")); | ||
| 3579 | dec.symbol_fixed(&gather( | 3547 | dec.symbol_fixed(&gather( |
| 3580 | &cdfs.partition_w16[ctx16], | 3548 | &cdfs.partition_w16[ctx16], |
| 3581 | HORZ_ALIKE, | 3549 | HORZ_ALIKE, |
| @@ -3591,7 +3559,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 3591 | for (mr, mc) in leaf_positions { | 3559 | for (mr, mc) in leaf_positions { |
| 3592 | let leaf_mi = (mr as usize, mc as usize); | 3560 | let leaf_mi = (mr as usize, mc as usize); |
| 3593 | let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8); | 3561 | let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8); |
| 3594 | - crate::msac::CURRENT_OP.with(|c| c.set("L3554")); | ||
| 3595 | let part8 = dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); | 3562 | let part8 = dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); |
| 3596 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3563 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3597 | eprintln!( | 3564 | eprintln!( |
| @@ -3751,7 +3718,6 @@ fn resolve_interp_filter( | |||
| 3751 | &cdfs.switchable_interp[ctx0][..3] | 3718 | &cdfs.switchable_interp[ctx0][..3] |
| 3752 | ); | 3719 | ); |
| 3753 | } | 3720 | } |
| 3754 | - crate::msac::CURRENT_OP.with(|c| c.set("L3713")); | ||
| 3755 | let sym0 = dec.symbol(&mut cdfs.switchable_interp[ctx0]) as u8; | 3721 | let sym0 = dec.symbol(&mut cdfs.switchable_interp[ctx0]) as u8; |
| 3756 | let sym1 = if enable_dual_filter { | 3722 | let sym1 = if enable_dual_filter { |
| 3757 | let ctx1 = switchable_interp_ctx(above[1], left[1], 1, is_compound); | 3723 | let ctx1 = switchable_interp_ctx(above[1], left[1], 1, is_compound); |
| @@ -3761,7 +3727,6 @@ fn resolve_interp_filter( | |||
| 3761 | &cdfs.switchable_interp[ctx1][..3] | 3727 | &cdfs.switchable_interp[ctx1][..3] |
| 3762 | ); | 3728 | ); |
| 3763 | } | 3729 | } |
| 3764 | - crate::msac::CURRENT_OP.with(|c| c.set("L3722")); | ||
| 3765 | dec.symbol(&mut cdfs.switchable_interp[ctx1]) as u8 | 3730 | dec.symbol(&mut cdfs.switchable_interp[ctx1]) as u8 |
| 3766 | } else { | 3731 | } else { |
| 3767 | sym0 | 3732 | sym0 |
| @@ -3811,21 +3776,16 @@ fn read_mv_component( | |||
| 3811 | c: &mut MvComponentCdfs, | 3776 | c: &mut MvComponentCdfs, |
| 3812 | allow_high_precision_mv: bool, | 3777 | allow_high_precision_mv: bool, |
| 3813 | ) -> i32 { | 3778 | ) -> i32 { |
| 3814 | - crate::msac::CURRENT_OP.with(|c| c.set("L3771")); | ||
| 3815 | let sign = dec.symbol(&mut c.sign); | 3779 | let sign = dec.symbol(&mut c.sign); |
| 3816 | - crate::msac::CURRENT_OP.with(|c| c.set("L3772")); | ||
| 3817 | let class = dec.symbol(&mut c.class); | 3780 | let class = dec.symbol(&mut c.class); |
| 3818 | let local = if class == 0 { | 3781 | let local = if class == 0 { |
| 3819 | - crate::msac::CURRENT_OP.with(|c| c.set("L3774")); | ||
| 3820 | let bit = dec.symbol(&mut c.class0_bit); | 3782 | let bit = dec.symbol(&mut c.class0_bit); |
| 3821 | - crate::msac::CURRENT_OP.with(|c| c.set("L3775")); | ||
| 3822 | let fr = dec.symbol(&mut c.class0_fr[bit]); | 3783 | let fr = dec.symbol(&mut c.class0_fr[bit]); |
| 3823 | // spec 5.11.32 `mv_class0_hp`: read only when the frame allows | 3784 | // spec 5.11.32 `mv_class0_hp`: read only when the frame allows |
| 3824 | // high-precision motion vectors, else implicitly 1 (the low bit | 3785 | // high-precision motion vectors, else implicitly 1 (the low bit |
| 3825 | // stays at half-pel precision) -- this crate's own writer always | 3786 | // stays at half-pel precision) -- this crate's own writer always |
| 3826 | // leaves the flag off, but a foreign stream can set it per frame. | 3787 | // leaves the flag off, but a foreign stream can set it per frame. |
| 3827 | let hp = if allow_high_precision_mv { | 3788 | let hp = if allow_high_precision_mv { |
| 3828 | - crate::msac::CURRENT_OP.with(|c| c.set("L3781")); | ||
| 3829 | dec.symbol(&mut c.class0_hp) | 3789 | dec.symbol(&mut c.class0_hp) |
| 3830 | } else { | 3790 | } else { |
| 3831 | 1 | 3791 | 1 |
| @@ -3834,13 +3794,10 @@ fn read_mv_component( | |||
| 3834 | } else { | 3794 | } else { |
| 3835 | let mut d = 0; | 3795 | let mut d = 0; |
| 3836 | for i in 0..class { | 3796 | for i in 0..class { |
| 3837 | - crate::msac::CURRENT_OP.with(|c| c.set("L3789")); | ||
| 3838 | d |= dec.symbol(&mut c.bit[i]) << i; | 3797 | d |= dec.symbol(&mut c.bit[i]) << i; |
| 3839 | } | 3798 | } |
| 3840 | - crate::msac::CURRENT_OP.with(|c| c.set("L3791")); | ||
| 3841 | let fr = dec.symbol(&mut c.fr); | 3799 | let fr = dec.symbol(&mut c.fr); |
| 3842 | let hp = if allow_high_precision_mv { | 3800 | let hp = if allow_high_precision_mv { |
| 3843 | - crate::msac::CURRENT_OP.with(|c| c.set("L3793")); | ||
| 3844 | dec.symbol(&mut c.hp) | 3801 | dec.symbol(&mut c.hp) |
| 3845 | } else { | 3802 | } else { |
| 3846 | 1 | 3803 | 1 |
| @@ -3860,7 +3817,6 @@ fn read_mv( | |||
| 3860 | pred: (i32, i32), | 3817 | pred: (i32, i32), |
| 3861 | allow_high_precision_mv: bool, | 3818 | allow_high_precision_mv: bool, |
| 3862 | ) -> (i32, i32) { | 3819 | ) -> (i32, i32) { |
| 3863 | - crate::msac::CURRENT_OP.with(|c| c.set("L3812")); | ||
| 3864 | let joint = dec.symbol(mv_joint); | 3820 | let joint = dec.symbol(mv_joint); |
| 3865 | let mut diff = (0, 0); | 3821 | let mut diff = (0, 0); |
| 3866 | if joint == 2 || joint == 3 { | 3822 | if joint == 2 || joint == 3 { |
| @@ -3964,27 +3920,21 @@ fn read_single_ref( | |||
| 3964 | ) -> i8 { | 3920 | ) -> i8 { |
| 3965 | let above = (above_ref > 0).then_some(above_ref); | 3921 | let above = (above_ref > 0).then_some(above_ref); |
| 3966 | let left = (left_ref > 0).then_some(left_ref); | 3922 | let left = (left_ref > 0).then_some(left_ref); |
| 3967 | - crate::msac::CURRENT_OP.with(|c| c.set("L3915")); | ||
| 3968 | let p1 = dec.symbol(&mut cdfs.single_ref[single_ref_p1_ctx(above, above_ref1, left, left_ref1)][0]); | 3923 | let p1 = dec.symbol(&mut cdfs.single_ref[single_ref_p1_ctx(above, above_ref1, left, left_ref1)][0]); |
| 3969 | let ref_frame = if p1 == 1 { | 3924 | let ref_frame = if p1 == 1 { |
| 3970 | - crate::msac::CURRENT_OP.with(|c| c.set("L3917")); | ||
| 3971 | let p2 = dec.symbol(&mut cdfs.single_ref[single_ref_p2_ctx(above, above_ref1, left, left_ref1)][1]); | 3925 | let p2 = dec.symbol(&mut cdfs.single_ref[single_ref_p2_ctx(above, above_ref1, left, left_ref1)][1]); |
| 3972 | if p2 == 1 { | 3926 | if p2 == 1 { |
| 3973 | ALTREF_FRAME | 3927 | ALTREF_FRAME |
| 3974 | } else { | 3928 | } else { |
| 3975 | - crate::msac::CURRENT_OP.with(|c| c.set("L3921")); | ||
| 3976 | let p6 = dec.symbol(&mut cdfs.single_ref[single_ref_p6_ctx(above, above_ref1, left, left_ref1)][5]); | 3929 | let p6 = dec.symbol(&mut cdfs.single_ref[single_ref_p6_ctx(above, above_ref1, left, left_ref1)][5]); |
| 3977 | if p6 == 1 { ALTREF2_FRAME } else { BWDREF_FRAME } | 3930 | if p6 == 1 { ALTREF2_FRAME } else { BWDREF_FRAME } |
| 3978 | } | 3931 | } |
| 3979 | } else { | 3932 | } else { |
| 3980 | - crate::msac::CURRENT_OP.with(|c| c.set("L3925")); | ||
| 3981 | let p3 = dec.symbol(&mut cdfs.single_ref[single_ref_p3_ctx(above, above_ref1, left, left_ref1)][2]); | 3933 | let p3 = dec.symbol(&mut cdfs.single_ref[single_ref_p3_ctx(above, above_ref1, left, left_ref1)][2]); |
| 3982 | if p3 == 1 { | 3934 | if p3 == 1 { |
| 3983 | - crate::msac::CURRENT_OP.with(|c| c.set("L3927")); | ||
| 3984 | let p5 = dec.symbol(&mut cdfs.single_ref[single_ref_p5_ctx(above, above_ref1, left, left_ref1)][4]); | 3935 | let p5 = dec.symbol(&mut cdfs.single_ref[single_ref_p5_ctx(above, above_ref1, left, left_ref1)][4]); |
| 3985 | if p5 == 1 { GOLDEN_FRAME } else { LAST3_FRAME } | 3936 | if p5 == 1 { GOLDEN_FRAME } else { LAST3_FRAME } |
| 3986 | } else { | 3937 | } else { |
| 3987 | - crate::msac::CURRENT_OP.with(|c| c.set("L3930")); | ||
| 3988 | let p4 = dec.symbol(&mut cdfs.single_ref[single_ref_p4_ctx(above, above_ref1, left, left_ref1)][3]); | 3938 | let p4 = dec.symbol(&mut cdfs.single_ref[single_ref_p4_ctx(above, above_ref1, left, left_ref1)][3]); |
| 3989 | if p4 == 1 { LAST2_FRAME } else { LAST_FRAME } | 3939 | if p4 == 1 { LAST2_FRAME } else { LAST_FRAME } |
| 3990 | } | 3940 | } |
| @@ -4106,7 +4056,6 @@ fn read_comp_mode( | |||
| 4106 | left: Option<NeighbourRef>, | 4056 | left: Option<NeighbourRef>, |
| 4107 | ) -> bool { | 4057 | ) -> bool { |
| 4108 | let ctx = reference_mode_ctx(above, left); | 4058 | let ctx = reference_mode_ctx(above, left); |
| 4109 | - crate::msac::CURRENT_OP.with(|c| c.set("L4051")); | ||
| 4110 | let compound = dec.symbol(&mut cdfs.comp_mode[ctx]) == 1; | 4059 | let compound = dec.symbol(&mut cdfs.comp_mode[ctx]) == 1; |
| 4111 | if compound { | 4060 | if compound { |
| 4112 | COMP_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 4061 | COMP_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| @@ -4150,21 +4099,17 @@ fn read_compound_ref_frames( | |||
| 4150 | let a1 = above.and_then(|n| n.ref1); | 4099 | let a1 = above.and_then(|n| n.ref1); |
| 4151 | let l1 = left.and_then(|n| n.ref1); | 4100 | let l1 = left.and_then(|n| n.ref1); |
| 4152 | let type_ctx = comp_reference_type_ctx(above, left); | 4101 | let type_ctx = comp_reference_type_ctx(above, left); |
| 4153 | - crate::msac::CURRENT_OP.with(|c| c.set("L4094")); | ||
| 4154 | let unidir = dec.symbol(&mut cdfs.comp_ref_type[type_ctx]) == 0; | 4102 | let unidir = dec.symbol(&mut cdfs.comp_ref_type[type_ctx]) == 0; |
| 4155 | if unidir { | 4103 | if unidir { |
| 4156 | // uni_comp_ref (p0): forward vs. backward -- av1_get_pred_context_- | 4104 | // uni_comp_ref (p0): forward vs. backward -- av1_get_pred_context_- |
| 4157 | // uni_comp_ref_p is single_ref_p1's own forward/backward vote. | 4105 | // uni_comp_ref_p is single_ref_p1's own forward/backward vote. |
| 4158 | - crate::msac::CURRENT_OP.with(|c| c.set("L4098")); | ||
| 4159 | let bit = dec.symbol(&mut cdfs.uni_comp_ref[single_ref_p1_ctx(a, a1, l, l1)][0]); | 4106 | let bit = dec.symbol(&mut cdfs.uni_comp_ref[single_ref_p1_ctx(a, a1, l, l1)][0]); |
| 4160 | if bit == 1 { | 4107 | if bit == 1 { |
| 4161 | (BWDREF_FRAME, ALTREF_FRAME) | 4108 | (BWDREF_FRAME, ALTREF_FRAME) |
| 4162 | } else { | 4109 | } else { |
| 4163 | - crate::msac::CURRENT_OP.with(|c| c.set("L4102")); | ||
| 4164 | let p1 = dec.symbol(&mut cdfs.uni_comp_ref[uni_comp_ref_p1_ctx(a, a1, l, l1)][1]); | 4110 | let p1 = dec.symbol(&mut cdfs.uni_comp_ref[uni_comp_ref_p1_ctx(a, a1, l, l1)][1]); |
| 4165 | if p1 == 1 { | 4111 | if p1 == 1 { |
| 4166 | // uni_comp_ref_p2: LAST3 vs. GOLDEN, same vote as single_ref_p5. | 4112 | // uni_comp_ref_p2: LAST3 vs. GOLDEN, same vote as single_ref_p5. |
| 4167 | - crate::msac::CURRENT_OP.with(|c| c.set("L4105")); | ||
| 4168 | let p2 = dec.symbol(&mut cdfs.uni_comp_ref[single_ref_p5_ctx(a, a1, l, l1)][2]); | 4113 | let p2 = dec.symbol(&mut cdfs.uni_comp_ref[single_ref_p5_ctx(a, a1, l, l1)][2]); |
| 4169 | if p2 == 1 { | 4114 | if p2 == 1 { |
| 4170 | (LAST_FRAME, GOLDEN_FRAME) | 4115 | (LAST_FRAME, GOLDEN_FRAME) |
| @@ -4177,25 +4122,20 @@ fn read_compound_ref_frames( | |||
| 4177 | } | 4122 | } |
| 4178 | } else { | 4123 | } else { |
| 4179 | // comp_ref (p0): LAST/LAST2 vs. LAST3/GOLDEN, same vote as single_ref_p3. | 4124 | // comp_ref (p0): LAST/LAST2 vs. LAST3/GOLDEN, same vote as single_ref_p3. |
| 4180 | - crate::msac::CURRENT_OP.with(|c| c.set("L4117")); | ||
| 4181 | let bit0 = dec.symbol(&mut cdfs.comp_ref[single_ref_p3_ctx(a, a1, l, l1)][0]); | 4125 | let bit0 = dec.symbol(&mut cdfs.comp_ref[single_ref_p3_ctx(a, a1, l, l1)][0]); |
| 4182 | let ref0 = if bit0 == 0 { | 4126 | let ref0 = if bit0 == 0 { |
| 4183 | // comp_ref_p1: LAST vs. LAST2, same vote as single_ref_p4. | 4127 | // comp_ref_p1: LAST vs. LAST2, same vote as single_ref_p4. |
| 4184 | - crate::msac::CURRENT_OP.with(|c| c.set("L4120")); | ||
| 4185 | let p1 = dec.symbol(&mut cdfs.comp_ref[single_ref_p4_ctx(a, a1, l, l1)][1]); | 4128 | let p1 = dec.symbol(&mut cdfs.comp_ref[single_ref_p4_ctx(a, a1, l, l1)][1]); |
| 4186 | if p1 == 1 { LAST2_FRAME } else { LAST_FRAME } | 4129 | if p1 == 1 { LAST2_FRAME } else { LAST_FRAME } |
| 4187 | } else { | 4130 | } else { |
| 4188 | // comp_ref_p2: LAST3 vs. GOLDEN, same vote as single_ref_p5. | 4131 | // comp_ref_p2: LAST3 vs. GOLDEN, same vote as single_ref_p5. |
| 4189 | - crate::msac::CURRENT_OP.with(|c| c.set("L4124")); | ||
| 4190 | let p2 = dec.symbol(&mut cdfs.comp_ref[single_ref_p5_ctx(a, a1, l, l1)][2]); | 4132 | let p2 = dec.symbol(&mut cdfs.comp_ref[single_ref_p5_ctx(a, a1, l, l1)][2]); |
| 4191 | if p2 == 1 { GOLDEN_FRAME } else { LAST3_FRAME } | 4133 | if p2 == 1 { GOLDEN_FRAME } else { LAST3_FRAME } |
| 4192 | }; | 4134 | }; |
| 4193 | // comp_bwdref (p0): BWDREF/ALTREF2 vs. ALTREF, same vote as single_ref_p2. | 4135 | // comp_bwdref (p0): BWDREF/ALTREF2 vs. ALTREF, same vote as single_ref_p2. |
| 4194 | - crate::msac::CURRENT_OP.with(|c| c.set("L4128")); | ||
| 4195 | let bit1 = dec.symbol(&mut cdfs.comp_bwdref[single_ref_p2_ctx(a, a1, l, l1)][0]); | 4136 | let bit1 = dec.symbol(&mut cdfs.comp_bwdref[single_ref_p2_ctx(a, a1, l, l1)][0]); |
| 4196 | let ref1 = if bit1 == 0 { | 4137 | let ref1 = if bit1 == 0 { |
| 4197 | // comp_bwdref_p1: BWDREF vs. ALTREF2, same vote as single_ref_p6. | 4138 | // comp_bwdref_p1: BWDREF vs. ALTREF2, same vote as single_ref_p6. |
| 4198 | - crate::msac::CURRENT_OP.with(|c| c.set("L4131")); | ||
| 4199 | let p1 = dec.symbol(&mut cdfs.comp_bwdref[single_ref_p6_ctx(a, a1, l, l1)][1]); | 4139 | let p1 = dec.symbol(&mut cdfs.comp_bwdref[single_ref_p6_ctx(a, a1, l, l1)][1]); |
| 4200 | if p1 == 1 { ALTREF2_FRAME } else { BWDREF_FRAME } | 4140 | if p1 == 1 { ALTREF2_FRAME } else { BWDREF_FRAME } |
| 4201 | } else { | 4141 | } else { |
| @@ -4223,7 +4163,6 @@ fn read_inter_compound_mode( | |||
| 4223 | ) -> u8 { | 4163 | ) -> u8 { |
| 4224 | let ctx = cdf::COMPOUND_MODE_CTX_MAP[ref_mv_ctx >> 1][new_mv_ctx.min(4)]; | 4164 | let ctx = cdf::COMPOUND_MODE_CTX_MAP[ref_mv_ctx >> 1][new_mv_ctx.min(4)]; |
| 4225 | COMPOUND_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 4165 | COMPOUND_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 4226 | - crate::msac::CURRENT_OP.with(|c| c.set("L4158")); | ||
| 4227 | dec.symbol(&mut cdfs.inter_compound_mode[ctx]) as u8 | 4166 | dec.symbol(&mut cdfs.inter_compound_mode[ctx]) as u8 |
| 4228 | } | 4167 | } |
| 4229 | 4168 | ||
| @@ -4259,7 +4198,6 @@ fn assign_compound_mv( | |||
| 4259 | if mode == NEW_NEWMV { | 4198 | if mode == NEW_NEWMV { |
| 4260 | let mut idx = 0usize; | 4199 | let mut idx = 0usize; |
| 4261 | while idx < 2 && comp_stack.entries.len() > idx + 1 { | 4200 | while idx < 2 && comp_stack.entries.len() > idx + 1 { |
| 4262 | - crate::msac::CURRENT_OP.with(|c| c.set("L4193")); | ||
| 4263 | if dec.symbol(&mut cdfs.drl_mode[comp_stack.drl_ctx[idx]]) == 0 { | 4201 | if dec.symbol(&mut cdfs.drl_mode[comp_stack.drl_ctx[idx]]) == 0 { |
| 4264 | break; | 4202 | break; |
| 4265 | } | 4203 | } |
| @@ -4269,7 +4207,6 @@ fn assign_compound_mv( | |||
| 4269 | } else if matches!(mode, NEAR_NEARMV | NEAR_NEWMV | NEW_NEARMV) { | 4207 | } else if matches!(mode, NEAR_NEARMV | NEAR_NEWMV | NEW_NEARMV) { |
| 4270 | let mut idx = 1usize; | 4208 | let mut idx = 1usize; |
| 4271 | while idx < 3 && comp_stack.entries.len() > idx + 1 { | 4209 | while idx < 3 && comp_stack.entries.len() > idx + 1 { |
| 4272 | - crate::msac::CURRENT_OP.with(|c| c.set("L4202")); | ||
| 4273 | if dec.symbol(&mut cdfs.drl_mode[comp_stack.drl_ctx[idx]]) == 0 { | 4210 | if dec.symbol(&mut cdfs.drl_mode[comp_stack.drl_ctx[idx]]) == 0 { |
| 4274 | break; | 4211 | break; |
| 4275 | } | 4212 | } |
| @@ -4413,20 +4350,17 @@ fn decode_inter_block( | |||
| 4413 | } | 4350 | } |
| 4414 | let skip_mode_ctx = | 4351 | let skip_mode_ctx = |
| 4415 | usize::from(neighbours.above_skip_mode[c]) + usize::from(neighbours.left_skip_mode[r]); | 4352 | usize::from(neighbours.above_skip_mode[c]) + usize::from(neighbours.left_skip_mode[r]); |
| 4416 | - crate::msac::CURRENT_OP.with(|c| c.set("L4345")); | ||
| 4417 | let skip_mode = skip_mode_present && dec.symbol(&mut cdfs.skip_mode[skip_mode_ctx]) == 1; | 4353 | let skip_mode = skip_mode_present && dec.symbol(&mut cdfs.skip_mode[skip_mode_ctx]) == 1; |
| 4418 | if skip_mode { | 4354 | if skip_mode { |
| 4419 | SKIP_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 4355 | SKIP_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 4420 | } | 4356 | } |
| 4421 | 4357 | ||
| 4422 | let skip_ctx = usize::from(neighbours.above_skip[c]) + usize::from(neighbours.left_skip[r]); | 4358 | let skip_ctx = usize::from(neighbours.above_skip[c]) + usize::from(neighbours.left_skip[r]); |
| 4423 | - crate::msac::CURRENT_OP.with(|c| c.set("L4351")); | ||
| 4424 | let skip = skip_mode || dec.symbol(&mut cdfs.skip[skip_ctx]) == 1; | 4359 | let skip = skip_mode || dec.symbol(&mut cdfs.skip[skip_ctx]) == 1; |
| 4425 | 4360 | ||
| 4426 | let (has_above, has_left) = (r > 0, c > 0); | 4361 | let (has_above, has_left) = (r > 0, c > 0); |
| 4427 | let (above_inter, left_inter) = (neighbours.above_inter[c], neighbours.left_inter[r]); | 4362 | let (above_inter, left_inter) = (neighbours.above_inter[c], neighbours.left_inter[r]); |
| 4428 | let ii_ctx = intra_inter_ctx(has_above, has_left, above_inter, left_inter); | 4363 | let ii_ctx = intra_inter_ctx(has_above, has_left, above_inter, left_inter); |
| 4429 | - crate::msac::CURRENT_OP.with(|c| c.set("L4356")); | ||
| 4430 | let is_inter = skip_mode || dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1; | 4364 | let is_inter = skip_mode || dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1; |
| 4431 | 4365 | ||
| 4432 | let mode_for_tx; | 4366 | let mode_for_tx; |
| @@ -4578,7 +4512,6 @@ fn decode_inter_block( | |||
| 4578 | && enable_masked_compound | 4512 | && enable_masked_compound |
| 4579 | && is_any_masked_compound_used_here(side) | 4513 | && is_any_masked_compound_used_here(side) |
| 4580 | { | 4514 | { |
| 4581 | - crate::msac::CURRENT_OP.with(|c| c.set("L4507")); | ||
| 4582 | dec.symbol(&mut cdfs.comp_group_idx[group_ctx]) | 4515 | dec.symbol(&mut cdfs.comp_group_idx[group_ctx]) |
| 4583 | } else { | 4516 | } else { |
| 4584 | 0 | 4517 | 0 |
| @@ -4803,7 +4736,6 @@ fn decode_inter_block( | |||
| 4803 | cdfs.compound_idx[idx_ctx][0] | 4736 | cdfs.compound_idx[idx_ctx][0] |
| 4804 | ); | 4737 | ); |
| 4805 | } | 4738 | } |
| 4806 | - crate::msac::CURRENT_OP.with(|c| c.set("L4731")); | ||
| 4807 | let idx = dec.symbol(&mut cdfs.compound_idx[idx_ctx]); | 4739 | let idx = dec.symbol(&mut cdfs.compound_idx[idx_ctx]); |
| 4808 | if std::env::var_os("EC_AV1_COMPIDX_DUMP").is_some() { | 4740 | if std::env::var_os("EC_AV1_COMPIDX_DUMP").is_some() { |
| 4809 | eprintln!( | 4741 | eprintln!( |
| @@ -5112,7 +5044,6 @@ fn decode_inter_block( | |||
| 5112 | sign_bias_table, | 5044 | sign_bias_table, |
| 5113 | tpl, | 5045 | tpl, |
| 5114 | ); | 5046 | ); |
| 5115 | - crate::msac::CURRENT_OP.with(|c| c.set("L5039")); | ||
| 5116 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; | 5047 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 5117 | let mut is_globalmv = false; | 5048 | let mut is_globalmv = false; |
| 5118 | let (mv, is_new_mv) = if !not_new { | 5049 | let (mv, is_new_mv) = if !not_new { |
| @@ -5124,7 +5055,6 @@ fn decode_inter_block( | |||
| 5124 | // -- entry 0 (`stack.pred_mv`) only when the loop never advances. | 5055 | // -- entry 0 (`stack.pred_mv`) only when the loop never advances. |
| 5125 | let mut idx = 0usize; | 5056 | let mut idx = 0usize; |
| 5126 | while idx < 2 && stack.entries.len() > idx + 1 { | 5057 | while idx < 2 && stack.entries.len() > idx + 1 { |
| 5127 | - crate::msac::CURRENT_OP.with(|c| c.set("L5050")); | ||
| 5128 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { | 5058 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { |
| 5129 | break; | 5059 | break; |
| 5130 | } | 5060 | } |
| @@ -5142,7 +5072,6 @@ fn decode_inter_block( | |||
| 5142 | true, | 5072 | true, |
| 5143 | ) | 5073 | ) |
| 5144 | } else { | 5074 | } else { |
| 5145 | - crate::msac::CURRENT_OP.with(|c| c.set("L5067")); | ||
| 5146 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; | 5075 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; |
| 5147 | is_globalmv = !not_zero; | 5076 | is_globalmv = !not_zero; |
| 5148 | let mv = if !not_zero { | 5077 | let mv = if !not_zero { |
| @@ -5152,7 +5081,6 @@ fn decode_inter_block( | |||
| 5152 | // model is refused before the tile decoder is ever called). | 5081 | // model is refused before the tile decoder is ever called). |
| 5153 | (0, 0) | 5082 | (0, 0) |
| 5154 | } else { | 5083 | } else { |
| 5155 | - crate::msac::CURRENT_OP.with(|c| c.set("L5076")); | ||
| 5156 | let nearest = dec.symbol(&mut cdfs.ref_mv[stack.ref_mv_ctx]) == 0; | 5084 | let nearest = dec.symbol(&mut cdfs.ref_mv[stack.ref_mv_ctx]) == 0; |
| 5157 | if nearest { | 5085 | if nearest { |
| 5158 | stack.nearest_mv | 5086 | stack.nearest_mv |
| @@ -5165,7 +5093,6 @@ fn decode_inter_block( | |||
| 5165 | // exactly the pair this index is choosing between. | 5093 | // exactly the pair this index is choosing between. |
| 5166 | let mut idx = 1usize; | 5094 | let mut idx = 1usize; |
| 5167 | while idx < 3 && stack.entries.len() > idx + 1 { | 5095 | while idx < 3 && stack.entries.len() > idx + 1 { |
| 5168 | - crate::msac::CURRENT_OP.with(|c| c.set("L5088")); | ||
| 5169 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { | 5096 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { |
| 5170 | break; | 5097 | break; |
| 5171 | } | 5098 | } |
| @@ -5372,7 +5299,6 @@ fn decode_inter_block( | |||
| 5372 | } | 5299 | } |
| 5373 | } | 5300 | } |
| 5374 | } else { | 5301 | } else { |
| 5375 | - crate::msac::CURRENT_OP.with(|c| c.set("L5294")); | ||
| 5376 | let mode = dec.symbol(&mut cdfs.y_mode[size_group]); | 5302 | let mode = dec.symbol(&mut cdfs.y_mode[size_group]); |
| 5377 | if mode >= 13 { | 5303 | if mode >= 13 { |
| 5378 | return Err(unsupported( | 5304 | return Err(unsupported( |
| @@ -5380,7 +5306,6 @@ fn decode_inter_block( | |||
| 5380 | )); | 5306 | )); |
| 5381 | } | 5307 | } |
| 5382 | if (V_PRED..=D67_PRED).contains(&mode) { | 5308 | if (V_PRED..=D67_PRED).contains(&mode) { |
| 5383 | - crate::msac::CURRENT_OP.with(|c| c.set("L5301")); | ||
| 5384 | let angle = dec.symbol(&mut cdfs.angle_delta[mode - V_PRED]); | 5309 | let angle = dec.symbol(&mut cdfs.angle_delta[mode - V_PRED]); |
| 5385 | if angle != ANGLE_DELTA_ZERO { | 5310 | if angle != ANGLE_DELTA_ZERO { |
| 5386 | return Err(unsupported( | 5311 | return Err(unsupported( |
| @@ -5388,7 +5313,6 @@ fn decode_inter_block( | |||
| 5388 | )); | 5313 | )); |
| 5389 | } | 5314 | } |
| 5390 | } | 5315 | } |
| 5391 | - crate::msac::CURRENT_OP.with(|c| c.set("L5308")); | ||
| 5392 | let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); | 5316 | let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); |
| 5393 | let alpha = if uv_mode == DC_PRED { | 5317 | let alpha = if uv_mode == DC_PRED { |
| 5394 | None | 5318 | None |
| @@ -5634,19 +5558,16 @@ fn decode_inter_block8( | |||
| 5634 | } | 5558 | } |
| 5635 | let skip_mode_ctx = | 5559 | let skip_mode_ctx = |
| 5636 | usize::from(neighbours.above_skip_mode[c]) + usize::from(neighbours.left_skip_mode[r]); | 5560 | usize::from(neighbours.above_skip_mode[c]) + usize::from(neighbours.left_skip_mode[r]); |
| 5637 | - crate::msac::CURRENT_OP.with(|c| c.set("L5553")); | ||
| 5638 | let skip_mode = skip_mode_present && dec.symbol(&mut cdfs.skip_mode[skip_mode_ctx]) == 1; | 5561 | let skip_mode = skip_mode_present && dec.symbol(&mut cdfs.skip_mode[skip_mode_ctx]) == 1; |
| 5639 | if skip_mode { | 5562 | if skip_mode { |
| 5640 | SKIP_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); | 5563 | SKIP_MODE_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 5641 | } | 5564 | } |
| 5642 | 5565 | ||
| 5643 | let skip_ctx = usize::from(above_skip) + usize::from(left_skip); | 5566 | let skip_ctx = usize::from(above_skip) + usize::from(left_skip); |
| 5644 | - crate::msac::CURRENT_OP.with(|c| c.set("L5559")); | ||
| 5645 | let skip = skip_mode || dec.symbol(&mut cdfs.skip[skip_ctx]) == 1; | 5567 | let skip = skip_mode || dec.symbol(&mut cdfs.skip[skip_ctx]) == 1; |
| 5646 | 5568 | ||
| 5647 | let (has_above, has_left) = (leaf_mi.0 > 0, leaf_mi.1 > 0); | 5569 | let (has_above, has_left) = (leaf_mi.0 > 0, leaf_mi.1 > 0); |
| 5648 | let ii_ctx = intra_inter_ctx(has_above, has_left, above_inter, left_inter); | 5570 | let ii_ctx = intra_inter_ctx(has_above, has_left, above_inter, left_inter); |
| 5649 | - crate::msac::CURRENT_OP.with(|c| c.set("L5563")); | ||
| 5650 | let is_inter = skip_mode || dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1; | 5571 | let is_inter = skip_mode || dec.symbol(&mut cdfs.intra_inter[ii_ctx]) == 1; |
| 5651 | 5572 | ||
| 5652 | let mode_for_tx; | 5573 | let mode_for_tx; |
| @@ -5733,7 +5654,6 @@ fn decode_inter_block8( | |||
| 5733 | && enable_masked_compound | 5654 | && enable_masked_compound |
| 5734 | && is_any_masked_compound_used_here(SIDE) | 5655 | && is_any_masked_compound_used_here(SIDE) |
| 5735 | { | 5656 | { |
| 5736 | - crate::msac::CURRENT_OP.with(|c| c.set("L5649")); | ||
| 5737 | dec.symbol(&mut cdfs.comp_group_idx[group_ctx]) | 5657 | dec.symbol(&mut cdfs.comp_group_idx[group_ctx]) |
| 5738 | } else { | 5658 | } else { |
| 5739 | 0 | 5659 | 0 |
| @@ -5768,7 +5688,6 @@ fn decode_inter_block8( | |||
| 5768 | ref_order_hints[(ref0 - LAST_FRAME) as usize], | 5688 | ref_order_hints[(ref0 - LAST_FRAME) as usize], |
| 5769 | ref_order_hints[(ref1 - LAST_FRAME) as usize], | 5689 | ref_order_hints[(ref1 - LAST_FRAME) as usize], |
| 5770 | ); | 5690 | ); |
| 5771 | - crate::msac::CURRENT_OP.with(|c| c.set("L5683")); | ||
| 5772 | let idx = dec.symbol(&mut cdfs.compound_idx[idx_ctx]); | 5691 | let idx = dec.symbol(&mut cdfs.compound_idx[idx_ctx]); |
| 5773 | if idx == 1 { | 5692 | if idx == 1 { |
| 5774 | (8, 8, 1u8) | 5693 | (8, 8, 1u8) |
| @@ -5986,11 +5905,8 @@ fn decode_inter_block8( | |||
| 5986 | } | 5905 | } |
| 5987 | } | 5906 | } |
| 5988 | let sr_ctx = single_ref_ctx(above_inter || left_inter); | 5907 | let sr_ctx = single_ref_ctx(above_inter || left_inter); |
| 5989 | - crate::msac::CURRENT_OP.with(|c| c.set("L5900")); | ||
| 5990 | let p1 = dec.symbol(&mut cdfs.single_ref[sr_ctx][0]); | 5908 | let p1 = dec.symbol(&mut cdfs.single_ref[sr_ctx][0]); |
| 5991 | - crate::msac::CURRENT_OP.with(|c| c.set("L5901")); | ||
| 5992 | let p3 = dec.symbol(&mut cdfs.single_ref[sr_ctx][2]); | 5909 | let p3 = dec.symbol(&mut cdfs.single_ref[sr_ctx][2]); |
| 5993 | - crate::msac::CURRENT_OP.with(|c| c.set("L5902")); | ||
| 5994 | let p4 = dec.symbol(&mut cdfs.single_ref[sr_ctx][3]); | 5910 | let p4 = dec.symbol(&mut cdfs.single_ref[sr_ctx][3]); |
| 5995 | if (p1, p3, p4) != (0, 0, 0) { | 5911 | if (p1, p3, p4) != (0, 0, 0) { |
| 5996 | return Err(unsupported( | 5912 | return Err(unsupported( |
| @@ -6010,7 +5926,6 @@ fn decode_inter_block8( | |||
| 6010 | mi_rows as usize, | 5926 | mi_rows as usize, |
| 6011 | ); | 5927 | ); |
| 6012 | 5928 | ||
| 6013 | - crate::msac::CURRENT_OP.with(|c| c.set("L5921")); | ||
| 6014 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; | 5929 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 6015 | let (mv, is_new_mv) = if !not_new { | 5930 | let (mv, is_new_mv) = if !not_new { |
| 6016 | // NEWMV (spec 5.11.24's `read_drl_idx`, `RefMvIdx` starting at 0): | 5931 | // NEWMV (spec 5.11.24's `read_drl_idx`, `RefMvIdx` starting at 0): |
| @@ -6021,7 +5936,6 @@ fn decode_inter_block8( | |||
| 6021 | // -- entry 0 (`stack.pred_mv`) only when the loop never advances. | 5936 | // -- entry 0 (`stack.pred_mv`) only when the loop never advances. |
| 6022 | let mut idx = 0usize; | 5937 | let mut idx = 0usize; |
| 6023 | while idx < 2 && stack.entries.len() > idx + 1 { | 5938 | while idx < 2 && stack.entries.len() > idx + 1 { |
| 6024 | - crate::msac::CURRENT_OP.with(|c| c.set("L5931")); | ||
| 6025 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { | 5939 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { |
| 6026 | break; | 5940 | break; |
| 6027 | } | 5941 | } |
| @@ -6039,19 +5953,16 @@ fn decode_inter_block8( | |||
| 6039 | true, | 5953 | true, |
| 6040 | ) | 5954 | ) |
| 6041 | } else { | 5955 | } else { |
| 6042 | - crate::msac::CURRENT_OP.with(|c| c.set("L5948")); | ||
| 6043 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; | 5956 | let not_zero = dec.symbol(&mut cdfs.zero_mv[stack.zero_mv_ctx]) == 1; |
| 6044 | if !not_zero { | 5957 | if !not_zero { |
| 6045 | return Err(unsupported("GLOBALMV (round 3)")); | 5958 | return Err(unsupported("GLOBALMV (round 3)")); |
| 6046 | } | 5959 | } |
| 6047 | - crate::msac::CURRENT_OP.with(|c| c.set("L5952")); | ||
| 6048 | let nearest = dec.symbol(&mut cdfs.ref_mv[stack.ref_mv_ctx]) == 0; | 5960 | let nearest = dec.symbol(&mut cdfs.ref_mv[stack.ref_mv_ctx]) == 0; |
| 6049 | let mv = if nearest { | 5961 | let mv = if nearest { |
| 6050 | stack.nearest_mv | 5962 | stack.nearest_mv |
| 6051 | } else { | 5963 | } else { |
| 6052 | let mut idx = 1usize; | 5964 | let mut idx = 1usize; |
| 6053 | while idx < 3 && stack.entries.len() > idx + 1 { | 5965 | while idx < 3 && stack.entries.len() > idx + 1 { |
| 6054 | - crate::msac::CURRENT_OP.with(|c| c.set("L5958")); | ||
| 6055 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { | 5966 | if dec.symbol(&mut cdfs.drl_mode[stack.drl_ctx[idx]]) == 0 { |
| 6056 | break; | 5967 | break; |
| 6057 | } | 5968 | } |
| @@ -6185,7 +6096,6 @@ fn decode_inter_block8( | |||
| 6185 | )?; | 6096 | )?; |
| 6186 | } | 6097 | } |
| 6187 | } else { | 6098 | } else { |
| 6188 | - crate::msac::CURRENT_OP.with(|c| c.set("L6091")); | ||
| 6189 | let mode = dec.symbol(&mut cdfs.y_mode[SIZE_GROUP_8]); | 6099 | let mode = dec.symbol(&mut cdfs.y_mode[SIZE_GROUP_8]); |
| 6190 | if mode >= 13 { | 6100 | if mode >= 13 { |
| 6191 | return Err(unsupported( | 6101 | return Err(unsupported( |
| @@ -6193,7 +6103,6 @@ fn decode_inter_block8( | |||
| 6193 | )); | 6103 | )); |
| 6194 | } | 6104 | } |
| 6195 | if (V_PRED..=D67_PRED).contains(&mode) { | 6105 | if (V_PRED..=D67_PRED).contains(&mode) { |
| 6196 | - crate::msac::CURRENT_OP.with(|c| c.set("L6098")); | ||
| 6197 | let angle = dec.symbol(&mut cdfs.angle_delta[mode - V_PRED]); | 6106 | let angle = dec.symbol(&mut cdfs.angle_delta[mode - V_PRED]); |
| 6198 | if angle != ANGLE_DELTA_ZERO { | 6107 | if angle != ANGLE_DELTA_ZERO { |
| 6199 | return Err(unsupported( | 6108 | return Err(unsupported( |
| @@ -6201,7 +6110,6 @@ fn decode_inter_block8( | |||
| 6201 | )); | 6110 | )); |
| 6202 | } | 6111 | } |
| 6203 | } | 6112 | } |
| 6204 | - crate::msac::CURRENT_OP.with(|c| c.set("L6105")); | ||
| 6205 | let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); | 6113 | let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); |
| 6206 | if uv_mode != DC_PRED { | 6114 | if uv_mode != DC_PRED { |
| 6207 | return Err(unsupported( | 6115 | return Err(unsupported( |
| @@ -6573,15 +6481,12 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 6573 | ); | 6481 | ); |
| 6574 | match (has_cols, has_rows) { | 6482 | match (has_cols, has_rows) { |
| 6575 | (true, true) => { | 6483 | (true, true) => { |
| 6576 | - crate::msac::CURRENT_OP.with(|c| c.set("L6476")); | ||
| 6577 | dec.symbol(&mut cdfs.partition_w64[sb_ctx]); | 6484 | dec.symbol(&mut cdfs.partition_w64[sb_ctx]); |
| 6578 | } | 6485 | } |
| 6579 | (true, false) => { | 6486 | (true, false) => { |
| 6580 | - crate::msac::CURRENT_OP.with(|c| c.set("L6479")); | ||
| 6581 | dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], VERT_ALIKE)); | 6487 | dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], VERT_ALIKE)); |
| 6582 | } | 6488 | } |
| 6583 | (false, true) => { | 6489 | (false, true) => { |
| 6584 | - crate::msac::CURRENT_OP.with(|c| c.set("L6482")); | ||
| 6585 | dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], HORZ_ALIKE)); | 6490 | dec.symbol_fixed(&gather(&cdfs.partition_w64[sb_ctx], HORZ_ALIKE)); |
| 6586 | } | 6491 | } |
| 6587 | (false, false) => {} | 6492 | (false, false) => {} |
| @@ -6599,16 +6504,13 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 6599 | has_half(r32 * BLOCK_MI, BLOCK_MI, mi_rows), | 6504 | has_half(r32 * BLOCK_MI, BLOCK_MI, mi_rows), |
| 6600 | ); | 6505 | ); |
| 6601 | let part32 = if has_cols32 && has_rows32 { | 6506 | let part32 = if has_cols32 && has_rows32 { |
| 6602 | - crate::msac::CURRENT_OP.with(|c| c.set("L6499")); | ||
| 6603 | dec.symbol(&mut cdfs.partition_w32[ctx32]) | 6507 | dec.symbol(&mut cdfs.partition_w32[ctx32]) |
| 6604 | } else { | 6508 | } else { |
| 6605 | match (has_cols32, has_rows32) { | 6509 | match (has_cols32, has_rows32) { |
| 6606 | (true, false) => { | 6510 | (true, false) => { |
| 6607 | - crate::msac::CURRENT_OP.with(|c| c.set("L6503")); | ||
| 6608 | dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], VERT_ALIKE)); | 6511 | dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], VERT_ALIKE)); |
| 6609 | } | 6512 | } |
| 6610 | (false, true) => { | 6513 | (false, true) => { |
| 6611 | - crate::msac::CURRENT_OP.with(|c| c.set("L6506")); | ||
| 6612 | dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], HORZ_ALIKE)); | 6514 | dec.symbol_fixed(&gather(&cdfs.partition_w32[ctx32], HORZ_ALIKE)); |
| 6613 | } | 6515 | } |
| 6614 | _ => {} | 6516 | _ => {} |
| @@ -6677,7 +6579,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 6677 | let at16 = (sr, sc); | 6579 | let at16 = (sr, sc); |
| 6678 | if has_cols16 && has_rows16 { | 6580 | if has_cols16 && has_rows16 { |
| 6679 | let ctx16 = neighbours.partition_ctx(at16, SUB); | 6581 | let ctx16 = neighbours.partition_ctx(at16, SUB); |
| 6680 | - crate::msac::CURRENT_OP.with(|c| c.set("L6574")); | ||
| 6681 | let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]); | 6582 | let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]); |
| 6682 | if part16 != PARTITION_NONE { | 6583 | if part16 != PARTITION_NONE { |
| 6683 | return Err(unsupported( | 6584 | return Err(unsupported( |
| @@ -6726,13 +6627,11 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 6726 | } else { | 6627 | } else { |
| 6727 | let ctx16 = neighbours.partition_ctx(at16, SUB); | 6628 | let ctx16 = neighbours.partition_ctx(at16, SUB); |
| 6728 | if has_cols16 { | 6629 | if has_cols16 { |
| 6729 | - crate::msac::CURRENT_OP.with(|c| c.set("L6622")); | ||
| 6730 | dec.symbol_fixed(&gather( | 6630 | dec.symbol_fixed(&gather( |
| 6731 | &cdfs.partition_w16[ctx16], | 6631 | &cdfs.partition_w16[ctx16], |
| 6732 | VERT_ALIKE, | 6632 | VERT_ALIKE, |
| 6733 | )); | 6633 | )); |
| 6734 | } else { | 6634 | } else { |
| 6735 | - crate::msac::CURRENT_OP.with(|c| c.set("L6627")); | ||
| 6736 | dec.symbol_fixed(&gather( | 6635 | dec.symbol_fixed(&gather( |
| 6737 | &cdfs.partition_w16[ctx16], | 6636 | &cdfs.partition_w16[ctx16], |
| 6738 | HORZ_ALIKE, | 6637 | HORZ_ALIKE, |
| @@ -6749,7 +6648,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 6749 | for (mr, mc) in leaf_positions { | 6648 | for (mr, mc) in leaf_positions { |
| 6750 | let leaf_mi = (mr as usize, mc as usize); | 6649 | let leaf_mi = (mr as usize, mc as usize); |
| 6751 | let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8); | 6650 | let leaf_ctx = neighbours.partition_ctx_mi(leaf_mi, 8); |
| 6752 | - crate::msac::CURRENT_OP.with(|c| c.set("L6643")); | ||
| 6753 | let part8 = dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); | 6651 | let part8 = dec.symbol(&mut cdfs.partition_w8[leaf_ctx]); |
| 6754 | if part8 != PARTITION_NONE { | 6652 | if part8 != PARTITION_NONE { |
| 6755 | return Err(unsupported( | 6653 | return Err(unsupported( |
crates/ec-av1/src/msac.rsmodified+0 -17
| @@ -19,12 +19,6 @@ | |||
| 19 | /// Probability precision dropped before the range multiply (spec `EC_PROB_SHIFT`). | 19 | /// Probability precision dropped before the range multiply (spec `EC_PROB_SHIFT`). |
| 20 | const EC_PROB_SHIFT: u32 = 6; | 20 | const EC_PROB_SHIFT: u32 = 6; |
| 21 | 21 | ||
| 22 | -thread_local! { | ||
| 23 | - /// Debug-only tag naming the call site of the in-flight `symbol()` read, | ||
| 24 | - /// for the `EC_RNG=1` trace (r5 scratch instrumentation). Set immediately | ||
| 25 | - /// before each `dec.symbol()`/`symbol_fixed()` call in decode.rs. | ||
| 26 | - pub static CURRENT_OP: std::cell::Cell<&'static str> = const { std::cell::Cell::new("?") }; | ||
| 27 | -} | ||
| 28 | /// Minimum interval width reserved for every symbol (spec `EC_MIN_PROB`). | 22 | /// Minimum interval width reserved for every symbol (spec `EC_MIN_PROB`). |
| 29 | const EC_MIN_PROB: u32 = 4; | 23 | const EC_MIN_PROB: u32 = 4; |
| 30 | /// Total probability mass of a CDF (spec `1 << 15`). | 24 | /// Total probability mass of a CDF (spec `1 << 15`). |
| @@ -306,7 +300,6 @@ impl<'a> SymbolDecoder<'a> { | |||
| 306 | /// [`SymbolEncoder::symbol_fixed`]. | 300 | /// [`SymbolEncoder::symbol_fixed`]. |
| 307 | pub fn symbol_fixed(&mut self, cdf: &[u16]) -> usize { | 301 | pub fn symbol_fixed(&mut self, cdf: &[u16]) -> usize { |
| 308 | let nsyms = cdf.len() - 1; | 302 | let nsyms = cdf.len() - 1; |
| 309 | - let rng_before = self.range; | ||
| 310 | let mut cur = self.range; | 303 | let mut cur = self.range; |
| 311 | let mut prev; | 304 | let mut prev; |
| 312 | let mut symbol = 0; | 305 | let mut symbol = 0; |
| @@ -322,16 +315,6 @@ impl<'a> SymbolDecoder<'a> { | |||
| 322 | } | 315 | } |
| 323 | self.range = prev - cur; | 316 | self.range = prev - cur; |
| 324 | self.value -= cur; | 317 | self.value -= cur; |
| 325 | - if std::env::var_os("EC_RNG").is_some() { | ||
| 326 | - use std::sync::atomic::{AtomicU64, Ordering}; | ||
| 327 | - static EC_RNG_N: AtomicU64 = AtomicU64::new(0); | ||
| 328 | - let n = EC_RNG_N.fetch_add(1, Ordering::Relaxed); | ||
| 329 | - let op = CURRENT_OP.with(|c| c.get()); | ||
| 330 | - eprintln!( | ||
| 331 | - "EC_RNG n={n} op={op} rng_before={rng_before} rng_after={} nsyms={nsyms} symbol={symbol}", | ||
| 332 | - self.range | ||
| 333 | - ); | ||
| 334 | - } | ||
| 335 | 318 | ||
| 336 | // Renormalise back into `[2^15, 2^16)`, the same shift the encoder | 319 | // Renormalise back into `[2^15, 2^16)`, the same shift the encoder |
| 337 | // applied when it narrowed to this symbol. | 320 | // applied when it narrowed to this symbol. |