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