Directional luma winners search their angle_delta_y, off screen frames
Browse files at this commita00525205d9bebbe4f8bf77cdd11254956bb2eb6Parent: f944910- feat
- directional luma winners search their angle_delta_y, off screen frames
2 changed files +144 -18
- crates/ec-av1/src/encode.rs +123 -13
- crates/ec-av1/src/tile.rs +21 -5
crates/ec-av1/src/encode.rsmodified+123 -13
| @@ -1561,8 +1561,8 @@ impl Plane<'_> { | ||
| 1561 | 1561 | /// Codes one block under one mode without committing it: hands back the |
| 1562 | 1562 | /// levels, the block the decoder would reconstruct, the squared error |
| 1563 | 1563 | /// against the source and an estimate of what the levels cost in bits. |
| 1564 | - fn trial(&self, at: At, mode: u8, base_q_idx: u8, deadzone: f64, fctx: &crate::decode::FrameCtx) -> Trial { | |
| 1565 | - self.trial_typed(at, mode, base_q_idx, deadzone, TxType::DctDct, fctx) | |
| 1564 | + fn trial(&self, at: At, mode: u8, angle_delta: i32, base_q_idx: u8, deadzone: f64, fctx: &crate::decode::FrameCtx) -> Trial { | |
| 1565 | + self.trial_typed(at, mode, angle_delta, base_q_idx, deadzone, TxType::DctDct, fctx) | |
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | /// [`Self::trial`] under a named transform type -- what an intra chroma |
| @@ -1609,6 +1609,10 @@ impl Plane<'_> { | ||
| 1609 | 1609 | &self, |
| 1610 | 1610 | at: At, |
| 1611 | 1611 | mode: u8, |
| 1612 | + // This block's `angle_delta_y`/`angle_delta_uv` (spec | |
| 1613 | + // `read_intra_angle_info`, -3..=3), zero for every non-directional | |
| 1614 | + // mode -- the predictor's own `angle_delta` argument. | |
| 1615 | + angle_delta: i32, | |
| 1612 | 1616 | base_q_idx: u8, |
| 1613 | 1617 | deadzone: f64, |
| 1614 | 1618 | tx_type: TxType, |
| @@ -1627,7 +1631,7 @@ impl Plane<'_> { | ||
| 1627 | 1631 | let prediction = &mut prediction[..side * side]; |
| 1628 | 1632 | intra_predict_u8( |
| 1629 | 1633 | mode, |
| 1630 | - 0, | |
| 1634 | + angle_delta, | |
| 1631 | 1635 | above, |
| 1632 | 1636 | left, |
| 1633 | 1637 | corner, |
| @@ -1815,6 +1819,7 @@ impl Plane<'_> { | ||
| 1815 | 1819 | &mut self, |
| 1816 | 1820 | at: At, |
| 1817 | 1821 | mode: u8, |
| 1822 | + angle_delta: i32, | |
| 1818 | 1823 | depth: usize, |
| 1819 | 1824 | search: &Search, fctx: &crate::decode::FrameCtx, |
| 1820 | 1825 | ) -> (Vec<i32>, f64, f64) { |
| @@ -1843,7 +1848,7 @@ impl Plane<'_> { | ||
| 1843 | 1848 | reach: Reach::of_tu(side, side, col_off, row_off, tx, tx, reach), |
| 1844 | 1849 | set, |
| 1845 | 1850 | }; |
| 1846 | - let trial = self.trial(tu, mode, search.base_q_idx, search.deadzone, fctx); | |
| 1851 | + let trial = self.trial(tu, mode, angle_delta, search.base_q_idx, search.deadzone, fctx); | |
| 1847 | 1852 | sse += trial.sse; |
| 1848 | 1853 | bits += trial.bits; |
| 1849 | 1854 | self.commit(tu.x, tu.y, tx, &trial); |
| @@ -2072,7 +2077,7 @@ impl Plane<'_> { | ||
| 2072 | 2077 | at: At, |
| 2073 | 2078 | search: &Search, |
| 2074 | 2079 | mode_bits: &[f64; 13], fctx: &crate::decode::FrameCtx, |
| 2075 | - ) -> (Vec<Coeff>, u8, f64) { | |
| 2080 | + ) -> (Vec<Coeff>, u8, i32, f64) { | |
| 2076 | 2081 | let At { |
| 2077 | 2082 | x, y, side, reach, .. |
| 2078 | 2083 | } = at; |
| @@ -2155,13 +2160,69 @@ impl Plane<'_> { | ||
| 2155 | 2160 | best = Some((cost, mode, trial)); |
| 2156 | 2161 | } |
| 2157 | 2162 | } |
| 2158 | - let (cost, mode, trial) = best.expect("the search offers at least one mode"); | |
| 2163 | + let (mut cost, mode, mut trial) = best.expect("the search offers at least one mode"); | |
| 2164 | + // `angle_delta_y` (spec `read_intra_angle_info`): the eight | |
| 2165 | + // directional modes each carry a -3..=3 delta, three degrees a step, | |
| 2166 | + // which the writer has always coded as ZERO because nothing searched | |
| 2167 | + // it. Refined on the winning mode only -- libaom's own ordering, and | |
| 2168 | + // six extra trials on the directional blocks instead of on every | |
| 2169 | + // block times every mode. The edges are the ones the base angle | |
| 2170 | + // already read (`enable_intra_edge_filter` is off in this encoder's | |
| 2171 | + // sequence header, so no delta changes which samples exist), and the | |
| 2172 | + // predictor is the decoder's, `angle_delta` argument and all. | |
| 2173 | + let mut angle_delta = 0i32; | |
| 2174 | + // Not on a screen frame: measured on the 5-row native gate, the | |
| 2175 | + // refinement is worth -0.6/-0.6 on the 2160p film row and flat on the | |
| 2176 | + // 1080p one, but +0.7/+0.3 the WRONG way on the screen capture -- | |
| 2177 | + // synthetic edges land on the base angles, so every delta there buys | |
| 2178 | + // a symbol and no prediction. Same `search.screen` gate palette and | |
| 2179 | + // intrabc already stand behind. | |
| 2180 | + if angle_delta_on() && !search.screen && (V_PRED..=D67_PRED).contains(&mode) { | |
| 2181 | + let row = &cdf::ANGLE_DELTA[usize::from(mode - V_PRED)]; | |
| 2182 | + let zero_bits = symbol_bits(row, crate::tile::ANGLE_DELTA_ZERO); | |
| 2183 | + let mut prediction = vec![0u8; side * side]; | |
| 2184 | + for delta in [-3i32, -2, -1, 1, 2, 3] { | |
| 2185 | + intra_predict_u8( | |
| 2186 | + mode, | |
| 2187 | + delta, | |
| 2188 | + above, | |
| 2189 | + left, | |
| 2190 | + corner, | |
| 2191 | + side, | |
| 2192 | + side, | |
| 2193 | + false, | |
| 2194 | + false, | |
| 2195 | + &mut prediction, fctx, | |
| 2196 | + ); | |
| 2197 | + let candidate = self.code_from_prediction( | |
| 2198 | + x, | |
| 2199 | + y, | |
| 2200 | + side, | |
| 2201 | + &prediction, | |
| 2202 | + false, | |
| 2203 | + search.base_q_idx, | |
| 2204 | + search.deadzone, | |
| 2205 | + at.set, | |
| 2206 | + ); | |
| 2207 | + let bits = symbol_bits(row, (crate::tile::ANGLE_DELTA_ZERO as i32 + delta) as usize) | |
| 2208 | + - zero_bits; | |
| 2209 | + let cost_d = candidate.sse | |
| 2210 | + + search.lambda * (candidate.bits + mode_bits[usize::from(mode)] + bits); | |
| 2211 | + if cost_d < cost { | |
| 2212 | + cost = cost_d; | |
| 2213 | + angle_delta = delta; | |
| 2214 | + trial = candidate; | |
| 2215 | + } | |
| 2216 | + } | |
| 2217 | + ANGLE_DELTA_HITS[(crate::tile::ANGLE_DELTA_ZERO as i32 + angle_delta) as usize] | |
| 2218 | + .fetch_add(1, std::sync::atomic::Ordering::Relaxed); | |
| 2219 | + } | |
| 2159 | 2220 | if census_on() { |
| 2160 | 2221 | LUMA_RANK[sad_rank(&ranking, mode).min(12)] |
| 2161 | 2222 | .fetch_add(1, std::sync::atomic::Ordering::Relaxed); |
| 2162 | 2223 | } |
| 2163 | 2224 | self.commit(x, y, side, &trial); |
| 2164 | - (coeffs(&trial.levels, side), mode, cost) | |
| 2225 | + (coeffs(&trial.levels, side), mode, angle_delta, cost) | |
| 2165 | 2226 | } |
| 2166 | 2227 | } |
| 2167 | 2228 | |
| @@ -3720,7 +3781,8 @@ fn code_square( | ||
| 3720 | 3781 | reach: Reach::of(side, x, y, luma.true_width, luma.true_height, fctx), |
| 3721 | 3782 | set: luma_set, |
| 3722 | 3783 | }; |
| 3723 | - let (mut luma_coeffs, mode, mut cost) = luma.search_block(at, search, mode_bits, fctx); | |
| 3784 | + let (mut luma_coeffs, mode, angle_delta, mut cost) = | |
| 3785 | + luma.search_block(at, search, mode_bits, fctx); | |
| 3724 | 3786 | // The depth search runs on the mode the whole-block transform picked -- |
| 3725 | 3787 | // libaom's own ordering, and the reason it costs one extra pass per depth |
| 3726 | 3788 | // rather than one per (mode, depth) pair. |
| @@ -3733,7 +3795,7 @@ fn code_square( | ||
| 3733 | 3795 | luma_coeffs, |
| 3734 | 3796 | ); |
| 3735 | 3797 | for depth in 1..=max_tx_depth(side) { |
| 3736 | - let (levels, sse, bits) = luma.code_tx_depth(at, mode, depth, search, fctx); | |
| 3798 | + let (levels, sse, bits) = luma.code_tx_depth(at, mode, angle_delta, depth, search, fctx); | |
| 3737 | 3799 | let cost_d = sse |
| 3738 | 3800 | + search.lambda |
| 3739 | 3801 | * (bits + mode_bits[usize::from(mode)] + tx_depth_bits(side, depth)); |
| @@ -3753,6 +3815,7 @@ fn code_square( | ||
| 3753 | 3815 | // A palette block is `DC_PRED` with `tx_depth` 0 by construction: its |
| 3754 | 3816 | // prediction is the colour map, not the DC of its neighbours. |
| 3755 | 3817 | let mut mode = mode; |
| 3818 | + let mut angle_delta = angle_delta; | |
| 3756 | 3819 | let mut palette = None; |
| 3757 | 3820 | if search.screen && crate::decode::palette_bsize_ctx(side).is_some() { |
| 3758 | 3821 | let source: Vec<u8> = (y..y + side) |
| @@ -3785,6 +3848,7 @@ fn code_square( | ||
| 3785 | 3848 | if cost_p < cost { |
| 3786 | 3849 | cost = cost_p; |
| 3787 | 3850 | mode = DC_PRED as u8; |
| 3851 | + angle_delta = 0; | |
| 3788 | 3852 | tx_depth = 0; |
| 3789 | 3853 | luma_coeffs = coeffs(&trial.levels, side); |
| 3790 | 3854 | luma.commit(x, y, side, &trial); |
| @@ -3835,6 +3899,7 @@ fn code_square( | ||
| 3835 | 3899 | palette, |
| 3836 | 3900 | palette_uv, |
| 3837 | 3901 | cfl_alphas, |
| 3902 | + angle_delta_y: angle_delta as i8, | |
| 3838 | 3903 | ..BlockCoeffs::default() |
| 3839 | 3904 | }, |
| 3840 | 3905 | cost, |
| @@ -3884,6 +3949,25 @@ pub(crate) fn take_cfl_alpha_hits() -> [usize; 17] { | ||
| 3884 | 3949 | std::array::from_fn(|m| CFL_ALPHA_HITS[m].swap(0, std::sync::atomic::Ordering::Relaxed)) |
| 3885 | 3950 | } |
| 3886 | 3951 | |
| 3952 | +/// How many directional luma blocks won at each `angle_delta_y`, indexed | |
| 3953 | +/// `delta + 3` -- the histogram that says whether the refinement below ever | |
| 3954 | +/// leaves zero (`gate-blind-to-feature`). | |
| 3955 | +static ANGLE_DELTA_HITS: [std::sync::atomic::AtomicUsize; 7] = | |
| 3956 | + [const { std::sync::atomic::AtomicUsize::new(0) }; 7]; | |
| 3957 | + | |
| 3958 | +/// Reads [`ANGLE_DELTA_HITS`] and zeroes it. | |
| 3959 | +#[cfg(test)] | |
| 3960 | +pub(crate) fn take_angle_delta_hits() -> [usize; 7] { | |
| 3961 | + std::array::from_fn(|d| ANGLE_DELTA_HITS[d].swap(0, std::sync::atomic::Ordering::Relaxed)) | |
| 3962 | +} | |
| 3963 | + | |
| 3964 | +/// Whether the luma search refines a directional winner's `angle_delta_y` | |
| 3965 | +/// (`EC_AV1_ANGLE=0` switches it off, the lane's own on/off pair). | |
| 3966 | +fn angle_delta_on() -> bool { | |
| 3967 | + static ON: std::sync::OnceLock<bool> = std::sync::OnceLock::new(); | |
| 3968 | + *ON.get_or_init(|| std::env::var("EC_AV1_ANGLE").as_deref() != Ok("0")) | |
| 3969 | +} | |
| 3970 | + | |
| 3887 | 3971 | /// Whether the chroma search offers `UV_CFL_PRED` at all (`EC_AV1_CFL=0` |
| 3888 | 3972 | /// switches it off, which is how the lane measured its own on/off pair). |
| 3889 | 3973 | fn cfl_on() -> bool { |
| @@ -3998,8 +4082,8 @@ fn search_chroma( | ||
| 3998 | 4082 | bits += symbol_bits(&cdf::ANGLE_DELTA[usize::from(mode - V_PRED)], 3); |
| 3999 | 4083 | } |
| 4000 | 4084 | let tx_type = crate::decode::default_intra_tx_type(mode); |
| 4001 | - let u = chroma[0].trial_typed(at, mode, search.base_q_idx, search.deadzone, tx_type, fctx); | |
| 4002 | - let v = chroma[1].trial_typed(at, mode, search.base_q_idx, search.deadzone, tx_type, fctx); | |
| 4085 | + let u = chroma[0].trial_typed(at, mode, 0, search.base_q_idx, search.deadzone, tx_type, fctx); | |
| 4086 | + let v = chroma[1].trial_typed(at, mode, 0, search.base_q_idx, search.deadzone, tx_type, fctx); | |
| 4003 | 4087 | let cost = u.sse + v.sse + search.lambda * (bits + u.bits + v.bits); |
| 4004 | 4088 | if best.as_ref().is_none_or(|(b, ..)| cost < *b) { |
| 4005 | 4089 | best = Some((cost, mode, u, v)); |
| @@ -5000,6 +5084,7 @@ fn code_square_inter( | ||
| 5000 | 5084 | chroma[1].commit(x / 2, y / 2, side / 2, &v_new); |
| 5001 | 5085 | return ( |
| 5002 | 5086 | BlockCoeffs { |
| 5087 | + angle_delta_y: 0, | |
| 5003 | 5088 | cfl_alphas: None, |
| 5004 | 5089 | luma: coeffs(&levels, side), |
| 5005 | 5090 | u: coeffs(&u_new.levels, side / 2), |
| @@ -5034,6 +5119,7 @@ fn code_square_inter( | ||
| 5034 | 5119 | chroma[0].commit(x / 2, y / 2, side / 2, &u); |
| 5035 | 5120 | chroma[1].commit(x / 2, y / 2, side / 2, &v); |
| 5036 | 5121 | (BlockCoeffs { |
| 5122 | + angle_delta_y: 0, | |
| 5037 | 5123 | cfl_alphas: None, |
| 5038 | 5124 | luma: coeffs(&levels, side), |
| 5039 | 5125 | u: coeffs(&u.levels, side / 2), |
| @@ -6950,6 +7036,7 @@ fn search_inter_block( | ||
| 6950 | 7036 | set: chroma_set, |
| 6951 | 7037 | }, |
| 6952 | 7038 | DC_PRED, |
| 7039 | + 0, | |
| 6953 | 7040 | search.base_q_idx, |
| 6954 | 7041 | search.deadzone, fctx, |
| 6955 | 7042 | ); |
| @@ -6962,6 +7049,7 @@ fn search_inter_block( | ||
| 6962 | 7049 | set: chroma_set, |
| 6963 | 7050 | }, |
| 6964 | 7051 | DC_PRED, |
| 7052 | + 0, | |
| 6965 | 7053 | search.base_q_idx, |
| 6966 | 7054 | search.deadzone, fctx, |
| 6967 | 7055 | ); |
| @@ -6996,6 +7084,7 @@ fn search_inter_block( | ||
| 6996 | 7084 | set: luma_set, |
| 6997 | 7085 | }, |
| 6998 | 7086 | mode, |
| 7087 | + 0, | |
| 6999 | 7088 | search.base_q_idx, |
| 7000 | 7089 | search.deadzone, fctx, |
| 7001 | 7090 | ); |
| @@ -7738,6 +7827,7 @@ fn search_inter_block( | ||
| 7738 | 7827 | chroma[1].commit(x / 2, y / 2, BLOCK / 2, &best.v); |
| 7739 | 7828 | ( |
| 7740 | 7829 | BlockCoeffs { |
| 7830 | + angle_delta_y: 0, | |
| 7741 | 7831 | cfl_alphas: None, |
| 7742 | 7832 | luma: coeffs(&levels, BLOCK), |
| 7743 | 7833 | u: coeffs(&best.u.levels, BLOCK / 2), |
| @@ -9991,6 +10081,7 @@ mod tests { | ||
| 9991 | 10081 | let (_, inter_header) = inter_frame_headers(width, height, 100, 1, 0).unwrap(); |
| 9992 | 10082 | |
| 9993 | 10083 | let residual_block = BlockCoeffs { |
| 10084 | + angle_delta_y: 0, | |
| 9994 | 10085 | cfl_alphas: None, |
| 9995 | 10086 | luma: vec![Coeff { |
| 9996 | 10087 | row: 0, |
| @@ -11657,8 +11748,10 @@ mod tests { | ||
| 11657 | 11748 | // symbol and one or two magnitude symbols, none of which the |
| 11658 | 11749 | // coefficient sum counts either -- +36.9% here against the same |
| 11659 | 11750 | // fixture's +34.9% with `EC_AV1_CFL=0`. |
| 11751 | + // ... and a directional block whose `angle_delta_y` is no longer | |
| 11752 | + // always ZERO codes a costlier symbol off the same CDF -- +39.1%. | |
| 11660 | 11753 | assert!( |
| 11661 | - worst_under <= 0.38, | |
| 11754 | + worst_under <= 0.40, | |
| 11662 | 11755 | "the writer spent {:.2}% more than the search priced -- more than \ |
| 11663 | 11756 | the mode/mv syntax outside the coefficient sum explains", |
| 11664 | 11757 | worst_under * 100.0 |
| @@ -12712,7 +12805,9 @@ mod tests { | ||
| 12712 | 12805 | /// Re-pinned on lane-av1cfl: the chroma search offers `UV_CFL_PRED`, so |
| 12713 | 12806 | /// every block whose chroma takes it codes a different mode symbol, two |
| 12714 | 12807 | /// alpha symbols and different chroma coefficients. `EC_AV1_CFL=0` |
| 12715 | - /// restores the previous streams. | |
| 12808 | + /// restores the previous streams. Re-pinned again in the same lane once | |
| 12809 | + /// directional luma winners searched their `angle_delta_y` | |
| 12810 | + /// (`EC_AV1_ANGLE=0` restores that half). | |
| 12716 | 12811 | #[test] |
| 12717 | 12812 | fn the_encoders_own_streams_are_byte_identical_to_their_pins() { |
| 12718 | 12813 | if !have_ffmpeg() { |
| @@ -13222,6 +13317,21 @@ mod tests { | ||
| 13222 | 13317 | // plane of every `UV_CFL_PRED` block, by |alpha_q3|. A tool that |
| 13223 | 13318 | // only ever fires at one magnitude is a search that never left |
| 13224 | 13319 | // its first candidate (gate-blind-to-feature). |
| 13320 | + // The luma angle-delta histogram (lane-av1cfl): how many | |
| 13321 | + // directional blocks won at each delta. All-zero would mean the | |
| 13322 | + // refinement never beat the base angle. | |
| 13323 | + let deltas = take_angle_delta_hits(); | |
| 13324 | + if deltas.iter().sum::<usize>() > 0 { | |
| 13325 | + eprintln!( | |
| 13326 | + "{name}: angle_delta_y {}", | |
| 13327 | + deltas | |
| 13328 | + .iter() | |
| 13329 | + .enumerate() | |
| 13330 | + .map(|(d, &n)| format!("{:+}={n}", d as i32 - 3)) | |
| 13331 | + .collect::<Vec<_>>() | |
| 13332 | + .join(" ") | |
| 13333 | + ); | |
| 13334 | + } | |
| 13225 | 13335 | let alphas = take_cfl_alpha_hits(); |
| 13226 | 13336 | if alphas.iter().sum::<usize>() > 0 { |
| 13227 | 13337 | eprintln!( |
crates/ec-av1/src/tile.rsmodified+21 -5
| @@ -1053,7 +1053,7 @@ pub(crate) const INTRA_MODE_CTX: [usize; INTRA_MODES] = [0, 1, 2, 3, 4, 4, 4, 4, | ||
| 1053 | 1053 | |
| 1054 | 1054 | /// The symbol an angle delta of zero codes as: the alphabet runs from -3 to |
| 1055 | 1055 | /// +3, so `MAX_ANGLE_DELTA` is the middle of it. |
| 1056 | -const ANGLE_DELTA_ZERO: usize = 3; | |
| 1056 | +pub(crate) const ANGLE_DELTA_ZERO: usize = 3; | |
| 1057 | 1057 | /// Side of a superblock in 4x4 mode-info units when 128x128 superblocks are off. |
| 1058 | 1058 | const SB_MI: u32 = 16; |
| 1059 | 1059 | |
| @@ -1452,6 +1452,10 @@ pub struct BlockCoeffs { | ||
| 1452 | 1452 | /// [`UV_CFL_PRED`]; at least one of the pair is nonzero, since the joint |
| 1453 | 1453 | /// sign symbol has no (ZERO, ZERO) value. |
| 1454 | 1454 | pub cfl_alphas: Option<(i32, i32)>, |
| 1455 | + /// This block's `angle_delta_y` (spec `read_intra_angle_info`, -3..=3), | |
| 1456 | + /// zero for every non-directional luma mode -- which is what | |
| 1457 | + /// [`Default`] gives, and what every writer coded before lane-av1cfl. | |
| 1458 | + pub angle_delta_y: i8, | |
| 1455 | 1459 | /// This block's intra block-copy vector (spec 5.11.13 `use_intrabc` -> |
| 1456 | 1460 | /// `assign_dv`), in the spec's 1/8-pel `(row, col)` units, or `None` for |
| 1457 | 1461 | /// an ordinary intra block. Only a key frame whose header set |
| @@ -3403,7 +3407,10 @@ fn write_intra_mode( | ||
| 3403 | 3407 | ); |
| 3404 | 3408 | ec_rng_trace(|| format!("EC_YMODE mode={mode} tell={} rng={}", enc.tell(), enc.rng())); |
| 3405 | 3409 | if (V_PRED..=D67_PRED).contains(&mode) { |
| 3406 | - enc.symbol(ANGLE_DELTA_ZERO, &mut cdfs.angle_delta[mode - V_PRED]); | |
| 3410 | + enc.symbol( | |
| 3411 | + (ANGLE_DELTA_ZERO as i32 + i32::from(block.angle_delta_y)) as usize, | |
| 3412 | + &mut cdfs.angle_delta[mode - V_PRED], | |
| 3413 | + ); | |
| 3407 | 3414 | } |
| 3408 | 3415 | // A block small enough to be offered chroma from luma reads the wider |
| 3409 | 3416 | // table even when it does not take the mode. |
| @@ -5791,7 +5798,10 @@ pub(crate) fn sb_coeff_inter_frame_tile_cdfs( | ||
| 5791 | 5798 | let mode = usize::from(block.mode); |
| 5792 | 5799 | enc.symbol(mode, &mut cdfs.y_mode[SIZE_GROUP_32]); |
| 5793 | 5800 | if (V_PRED..=D67_PRED).contains(&mode) { |
| 5794 | - enc.symbol(ANGLE_DELTA_ZERO, &mut cdfs.angle_delta[mode - V_PRED]); | |
| 5801 | + enc.symbol( | |
| 5802 | + (ANGLE_DELTA_ZERO as i32 + i32::from(block.angle_delta_y)) as usize, | |
| 5803 | + &mut cdfs.angle_delta[mode - V_PRED], | |
| 5804 | + ); | |
| 5795 | 5805 | } |
| 5796 | 5806 | let uv_mode = usize::from(block.uv_mode); |
| 5797 | 5807 | enc.symbol(uv_mode, &mut cdfs.uv_mode_cfl[mode]); |
| @@ -6029,7 +6039,10 @@ fn write_inter_frame_leaf( | ||
| 6029 | 6039 | let mode = usize::from(block.mode); |
| 6030 | 6040 | enc.symbol(mode, &mut cdfs.y_mode[SIZE_GROUP_16]); |
| 6031 | 6041 | if (V_PRED..=D67_PRED).contains(&mode) { |
| 6032 | - enc.symbol(ANGLE_DELTA_ZERO, &mut cdfs.angle_delta[mode - V_PRED]); | |
| 6042 | + enc.symbol( | |
| 6043 | + (ANGLE_DELTA_ZERO as i32 + i32::from(block.angle_delta_y)) as usize, | |
| 6044 | + &mut cdfs.angle_delta[mode - V_PRED], | |
| 6045 | + ); | |
| 6033 | 6046 | } |
| 6034 | 6047 | let uv_mode = usize::from(block.uv_mode); |
| 6035 | 6048 | enc.symbol(uv_mode, &mut cdfs.uv_mode_cfl[mode]); |
| @@ -6273,7 +6286,10 @@ fn write_inter_frame_leaf8( | ||
| 6273 | 6286 | let mode = usize::from(block.mode); |
| 6274 | 6287 | enc.symbol(mode, &mut cdfs.y_mode[SIZE_GROUP_8]); |
| 6275 | 6288 | if (V_PRED..=D67_PRED).contains(&mode) { |
| 6276 | - enc.symbol(ANGLE_DELTA_ZERO, &mut cdfs.angle_delta[mode - V_PRED]); | |
| 6289 | + enc.symbol( | |
| 6290 | + (ANGLE_DELTA_ZERO as i32 + i32::from(block.angle_delta_y)) as usize, | |
| 6291 | + &mut cdfs.angle_delta[mode - V_PRED], | |
| 6292 | + ); | |
| 6277 | 6293 | } |
| 6278 | 6294 | let uv_mode = usize::from(block.uv_mode); |
| 6279 | 6295 | enc.symbol(uv_mode, &mut cdfs.uv_mode_cfl[mode]); |