Thread smooth_neighbor into intra edge filter strength (luma)
Browse files at this commitf3c639da5614a4605624b0651d8bea4e7e0f4261Parent: 04170b5- fix
- thread smooth_neighbor into intra edge filter strength (luma)
1 changed file +94 -9
- crates/ec-av1/src/decode.rs +94 -9
crates/ec-av1/src/decode.rsmodified+94 -9
| @@ -66,6 +66,21 @@ pub(crate) fn filter_intra_hits() -> usize { | |||
| 66 | FILTER_INTRA_HITS.with(|c| c.get()) | 66 | FILTER_INTRA_HITS.with(|c| c.get()) |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | +/// How many key-frame luma blocks resolved `smooth_neighbor` (spec | ||
| 70 | +/// `get_intra_edge_filter_type`) to `true` -- lane-chroma r2's own before/after | ||
| 71 | +/// counter, proving a stream actually put a directional block next to a | ||
| 72 | +/// smooth-predicted neighbour rather than every block reading the (previously | ||
| 73 | +/// hardcoded `false`) edge-filter strength bucket unchanged. | ||
| 74 | +thread_local! { | ||
| 75 | + static SMOOTH_LUMA_HITS: std::cell::Cell<usize> = | ||
| 76 | + const { std::cell::Cell::new(0) }; | ||
| 77 | +} | ||
| 78 | + | ||
| 79 | +/// Current value of [`SMOOTH_LUMA_HITS`]. | ||
| 80 | +pub(crate) fn smooth_luma_hits() -> usize { | ||
| 81 | + SMOOTH_LUMA_HITS.with(|c| c.get()) | ||
| 82 | +} | ||
| 83 | + | ||
| 69 | /// How many 4-pixel deblocking edge groups [`edge_params`] has actually | 84 | /// How many 4-pixel deblocking edge groups [`edge_params`] has actually |
| 70 | /// selected for filtering, across every call in the process -- the same | 85 | /// selected for filtering, across every call in the process -- the same |
| 71 | /// before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream | 86 | /// before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream |
| @@ -950,6 +965,13 @@ fn default_intra_tx_type(mode: u8) -> TxType { | |||
| 950 | } | 965 | } |
| 951 | } | 966 | } |
| 952 | 967 | ||
| 968 | +/// `is_smooth` (libaom `reconintra.c`): true for `SMOOTH_PRED..=SMOOTH_H_PRED` | ||
| 969 | +/// (9..=11) — deliberately excludes `PAETH_PRED` (12), which the spec's own | ||
| 970 | +/// `get_intra_edge_filter_type`/libaom `get_filt_type` never treat as smooth. | ||
| 971 | +fn is_smooth_mode(mode: usize) -> bool { | ||
| 972 | + (crate::intra::SMOOTH_PRED as usize..=crate::intra::SMOOTH_H_PRED as usize).contains(&mode) | ||
| 973 | +} | ||
| 974 | + | ||
| 953 | fn read_coeffs( | 975 | fn read_coeffs( |
| 954 | dec: &mut SymbolDecoder, | 976 | dec: &mut SymbolDecoder, |
| 955 | coding: &mut TxbTables, | 977 | coding: &mut TxbTables, |
| @@ -2090,6 +2112,13 @@ fn decode_block_rect( | |||
| 2090 | neighbours.skip_txfm_ctx(r * (SUB / MI), c * (SUB / MI)), | 2112 | neighbours.skip_txfm_ctx(r * (SUB / MI), c * (SUB / MI)), |
| 2091 | allow_screen_content_tools, | 2113 | allow_screen_content_tools, |
| 2092 | )?; | 2114 | )?; |
| 2115 | + // See [`PlaneBuf::reconstruct`]'s doc: chroma stays `false` (exact) until | ||
| 2116 | + // a smooth/paeth `uv_mode` can reach decode at all. | ||
| 2117 | + let smooth_neighbor = | ||
| 2118 | + is_smooth_mode(neighbours.above_mode[c]) || is_smooth_mode(neighbours.left_mode[r]); | ||
| 2119 | + if smooth_neighbor { | ||
| 2120 | + SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1)); | ||
| 2121 | + } | ||
| 2093 | if filter_intra.is_some() { | 2122 | if filter_intra.is_some() { |
| 2094 | // `predict_filter_intra` (spec 7.11.2.3) is square-only in this | 2123 | // `predict_filter_intra` (spec 7.11.2.3) is square-only in this |
| 2095 | // decoder (`assert_eq!(dst.len(), side*side)`) -- a real symbol was | 2124 | // decoder (`assert_eq!(dst.len(), side*side)`) -- a real symbol was |
| @@ -2155,6 +2184,7 @@ fn decode_block_rect( | |||
| 2155 | &vec![0i32; bw * bh], | 2184 | &vec![0i32; bw * bh], |
| 2156 | None, | 2185 | None, |
| 2157 | filter_intra, | 2186 | filter_intra, |
| 2187 | + smooth_neighbor, | ||
| 2158 | ); | 2188 | ); |
| 2159 | let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh)); | 2189 | let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh)); |
| 2160 | u.reconstruct_rect( | 2190 | u.reconstruct_rect( |
| @@ -2168,6 +2198,7 @@ fn decode_block_rect( | |||
| 2168 | &vec![0i32; chroma_w * chroma_h], | 2198 | &vec![0i32; chroma_w * chroma_h], |
| 2169 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 2199 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 2170 | None, | 2200 | None, |
| 2201 | + false, | ||
| 2171 | ); | 2202 | ); |
| 2172 | v.reconstruct_rect( | 2203 | v.reconstruct_rect( |
| 2173 | cpx, | 2204 | cpx, |
| @@ -2180,6 +2211,7 @@ fn decode_block_rect( | |||
| 2180 | &vec![0i32; chroma_w * chroma_h], | 2211 | &vec![0i32; chroma_w * chroma_h], |
| 2181 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 2212 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 2182 | None, | 2213 | None, |
| 2214 | + false, | ||
| 2183 | ); | 2215 | ); |
| 2184 | neighbours.record_rect( | 2216 | neighbours.record_rect( |
| 2185 | at, | 2217 | at, |
| @@ -2273,6 +2305,7 @@ fn decode_block_rect( | |||
| 2273 | &luma_residual, | 2305 | &luma_residual, |
| 2274 | None, | 2306 | None, |
| 2275 | filter_intra, | 2307 | filter_intra, |
| 2308 | + smooth_neighbor, | ||
| 2276 | ); | 2309 | ); |
| 2277 | let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh)); | 2310 | let ac = alpha.map(|_| cfl_ac_q3_rect(y, px, py, bw, bh)); |
| 2278 | let u_default_tx = default_intra_tx_type(uv_predict_mode as u8); | 2311 | let u_default_tx = default_intra_tx_type(uv_predict_mode as u8); |
| @@ -2311,6 +2344,7 @@ fn decode_block_rect( | |||
| 2311 | &u_residual, | 2344 | &u_residual, |
| 2312 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 2345 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 2313 | None, | 2346 | None, |
| 2347 | + false, | ||
| 2314 | ); | 2348 | ); |
| 2315 | let v_default_tx = default_intra_tx_type(uv_predict_mode as u8); | 2349 | let v_default_tx = default_intra_tx_type(uv_predict_mode as u8); |
| 2316 | let v_skip_ctx = usize::from(around[2].0) + usize::from(around[2].1); | 2350 | let v_skip_ctx = usize::from(around[2].0) + usize::from(around[2].1); |
| @@ -2348,6 +2382,7 @@ fn decode_block_rect( | |||
| 2348 | &v_residual, | 2382 | &v_residual, |
| 2349 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 2383 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 2350 | None, | 2384 | None, |
| 2385 | + false, | ||
| 2351 | ); | 2386 | ); |
| 2352 | neighbours.record_rect(at, bw, bh, mode, &[luma_levels, u_levels, v_levels]); | 2387 | neighbours.record_rect(at, bw, bh, mode, &[luma_levels, u_levels, v_levels]); |
| 2353 | RECT_COEFF_HITS.with(|c| c.set(c.get() + 1)); | 2388 | RECT_COEFF_HITS.with(|c| c.set(c.get() + 1)); |
| @@ -2713,6 +2748,7 @@ impl PlaneBuf { | |||
| 2713 | residual: &[i32], | 2748 | residual: &[i32], |
| 2714 | cfl: Option<(i32, &[i32])>, | 2749 | cfl: Option<(i32, &[i32])>, |
| 2715 | filter_intra: Option<usize>, | 2750 | filter_intra: Option<usize>, |
| 2751 | + smooth_neighbor: bool, | ||
| 2716 | ) { | 2752 | ) { |
| 2717 | let (above, left, corner) = self.edges_rect(x, y, bw, bh, reach); | 2753 | let (above, left, corner) = self.edges_rect(x, y, bw, bh, reach); |
| 2718 | let mut prediction = vec![0u8; bw * bh]; | 2754 | let mut prediction = vec![0u8; bw * bh]; |
| @@ -2736,7 +2772,7 @@ impl PlaneBuf { | |||
| 2736 | bw, | 2772 | bw, |
| 2737 | bh, | 2773 | bh, |
| 2738 | enable_edge_filter, | 2774 | enable_edge_filter, |
| 2739 | - false, | 2775 | + smooth_neighbor, |
| 2740 | &mut prediction, | 2776 | &mut prediction, |
| 2741 | ); | 2777 | ); |
| 2742 | } | 2778 | } |
| @@ -2770,6 +2806,15 @@ impl PlaneBuf { | |||
| 2770 | residual: &[i32], | 2806 | residual: &[i32], |
| 2771 | cfl: Option<(i32, &[i32])>, | 2807 | cfl: Option<(i32, &[i32])>, |
| 2772 | filter_intra: Option<usize>, | 2808 | filter_intra: Option<usize>, |
| 2809 | + // `smooth_neighbor` (spec `get_intra_edge_filter_type` / | ||
| 2810 | + // libaom `get_filt_type`): true when the block's above OR left | ||
| 2811 | + // neighbour's mode is `SMOOTH_PRED..=SMOOTH_H_PRED` (never `PAETH`). | ||
| 2812 | + // Callers pass their own plane's neighbour-mode check | ||
| 2813 | + // ([`is_smooth_mode`]) — chroma's is still hardcoded `false` by its | ||
| 2814 | + // callers until a smooth/paeth `uv_mode` can reach this call at all | ||
| 2815 | + // (still refused in `read_intra_mode`/`read_intra_mode_rect`), which | ||
| 2816 | + // keeps `false` exact for chroma without this fn needing to know why. | ||
| 2817 | + smooth_neighbor: bool, | ||
| 2773 | ) { | 2818 | ) { |
| 2774 | let (above, left, corner) = self.edges(x, y, side, reach); | 2819 | let (above, left, corner) = self.edges(x, y, side, reach); |
| 2775 | let mut prediction = vec![0u8; side * side]; | 2820 | let mut prediction = vec![0u8; side * side]; |
| @@ -2789,13 +2834,7 @@ impl PlaneBuf { | |||
| 2789 | // `read_plane`/`decode_block`/`decode_leaf8` call would touch two | 2834 | // `read_plane`/`decode_block`/`decode_leaf8` call would touch two |
| 2790 | // dozen sites for a value that never changes mid-decode, so it | 2835 | // dozen sites for a value that never changes mid-decode, so it |
| 2791 | // rides a thread-local instead (this decoder is single-threaded | 2836 | // rides a thread-local instead (this decoder is single-threaded |
| 2792 | - // per stream). `smooth_neighbor` (spec `get_intra_edge_filter_type`) | 2837 | + // per stream). |
| 2793 | - // is left `false`: exact for chroma here (a smooth `uv_mode` is | ||
| 2794 | - // refused before decode reaches this call) and a corner-cut for | ||
| 2795 | - // luma -- ceiling is one wrong filter-strength bucket on a block | ||
| 2796 | - // whose real neighbour predicted smooth; upgrade path is | ||
| 2797 | - // threading `Neighbours::above_mode`/`left_mode`'s | ||
| 2798 | - // `SMOOTH_PRED..=SMOOTH_H_PRED` membership down instead of `false`. | ||
| 2799 | let enable_edge_filter = ENABLE_EDGE_FILTER.with(std::cell::Cell::get); | 2838 | let enable_edge_filter = ENABLE_EDGE_FILTER.with(std::cell::Cell::get); |
| 2800 | predict( | 2839 | predict( |
| 2801 | mode as u8, | 2840 | mode as u8, |
| @@ -2806,7 +2845,7 @@ impl PlaneBuf { | |||
| 2806 | side, | 2845 | side, |
| 2807 | side, | 2846 | side, |
| 2808 | enable_edge_filter, | 2847 | enable_edge_filter, |
| 2809 | - false, | 2848 | + smooth_neighbor, |
| 2810 | &mut prediction, | 2849 | &mut prediction, |
| 2811 | ); | 2850 | ); |
| 2812 | } | 2851 | } |
| @@ -2856,6 +2895,8 @@ fn read_plane( | |||
| 2856 | // chroma plane), where `txb_skip_ctx` is 0 or the usual OR-of-neighbours | 2895 | // chroma plane), where `txb_skip_ctx` is 0 or the usual OR-of-neighbours |
| 2857 | // formula below. | 2896 | // formula below. |
| 2858 | luma_skip_ctx: Option<usize>, | 2897 | luma_skip_ctx: Option<usize>, |
| 2898 | + // See [`PlaneBuf::reconstruct`]'s own doc: caller's neighbour-smooth check. | ||
| 2899 | + smooth_neighbor: bool, | ||
| 2859 | ) -> Result<Vec<i32>> { | 2900 | ) -> Result<Vec<i32>> { |
| 2860 | let skip_ctx = if plane_idx == 0 { | 2901 | let skip_ctx = if plane_idx == 0 { |
| 2861 | luma_skip_ctx.unwrap_or(0) | 2902 | luma_skip_ctx.unwrap_or(0) |
| @@ -2921,6 +2962,7 @@ fn read_plane( | |||
| 2921 | &residual, | 2962 | &residual, |
| 2922 | cfl, | 2963 | cfl, |
| 2923 | filter_intra, | 2964 | filter_intra, |
| 2965 | + smooth_neighbor, | ||
| 2924 | ); | 2966 | ); |
| 2925 | Ok(if tx_side == side { | 2967 | Ok(if tx_side == side { |
| 2926 | residual_grid_placeholder(&levels, side) | 2968 | residual_grid_placeholder(&levels, side) |
| @@ -2990,6 +3032,13 @@ fn decode_block( | |||
| 2990 | } else { | 3032 | } else { |
| 2991 | uv_mode | 3033 | uv_mode |
| 2992 | }; | 3034 | }; |
| 3035 | + // See [`PlaneBuf::reconstruct`]'s doc: chroma stays `false` (exact) until | ||
| 3036 | + // a smooth/paeth `uv_mode` can reach decode at all. | ||
| 3037 | + let smooth_neighbor = | ||
| 3038 | + is_smooth_mode(neighbours.above_mode[c]) || is_smooth_mode(neighbours.left_mode[r]); | ||
| 3039 | + if smooth_neighbor { | ||
| 3040 | + SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1)); | ||
| 3041 | + } | ||
| 2993 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3042 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 2994 | eprintln!( | 3043 | eprintln!( |
| 2995 | "TRACE block px={px} py={py} side={side} mode={mode} uv_mode={uv_mode} \ | 3044 | "TRACE block px={px} py={py} side={side} mode={mode} uv_mode={uv_mode} \ |
| @@ -3031,6 +3080,7 @@ fn decode_block( | |||
| 3031 | &vec![0i32; side * side], | 3080 | &vec![0i32; side * side], |
| 3032 | None, | 3081 | None, |
| 3033 | filter_intra, | 3082 | filter_intra, |
| 3083 | + smooth_neighbor, | ||
| 3034 | ); | 3084 | ); |
| 3035 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); | 3085 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 3036 | u.reconstruct( | 3086 | u.reconstruct( |
| @@ -3043,6 +3093,7 @@ fn decode_block( | |||
| 3043 | &vec![0i32; chroma_side * chroma_side], | 3093 | &vec![0i32; chroma_side * chroma_side], |
| 3044 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 3094 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 3045 | None, | 3095 | None, |
| 3096 | + false, | ||
| 3046 | ); | 3097 | ); |
| 3047 | v.reconstruct( | 3098 | v.reconstruct( |
| 3048 | cpx, | 3099 | cpx, |
| @@ -3054,6 +3105,7 @@ fn decode_block( | |||
| 3054 | &vec![0i32; chroma_side * chroma_side], | 3105 | &vec![0i32; chroma_side * chroma_side], |
| 3055 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 3106 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 3056 | None, | 3107 | None, |
| 3108 | + false, | ||
| 3057 | ); | 3109 | ); |
| 3058 | let luma_grid = vec![0i32; side * side]; | 3110 | let luma_grid = vec![0i32; side * side]; |
| 3059 | let u_grid = vec![0i32; chroma_side * chroma_side]; | 3111 | let u_grid = vec![0i32; chroma_side * chroma_side]; |
| @@ -3084,6 +3136,7 @@ fn decode_block( | |||
| 3084 | None, | 3136 | None, |
| 3085 | filter_intra, | 3137 | filter_intra, |
| 3086 | None, | 3138 | None, |
| 3139 | + smooth_neighbor, | ||
| 3087 | )?; | 3140 | )?; |
| 3088 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); | 3141 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 3089 | let u_grid = read_plane( | 3142 | let u_grid = read_plane( |
| @@ -3106,6 +3159,7 @@ fn decode_block( | |||
| 3106 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 3159 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 3107 | None, | 3160 | None, |
| 3108 | None, | 3161 | None, |
| 3162 | + false, | ||
| 3109 | )?; | 3163 | )?; |
| 3110 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3164 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3111 | eprintln!( | 3165 | eprintln!( |
| @@ -3133,6 +3187,7 @@ fn decode_block( | |||
| 3133 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 3187 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 3134 | None, | 3188 | None, |
| 3135 | None, | 3189 | None, |
| 3190 | + false, | ||
| 3136 | )?; | 3191 | )?; |
| 3137 | neighbours.record(at, side, mode, &[luma_grid, u_grid, v_grid]); | 3192 | neighbours.record(at, side, mode, &[luma_grid, u_grid, v_grid]); |
| 3138 | } else { | 3193 | } else { |
| @@ -3178,6 +3233,7 @@ fn decode_block( | |||
| 3178 | None, | 3233 | None, |
| 3179 | filter_intra, | 3234 | filter_intra, |
| 3180 | Some(tu_skip_ctx), | 3235 | Some(tu_skip_ctx), |
| 3236 | + smooth_neighbor, | ||
| 3181 | )?; | 3237 | )?; |
| 3182 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3238 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3183 | eprintln!( | 3239 | eprintln!( |
| @@ -3212,6 +3268,7 @@ fn decode_block( | |||
| 3212 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 3268 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 3213 | None, | 3269 | None, |
| 3214 | None, | 3270 | None, |
| 3271 | + false, | ||
| 3215 | )?; | 3272 | )?; |
| 3216 | let v_grid = read_plane( | 3273 | let v_grid = read_plane( |
| 3217 | dec, | 3274 | dec, |
| @@ -3233,6 +3290,7 @@ fn decode_block( | |||
| 3233 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 3290 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 3234 | None, | 3291 | None, |
| 3235 | None, | 3292 | None, |
| 3293 | + false, | ||
| 3236 | )?; | 3294 | )?; |
| 3237 | neighbours.record_split_luma(at, side, mode, [&u_grid, &v_grid]); | 3295 | neighbours.record_split_luma(at, side, mode, [&u_grid, &v_grid]); |
| 3238 | } | 3296 | } |
| @@ -3284,6 +3342,12 @@ fn decode_leaf8( | |||
| 3284 | left_mode = pmode; | 3342 | left_mode = pmode; |
| 3285 | } | 3343 | } |
| 3286 | } | 3344 | } |
| 3345 | + // See [`PlaneBuf::reconstruct`]'s doc: chroma stays `false` (exact) until | ||
| 3346 | + // a smooth/paeth `uv_mode` can reach decode at all. | ||
| 3347 | + let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); | ||
| 3348 | + if smooth_neighbor { | ||
| 3349 | + SMOOTH_LUMA_HITS.with(|c| c.set(c.get() + 1)); | ||
| 3350 | + } | ||
| 3287 | // An 8x8 leaf is well within `is_cfl_allowed`'s <=32x32 bound (spec | 3351 | // An 8x8 leaf is well within `is_cfl_allowed`'s <=32x32 bound (spec |
| 3288 | // 5.11.5), so it reads the CFL-allowed `uv_mode_cfl` CDF, like every other | 3352 | // 5.11.5), so it reads the CFL-allowed `uv_mode_cfl` CDF, like every other |
| 3289 | // `decode_block` caller at 16x16 and up. | 3353 | // `decode_block` caller at 16x16 and up. |
| @@ -3330,6 +3394,7 @@ fn decode_leaf8( | |||
| 3330 | &vec![0i32; 64], | 3394 | &vec![0i32; 64], |
| 3331 | None, | 3395 | None, |
| 3332 | filter_intra, | 3396 | filter_intra, |
| 3397 | + smooth_neighbor, | ||
| 3333 | ); | 3398 | ); |
| 3334 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8)); | 3399 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8)); |
| 3335 | u.reconstruct( | 3400 | u.reconstruct( |
| @@ -3342,6 +3407,7 @@ fn decode_leaf8( | |||
| 3342 | &vec![0i32; 16], | 3407 | &vec![0i32; 16], |
| 3343 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 3408 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 3344 | None, | 3409 | None, |
| 3410 | + false, | ||
| 3345 | ); | 3411 | ); |
| 3346 | v.reconstruct( | 3412 | v.reconstruct( |
| 3347 | cpx, | 3413 | cpx, |
| @@ -3353,6 +3419,7 @@ fn decode_leaf8( | |||
| 3353 | &vec![0i32; 16], | 3419 | &vec![0i32; 16], |
| 3354 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 3420 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 3355 | None, | 3421 | None, |
| 3422 | + false, | ||
| 3356 | ); | 3423 | ); |
| 3357 | luma_grid = vec![0i32; 64]; | 3424 | luma_grid = vec![0i32; 64]; |
| 3358 | u_grid = vec![0i32; 16]; | 3425 | u_grid = vec![0i32; 16]; |
| @@ -3383,6 +3450,7 @@ fn decode_leaf8( | |||
| 3383 | None, | 3450 | None, |
| 3384 | filter_intra, | 3451 | filter_intra, |
| 3385 | None, | 3452 | None, |
| 3453 | + smooth_neighbor, | ||
| 3386 | )?; | 3454 | )?; |
| 3387 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8)); | 3455 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, 8)); |
| 3388 | u_grid = read_plane( | 3456 | u_grid = read_plane( |
| @@ -3405,6 +3473,7 @@ fn decode_leaf8( | |||
| 3405 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 3473 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 3406 | None, | 3474 | None, |
| 3407 | None, | 3475 | None, |
| 3476 | + false, | ||
| 3408 | )?; | 3477 | )?; |
| 3409 | v_grid = read_plane( | 3478 | v_grid = read_plane( |
| 3410 | dec, | 3479 | dec, |
| @@ -3426,6 +3495,7 @@ fn decode_leaf8( | |||
| 3426 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 3495 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 3427 | None, | 3496 | None, |
| 3428 | None, | 3497 | None, |
| 3498 | + false, | ||
| 3429 | )?; | 3499 | )?; |
| 3430 | } else { | 3500 | } else { |
| 3431 | // `tx_depth` resolved this leaf's luma to `TX4`: a 2x2 raster-order | 3501 | // `tx_depth` resolved this leaf's luma to `TX4`: a 2x2 raster-order |
| @@ -3466,6 +3536,7 @@ fn decode_leaf8( | |||
| 3466 | None, | 3536 | None, |
| 3467 | filter_intra, | 3537 | filter_intra, |
| 3468 | Some(tu_skip_ctx), | 3538 | Some(tu_skip_ctx), |
| 3539 | + smooth_neighbor, | ||
| 3469 | )?; | 3540 | )?; |
| 3470 | if std::env::var_os("EC_AV1_TRACE").is_some() { | 3541 | if std::env::var_os("EC_AV1_TRACE").is_some() { |
| 3471 | eprintln!( | 3542 | eprintln!( |
| @@ -3500,6 +3571,7 @@ fn decode_leaf8( | |||
| 3500 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 3571 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 3501 | None, | 3572 | None, |
| 3502 | None, | 3573 | None, |
| 3574 | + false, | ||
| 3503 | )?; | 3575 | )?; |
| 3504 | v_grid = read_plane( | 3576 | v_grid = read_plane( |
| 3505 | dec, | 3577 | dec, |
| @@ -3521,6 +3593,7 @@ fn decode_leaf8( | |||
| 3521 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 3593 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 3522 | None, | 3594 | None, |
| 3523 | None, | 3595 | None, |
| 3596 | + false, | ||
| 3524 | )?; | 3597 | )?; |
| 3525 | // `record_split_luma` expects a `record`-style `(r, c)` position in | 3598 | // `record_split_luma` expects a `record`-style `(r, c)` position in |
| 3526 | // `SUB`-grid units and rescales it by `SUB / MI`; `leaf_mi` is | 3599 | // `SUB`-grid units and rescales it by `SUB / MI`; `leaf_mi` is |
| @@ -7843,6 +7916,7 @@ fn decode_inter_block( | |||
| 7843 | &vec![0i32; side * side], | 7916 | &vec![0i32; side * side], |
| 7844 | None, | 7917 | None, |
| 7845 | None, | 7918 | None, |
| 7919 | + false, | ||
| 7846 | ); | 7920 | ); |
| 7847 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); | 7921 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 7848 | u.reconstruct( | 7922 | u.reconstruct( |
| @@ -7855,6 +7929,7 @@ fn decode_inter_block( | |||
| 7855 | &vec![0i32; chroma_side * chroma_side], | 7929 | &vec![0i32; chroma_side * chroma_side], |
| 7856 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 7930 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 7857 | None, | 7931 | None, |
| 7932 | + false, | ||
| 7858 | ); | 7933 | ); |
| 7859 | v.reconstruct( | 7934 | v.reconstruct( |
| 7860 | cpx, | 7935 | cpx, |
| @@ -7866,6 +7941,7 @@ fn decode_inter_block( | |||
| 7866 | &vec![0i32; chroma_side * chroma_side], | 7941 | &vec![0i32; chroma_side * chroma_side], |
| 7867 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 7942 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 7868 | None, | 7943 | None, |
| 7944 | + false, | ||
| 7869 | ); | 7945 | ); |
| 7870 | luma_grid = vec![0i32; side * side]; | 7946 | luma_grid = vec![0i32; side * side]; |
| 7871 | u_grid = vec![0i32; chroma_side * chroma_side]; | 7947 | u_grid = vec![0i32; chroma_side * chroma_side]; |
| @@ -7892,6 +7968,7 @@ fn decode_inter_block( | |||
| 7892 | None, | 7968 | None, |
| 7893 | None, | 7969 | None, |
| 7894 | None, | 7970 | None, |
| 7971 | + false, | ||
| 7895 | )?; | 7972 | )?; |
| 7896 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); | 7973 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 7897 | u_grid = read_plane( | 7974 | u_grid = read_plane( |
| @@ -7914,6 +7991,7 @@ fn decode_inter_block( | |||
| 7914 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 7991 | alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), |
| 7915 | None, | 7992 | None, |
| 7916 | None, | 7993 | None, |
| 7994 | + false, | ||
| 7917 | )?; | 7995 | )?; |
| 7918 | v_grid = read_plane( | 7996 | v_grid = read_plane( |
| 7919 | dec, | 7997 | dec, |
| @@ -7935,6 +8013,7 @@ fn decode_inter_block( | |||
| 7935 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | 8013 | alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), |
| 7936 | None, | 8014 | None, |
| 7937 | None, | 8015 | None, |
| 8016 | + false, | ||
| 7938 | )?; | 8017 | )?; |
| 7939 | } | 8018 | } |
| 7940 | } | 8019 | } |
| @@ -8916,6 +8995,7 @@ fn decode_inter_block8( | |||
| 8916 | &vec![0i32; SIDE * SIDE], | 8995 | &vec![0i32; SIDE * SIDE], |
| 8917 | None, | 8996 | None, |
| 8918 | None, | 8997 | None, |
| 8998 | + false, | ||
| 8919 | ); | 8999 | ); |
| 8920 | u.reconstruct( | 9000 | u.reconstruct( |
| 8921 | cpx, | 9001 | cpx, |
| @@ -8927,6 +9007,7 @@ fn decode_inter_block8( | |||
| 8927 | &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], | 9007 | &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], |
| 8928 | None, | 9008 | None, |
| 8929 | None, | 9009 | None, |
| 9010 | + false, | ||
| 8930 | ); | 9011 | ); |
| 8931 | v.reconstruct( | 9012 | v.reconstruct( |
| 8932 | cpx, | 9013 | cpx, |
| @@ -8938,6 +9019,7 @@ fn decode_inter_block8( | |||
| 8938 | &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], | 9019 | &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], |
| 8939 | None, | 9020 | None, |
| 8940 | None, | 9021 | None, |
| 9022 | + false, | ||
| 8941 | ); | 9023 | ); |
| 8942 | luma_grid = vec![0i32; SIDE * SIDE]; | 9024 | luma_grid = vec![0i32; SIDE * SIDE]; |
| 8943 | u_grid = vec![0i32; CHROMA_SIDE * CHROMA_SIDE]; | 9025 | u_grid = vec![0i32; CHROMA_SIDE * CHROMA_SIDE]; |
| @@ -8964,6 +9046,7 @@ fn decode_inter_block8( | |||
| 8964 | None, | 9046 | None, |
| 8965 | None, | 9047 | None, |
| 8966 | None, | 9048 | None, |
| 9049 | + false, | ||
| 8967 | )?; | 9050 | )?; |
| 8968 | u_grid = read_plane( | 9051 | u_grid = read_plane( |
| 8969 | dec, | 9052 | dec, |
| @@ -8985,6 +9068,7 @@ fn decode_inter_block8( | |||
| 8985 | None, | 9068 | None, |
| 8986 | None, | 9069 | None, |
| 8987 | None, | 9070 | None, |
| 9071 | + false, | ||
| 8988 | )?; | 9072 | )?; |
| 8989 | v_grid = read_plane( | 9073 | v_grid = read_plane( |
| 8990 | dec, | 9074 | dec, |
| @@ -9006,6 +9090,7 @@ fn decode_inter_block8( | |||
| 9006 | None, | 9090 | None, |
| 9007 | None, | 9091 | None, |
| 9008 | None, | 9092 | None, |
| 9093 | + false, | ||
| 9009 | )?; | 9094 | )?; |
| 9010 | } | 9095 | } |
| 9011 | } | 9096 | } |