Merge branch 'lane-rectchroma2' (48216c2): MC kernels take the block's true dims, and the edge gate goes full-plane
Browse files at this commit4 changed files +450 -20
- crates/ec-av1/src/decode.rs +36 -12
- crates/ec-av1/src/mc.rs +117 -5
- crates/ec-av1/src/stream.rs +210 -3
- lanes/rectchroma2-r1.report.md +87 -0
crates/ec-av1/src/decode.rsmodified+36 -12
| @@ -17826,7 +17826,7 @@ fn decode_inter_block( | |||
| 17826 | } | 17826 | } |
| 17827 | 17827 | ||
| 17828 | let mut inter0_y = vec![0i32; side * side]; | 17828 | let mut inter0_y = vec![0i32; side * side]; |
| 17829 | - mc::predict_compound_intermediate( | 17829 | + mc::predict_compound_intermediate_kern( |
| 17830 | &py0.data, | 17830 | &py0.data, |
| 17831 | py0.width, | 17831 | py0.width, |
| 17832 | py0.true_width, | 17832 | py0.true_width, |
| @@ -17836,6 +17836,8 @@ fn decode_inter_block( | |||
| 17836 | scale0, | 17836 | scale0, |
| 17837 | side, | 17837 | side, |
| 17838 | side, | 17838 | side, |
| 17839 | + write_w, | ||
| 17840 | + write_h, | ||
| 17839 | h_filter, | 17841 | h_filter, |
| 17840 | v_filter, | 17842 | v_filter, |
| 17841 | &mut inter0_y, | 17843 | &mut inter0_y, |
| @@ -17851,7 +17853,7 @@ fn decode_inter_block( | |||
| 17851 | ); | 17853 | ); |
| 17852 | } | 17854 | } |
| 17853 | let mut inter1_y = vec![0i32; side * side]; | 17855 | let mut inter1_y = vec![0i32; side * side]; |
| 17854 | - mc::predict_compound_intermediate( | 17856 | + mc::predict_compound_intermediate_kern( |
| 17855 | &py1.data, | 17857 | &py1.data, |
| 17856 | py1.width, | 17858 | py1.width, |
| 17857 | py1.true_width, | 17859 | py1.true_width, |
| @@ -17861,6 +17863,8 @@ fn decode_inter_block( | |||
| 17861 | scale1, | 17863 | scale1, |
| 17862 | side, | 17864 | side, |
| 17863 | side, | 17865 | side, |
| 17866 | + write_w, | ||
| 17867 | + write_h, | ||
| 17864 | h_filter, | 17868 | h_filter, |
| 17865 | v_filter, | 17869 | v_filter, |
| 17866 | &mut inter1_y, | 17870 | &mut inter1_y, |
| @@ -17898,7 +17902,7 @@ fn decode_inter_block( | |||
| 17898 | } | 17902 | } |
| 17899 | 17903 | ||
| 17900 | let mut inter0_u = vec![0i32; chroma_side * chroma_side]; | 17904 | let mut inter0_u = vec![0i32; chroma_side * chroma_side]; |
| 17901 | - mc::predict_compound_intermediate( | 17905 | + mc::predict_compound_intermediate_kern( |
| 17902 | &pu0.data, | 17906 | &pu0.data, |
| 17903 | pu0.width, | 17907 | pu0.width, |
| 17904 | pu0.true_width, | 17908 | pu0.true_width, |
| @@ -17908,6 +17912,8 @@ fn decode_inter_block( | |||
| 17908 | scale0, | 17912 | scale0, |
| 17909 | chroma_side, | 17913 | chroma_side, |
| 17910 | chroma_side, | 17914 | chroma_side, |
| 17915 | + write_chroma_w, | ||
| 17916 | + write_chroma_h, | ||
| 17911 | h_filter, | 17917 | h_filter, |
| 17912 | v_filter, | 17918 | v_filter, |
| 17913 | &mut inter0_u, | 17919 | &mut inter0_u, |
| @@ -17925,7 +17931,7 @@ fn decode_inter_block( | |||
| 17925 | } | 17931 | } |
| 17926 | } | 17932 | } |
| 17927 | let mut inter1_u = vec![0i32; chroma_side * chroma_side]; | 17933 | let mut inter1_u = vec![0i32; chroma_side * chroma_side]; |
| 17928 | - mc::predict_compound_intermediate( | 17934 | + mc::predict_compound_intermediate_kern( |
| 17929 | &pu1.data, | 17935 | &pu1.data, |
| 17930 | pu1.width, | 17936 | pu1.width, |
| 17931 | pu1.true_width, | 17937 | pu1.true_width, |
| @@ -17935,6 +17941,8 @@ fn decode_inter_block( | |||
| 17935 | scale1, | 17941 | scale1, |
| 17936 | chroma_side, | 17942 | chroma_side, |
| 17937 | chroma_side, | 17943 | chroma_side, |
| 17944 | + write_chroma_w, | ||
| 17945 | + write_chroma_h, | ||
| 17938 | h_filter, | 17946 | h_filter, |
| 17939 | v_filter, | 17947 | v_filter, |
| 17940 | &mut inter1_u, | 17948 | &mut inter1_u, |
| @@ -17968,7 +17976,7 @@ fn decode_inter_block( | |||
| 17968 | } | 17976 | } |
| 17969 | 17977 | ||
| 17970 | let mut inter0_v = vec![0i32; chroma_side * chroma_side]; | 17978 | let mut inter0_v = vec![0i32; chroma_side * chroma_side]; |
| 17971 | - mc::predict_compound_intermediate( | 17979 | + mc::predict_compound_intermediate_kern( |
| 17972 | &pv0.data, | 17980 | &pv0.data, |
| 17973 | pv0.width, | 17981 | pv0.width, |
| 17974 | pv0.true_width, | 17982 | pv0.true_width, |
| @@ -17978,6 +17986,8 @@ fn decode_inter_block( | |||
| 17978 | scale0, | 17986 | scale0, |
| 17979 | chroma_side, | 17987 | chroma_side, |
| 17980 | chroma_side, | 17988 | chroma_side, |
| 17989 | + write_chroma_w, | ||
| 17990 | + write_chroma_h, | ||
| 17981 | h_filter, | 17991 | h_filter, |
| 17982 | v_filter, | 17992 | v_filter, |
| 17983 | &mut inter0_v, | 17993 | &mut inter0_v, |
| @@ -17995,7 +18005,7 @@ fn decode_inter_block( | |||
| 17995 | } | 18005 | } |
| 17996 | } | 18006 | } |
| 17997 | let mut inter1_v = vec![0i32; chroma_side * chroma_side]; | 18007 | let mut inter1_v = vec![0i32; chroma_side * chroma_side]; |
| 17998 | - mc::predict_compound_intermediate( | 18008 | + mc::predict_compound_intermediate_kern( |
| 17999 | &pv1.data, | 18009 | &pv1.data, |
| 18000 | pv1.width, | 18010 | pv1.width, |
| 18001 | pv1.true_width, | 18011 | pv1.true_width, |
| @@ -18005,6 +18015,8 @@ fn decode_inter_block( | |||
| 18005 | scale1, | 18015 | scale1, |
| 18006 | chroma_side, | 18016 | chroma_side, |
| 18007 | chroma_side, | 18017 | chroma_side, |
| 18018 | + write_chroma_w, | ||
| 18019 | + write_chroma_h, | ||
| 18008 | h_filter, | 18020 | h_filter, |
| 18009 | v_filter, | 18021 | v_filter, |
| 18010 | &mut inter1_v, | 18022 | &mut inter1_v, |
| @@ -18892,7 +18904,7 @@ fn decode_inter_block( | |||
| 18892 | let mut pred_u = vec![0u16; chroma_side * chroma_side]; | 18904 | let mut pred_u = vec![0u16; chroma_side * chroma_side]; |
| 18893 | let mut pred_v = vec![0u16; chroma_side * chroma_side]; | 18905 | let mut pred_v = vec![0u16; chroma_side * chroma_side]; |
| 18894 | if luma_scale == mc::REF_NO_SCALE { | 18906 | if luma_scale == mc::REF_NO_SCALE { |
| 18895 | - mc::predict_with_filters( | 18907 | + mc::predict_with_filters_kern( |
| 18896 | &py_ref.data, | 18908 | &py_ref.data, |
| 18897 | py_ref.width, | 18909 | py_ref.width, |
| 18898 | py_ref.true_width, | 18910 | py_ref.true_width, |
| @@ -18901,11 +18913,13 @@ fn decode_inter_block( | |||
| 18901 | mv_to_q4(py, mv.0, true), | 18913 | mv_to_q4(py, mv.0, true), |
| 18902 | side, | 18914 | side, |
| 18903 | side, | 18915 | side, |
| 18916 | + write_w, | ||
| 18917 | + write_h, | ||
| 18904 | h_filter, | 18918 | h_filter, |
| 18905 | v_filter, | 18919 | v_filter, |
| 18906 | &mut pred_y, | 18920 | &mut pred_y, |
| 18907 | ); | 18921 | ); |
| 18908 | - mc::predict_with_filters( | 18922 | + mc::predict_with_filters_kern( |
| 18909 | &pu_ref.data, | 18923 | &pu_ref.data, |
| 18910 | pu_ref.width, | 18924 | pu_ref.width, |
| 18911 | pu_ref.true_width, | 18925 | pu_ref.true_width, |
| @@ -18914,11 +18928,13 @@ fn decode_inter_block( | |||
| 18914 | mv_to_q4(cpy, mv.0, false), | 18928 | mv_to_q4(cpy, mv.0, false), |
| 18915 | chroma_side, | 18929 | chroma_side, |
| 18916 | chroma_side, | 18930 | chroma_side, |
| 18931 | + write_chroma_w, | ||
| 18932 | + write_chroma_h, | ||
| 18917 | h_filter, | 18933 | h_filter, |
| 18918 | v_filter, | 18934 | v_filter, |
| 18919 | &mut pred_u, | 18935 | &mut pred_u, |
| 18920 | ); | 18936 | ); |
| 18921 | - mc::predict_with_filters( | 18937 | + mc::predict_with_filters_kern( |
| 18922 | &pv_ref.data, | 18938 | &pv_ref.data, |
| 18923 | pv_ref.width, | 18939 | pv_ref.width, |
| 18924 | pv_ref.true_width, | 18940 | pv_ref.true_width, |
| @@ -18927,12 +18943,14 @@ fn decode_inter_block( | |||
| 18927 | mv_to_q4(cpy, mv.0, false), | 18943 | mv_to_q4(cpy, mv.0, false), |
| 18928 | chroma_side, | 18944 | chroma_side, |
| 18929 | chroma_side, | 18945 | chroma_side, |
| 18946 | + write_chroma_w, | ||
| 18947 | + write_chroma_h, | ||
| 18930 | h_filter, | 18948 | h_filter, |
| 18931 | v_filter, | 18949 | v_filter, |
| 18932 | &mut pred_v, | 18950 | &mut pred_v, |
| 18933 | ); | 18951 | ); |
| 18934 | } else { | 18952 | } else { |
| 18935 | - mc::predict_scaled( | 18953 | + mc::predict_scaled_kern( |
| 18936 | &py_ref.data, | 18954 | &py_ref.data, |
| 18937 | py_ref.width, | 18955 | py_ref.width, |
| 18938 | py_ref.true_width, | 18956 | py_ref.true_width, |
| @@ -18942,11 +18960,13 @@ fn decode_inter_block( | |||
| 18942 | luma_scale, | 18960 | luma_scale, |
| 18943 | side, | 18961 | side, |
| 18944 | side, | 18962 | side, |
| 18963 | + write_w, | ||
| 18964 | + write_h, | ||
| 18945 | h_filter, | 18965 | h_filter, |
| 18946 | v_filter, | 18966 | v_filter, |
| 18947 | &mut pred_y, | 18967 | &mut pred_y, |
| 18948 | ); | 18968 | ); |
| 18949 | - mc::predict_scaled( | 18969 | + mc::predict_scaled_kern( |
| 18950 | &pu_ref.data, | 18970 | &pu_ref.data, |
| 18951 | pu_ref.width, | 18971 | pu_ref.width, |
| 18952 | pu_ref.true_width, | 18972 | pu_ref.true_width, |
| @@ -18956,11 +18976,13 @@ fn decode_inter_block( | |||
| 18956 | luma_scale, | 18976 | luma_scale, |
| 18957 | chroma_side, | 18977 | chroma_side, |
| 18958 | chroma_side, | 18978 | chroma_side, |
| 18979 | + write_chroma_w, | ||
| 18980 | + write_chroma_h, | ||
| 18959 | h_filter, | 18981 | h_filter, |
| 18960 | v_filter, | 18982 | v_filter, |
| 18961 | &mut pred_u, | 18983 | &mut pred_u, |
| 18962 | ); | 18984 | ); |
| 18963 | - mc::predict_scaled( | 18985 | + mc::predict_scaled_kern( |
| 18964 | &pv_ref.data, | 18986 | &pv_ref.data, |
| 18965 | pv_ref.width, | 18987 | pv_ref.width, |
| 18966 | pv_ref.true_width, | 18988 | pv_ref.true_width, |
| @@ -18970,6 +18992,8 @@ fn decode_inter_block( | |||
| 18970 | luma_scale, | 18992 | luma_scale, |
| 18971 | chroma_side, | 18993 | chroma_side, |
| 18972 | chroma_side, | 18994 | chroma_side, |
| 18995 | + write_chroma_w, | ||
| 18996 | + write_chroma_h, | ||
| 18973 | h_filter, | 18997 | h_filter, |
| 18974 | v_filter, | 18998 | v_filter, |
| 18975 | &mut pred_v, | 18999 | &mut pred_v, |
crates/ec-av1/src/mc.rsmodified+117 -5
| @@ -333,6 +333,36 @@ pub fn predict_with_filters( | |||
| 333 | h_kind: InterpFilterKind, | 333 | h_kind: InterpFilterKind, |
| 334 | v_kind: InterpFilterKind, | 334 | v_kind: InterpFilterKind, |
| 335 | dst: &mut [u16], | 335 | dst: &mut [u16], |
| 336 | +) { | ||
| 337 | + predict_with_filters_kern( | ||
| 338 | + reference, stride, true_width, true_height, x_q4, y_q4, block_w, | ||
| 339 | + block_h, block_w, block_h, h_kind, v_kind, dst, | ||
| 340 | + ); | ||
| 341 | +} | ||
| 342 | + | ||
| 343 | +/// [`predict_with_filters`] with the 4-tap decision taken from the block's | ||
| 344 | +/// TRUE width/height (`kern_w`/`kern_h`) rather than the destination buffer's. | ||
| 345 | +/// libaom's `av1_get_interp_filter_params_with_block_size` (reconinter.h, | ||
| 346 | +/// called per axis from `inter_predictor` with `w` then `h`) picks the narrow | ||
| 347 | +/// kernel from the PREDICTION block's own dimensions; our inter path predicts | ||
| 348 | +/// a rectangular block over its enclosing square buffer, so a rect block whose | ||
| 349 | +/// chroma is 4 wide or 4 tall (luma 8x16 / 16x8 and taller kin) must still ask | ||
| 350 | +/// for the 4-tap kernel on that axis -- lane-rectchroma2 r1. | ||
| 351 | +#[allow(clippy::too_many_arguments)] | ||
| 352 | +pub fn predict_with_filters_kern( | ||
| 353 | + reference: &[u16], | ||
| 354 | + stride: usize, | ||
| 355 | + true_width: usize, | ||
| 356 | + true_height: usize, | ||
| 357 | + x_q4: i32, | ||
| 358 | + y_q4: i32, | ||
| 359 | + block_w: usize, | ||
| 360 | + block_h: usize, | ||
| 361 | + kern_w: usize, | ||
| 362 | + kern_h: usize, | ||
| 363 | + h_kind: InterpFilterKind, | ||
| 364 | + v_kind: InterpFilterKind, | ||
| 365 | + dst: &mut [u16], | ||
| 336 | ) { | 366 | ) { |
| 337 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); | 367 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); |
| 338 | assert!(!reference.is_empty(), "a reference plane has samples"); | 368 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| @@ -374,12 +404,13 @@ pub fn predict_with_filters( | |||
| 374 | 404 | ||
| 375 | let (h_wide, h_narrow) = h_kind.tables(); | 405 | let (h_wide, h_narrow) = h_kind.tables(); |
| 376 | let (v_wide, v_narrow) = v_kind.tables(); | 406 | let (v_wide, v_narrow) = v_kind.tables(); |
| 377 | - let h_filter = if block_w <= 4 { | 407 | + note_narrow_kern(block_w, block_h, kern_w, kern_h); |
| 408 | + let h_filter = if kern_w <= 4 { | ||
| 378 | &h_narrow[xfrac] | 409 | &h_narrow[xfrac] |
| 379 | } else { | 410 | } else { |
| 380 | &h_wide[xfrac] | 411 | &h_wide[xfrac] |
| 381 | }; | 412 | }; |
| 382 | - let v_filter = if block_h <= 4 { | 413 | + let v_filter = if kern_h <= 4 { |
| 383 | &v_narrow[yfrac] | 414 | &v_narrow[yfrac] |
| 384 | } else { | 415 | } else { |
| 385 | &v_wide[yfrac] | 416 | &v_wide[yfrac] |
| @@ -452,6 +483,32 @@ thread_local! { | |||
| 452 | /// only intra blocks cannot pass it by construction (class | 483 | /// only intra blocks cannot pass it by construction (class |
| 453 | /// `gate-blind-to-feature`). | 484 | /// `gate-blind-to-feature`). |
| 454 | static INTER_PRED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | 485 | static INTER_PRED_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 486 | + | ||
| 487 | + /// lane-rectchroma2 r1: how often the 4-tap decision came out DIFFERENT | ||
| 488 | + /// from what the destination buffer's own dimensions would have given -- | ||
| 489 | + /// i.e. how often a rectangular block predicted over its enclosing square | ||
| 490 | + /// buffer asked for libaom's narrow kernel on an axis. Zero means a gate | ||
| 491 | + /// never exercised the rect-chroma shape at all. | ||
| 492 | + static RECT_NARROW_KERN_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 493 | +} | ||
| 494 | + | ||
| 495 | +/// Current value of [`RECT_NARROW_KERN_HITS`]. | ||
| 496 | +pub fn rect_narrow_kern_hits() -> usize { | ||
| 497 | + RECT_NARROW_KERN_HITS.with(|c| c.get()) | ||
| 498 | +} | ||
| 499 | + | ||
| 500 | +/// Resets [`RECT_NARROW_KERN_HITS`] (per-attempt counting, class | ||
| 501 | +/// `counter-from-refused-stream`). | ||
| 502 | +pub fn reset_rect_narrow_kern_hits() { | ||
| 503 | + RECT_NARROW_KERN_HITS.with(|c| c.set(0)); | ||
| 504 | +} | ||
| 505 | + | ||
| 506 | +/// Bumps [`RECT_NARROW_KERN_HITS`] when the block's true dims pick a kernel | ||
| 507 | +/// the destination buffer's dims would not have. | ||
| 508 | +fn note_narrow_kern(block_w: usize, block_h: usize, kern_w: usize, kern_h: usize) { | ||
| 509 | + if (kern_w <= 4) != (block_w <= 4) || (kern_h <= 4) != (block_h <= 4) { | ||
| 510 | + RECT_NARROW_KERN_HITS.with(|c| c.set(c.get() + 1)); | ||
| 511 | + } | ||
| 455 | } | 512 | } |
| 456 | 513 | ||
| 457 | /// Current value of [`INTER_PRED_HITS`]. | 514 | /// Current value of [`INTER_PRED_HITS`]. |
| @@ -498,6 +555,7 @@ fn horizontal_scaled_pass( | |||
| 498 | y0: i32, | 555 | y0: i32, |
| 499 | x_scale_fp: i64, | 556 | x_scale_fp: i64, |
| 500 | block_w: usize, | 557 | block_w: usize, |
| 558 | + kern_w: usize, | ||
| 501 | rows: usize, | 559 | rows: usize, |
| 502 | h_kind: InterpFilterKind, | 560 | h_kind: InterpFilterKind, |
| 503 | intermediate: &mut [i32], | 561 | intermediate: &mut [i32], |
| @@ -510,7 +568,7 @@ fn horizontal_scaled_pass( | |||
| 510 | let x_qn = pos_x_q10 + c as i64 * x_step_qn; | 568 | let x_qn = pos_x_q10 + c as i64 * x_step_qn; |
| 511 | let int_pel = (x_qn >> 10) as i32; | 569 | let int_pel = (x_qn >> 10) as i32; |
| 512 | let filter_idx = ((x_qn & 1023) >> 6) as usize; | 570 | let filter_idx = ((x_qn & 1023) >> 6) as usize; |
| 513 | - let h_filter = if block_w <= 4 { | 571 | + let h_filter = if kern_w <= 4 { |
| 514 | &h_narrow[filter_idx] | 572 | &h_narrow[filter_idx] |
| 515 | } else { | 573 | } else { |
| 516 | &h_wide[filter_idx] | 574 | &h_wide[filter_idx] |
| @@ -555,6 +613,31 @@ pub fn predict_scaled( | |||
| 555 | h_kind: InterpFilterKind, | 613 | h_kind: InterpFilterKind, |
| 556 | v_kind: InterpFilterKind, | 614 | v_kind: InterpFilterKind, |
| 557 | dst: &mut [u16], | 615 | dst: &mut [u16], |
| 616 | +) { | ||
| 617 | + predict_scaled_kern( | ||
| 618 | + reference, stride, true_width, true_height, x_q4, y_q4, x_scale_fp, | ||
| 619 | + block_w, block_h, block_w, block_h, h_kind, v_kind, dst, | ||
| 620 | + ); | ||
| 621 | +} | ||
| 622 | + | ||
| 623 | +/// [`predict_scaled`] with the 4-tap decision from the block's true dims | ||
| 624 | +/// (see [`predict_with_filters_kern`]). | ||
| 625 | +#[allow(clippy::too_many_arguments)] | ||
| 626 | +pub fn predict_scaled_kern( | ||
| 627 | + reference: &[u16], | ||
| 628 | + stride: usize, | ||
| 629 | + true_width: usize, | ||
| 630 | + true_height: usize, | ||
| 631 | + x_q4: i32, | ||
| 632 | + y_q4: i32, | ||
| 633 | + x_scale_fp: i64, | ||
| 634 | + block_w: usize, | ||
| 635 | + block_h: usize, | ||
| 636 | + kern_w: usize, | ||
| 637 | + kern_h: usize, | ||
| 638 | + h_kind: InterpFilterKind, | ||
| 639 | + v_kind: InterpFilterKind, | ||
| 640 | + dst: &mut [u16], | ||
| 558 | ) { | 641 | ) { |
| 559 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); | 642 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); |
| 560 | assert!(!reference.is_empty(), "a reference plane has samples"); | 643 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| @@ -568,7 +651,8 @@ pub fn predict_scaled( | |||
| 568 | // Q10; off/pos_x_q10 fold the block's own x_q4 (Q4) into that same Q10 | 651 | // Q10; off/pos_x_q10 fold the block's own x_q4 (Q4) into that same Q10 |
| 569 | // grid (spec 7.11.3.3's `dec_calc_subpel_params`). | 652 | // grid (spec 7.11.3.3's `dec_calc_subpel_params`). |
| 570 | let (v_wide, v_narrow) = v_kind.tables(); | 653 | let (v_wide, v_narrow) = v_kind.tables(); |
| 571 | - let v_filter = if block_h <= 4 { | 654 | + note_narrow_kern(block_w, block_h, kern_w, kern_h); |
| 655 | + let v_filter = if kern_h <= 4 { | ||
| 572 | &v_narrow[yfrac] | 656 | &v_narrow[yfrac] |
| 573 | } else { | 657 | } else { |
| 574 | &v_wide[yfrac] | 658 | &v_wide[yfrac] |
| @@ -585,6 +669,7 @@ pub fn predict_scaled( | |||
| 585 | y0, | 669 | y0, |
| 586 | x_scale_fp, | 670 | x_scale_fp, |
| 587 | block_w, | 671 | block_w, |
| 672 | + kern_w, | ||
| 588 | rows, | 673 | rows, |
| 589 | h_kind, | 674 | h_kind, |
| 590 | &mut intermediate, | 675 | &mut intermediate, |
| @@ -648,6 +733,31 @@ pub fn predict_compound_intermediate( | |||
| 648 | h_kind: InterpFilterKind, | 733 | h_kind: InterpFilterKind, |
| 649 | v_kind: InterpFilterKind, | 734 | v_kind: InterpFilterKind, |
| 650 | dst: &mut [i32], | 735 | dst: &mut [i32], |
| 736 | +) { | ||
| 737 | + predict_compound_intermediate_kern( | ||
| 738 | + reference, stride, true_width, true_height, x_q4, y_q4, x_scale_fp, | ||
| 739 | + block_w, block_h, block_w, block_h, h_kind, v_kind, dst, | ||
| 740 | + ); | ||
| 741 | +} | ||
| 742 | + | ||
| 743 | +/// [`predict_compound_intermediate`] with the 4-tap decision from the block's | ||
| 744 | +/// true dims (see [`predict_with_filters_kern`]). | ||
| 745 | +#[allow(clippy::too_many_arguments)] | ||
| 746 | +pub fn predict_compound_intermediate_kern( | ||
| 747 | + reference: &[u16], | ||
| 748 | + stride: usize, | ||
| 749 | + true_width: usize, | ||
| 750 | + true_height: usize, | ||
| 751 | + x_q4: i32, | ||
| 752 | + y_q4: i32, | ||
| 753 | + x_scale_fp: i64, | ||
| 754 | + block_w: usize, | ||
| 755 | + block_h: usize, | ||
| 756 | + kern_w: usize, | ||
| 757 | + kern_h: usize, | ||
| 758 | + h_kind: InterpFilterKind, | ||
| 759 | + v_kind: InterpFilterKind, | ||
| 760 | + dst: &mut [i32], | ||
| 651 | ) { | 761 | ) { |
| 652 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); | 762 | assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); |
| 653 | assert!(!reference.is_empty(), "a reference plane has samples"); | 763 | assert!(!reference.is_empty(), "a reference plane has samples"); |
| @@ -661,7 +771,8 @@ pub fn predict_compound_intermediate( | |||
| 661 | let yfrac = y_q4.rem_euclid(16) as usize; | 771 | let yfrac = y_q4.rem_euclid(16) as usize; |
| 662 | 772 | ||
| 663 | let (v_wide, v_narrow) = v_kind.tables(); | 773 | let (v_wide, v_narrow) = v_kind.tables(); |
| 664 | - let v_filter = if block_h <= 4 { | 774 | + note_narrow_kern(block_w, block_h, kern_w, kern_h); |
| 775 | + let v_filter = if kern_h <= 4 { | ||
| 665 | &v_narrow[yfrac] | 776 | &v_narrow[yfrac] |
| 666 | } else { | 777 | } else { |
| 667 | &v_wide[yfrac] | 778 | &v_wide[yfrac] |
| @@ -678,6 +789,7 @@ pub fn predict_compound_intermediate( | |||
| 678 | y0, | 789 | y0, |
| 679 | x_scale_fp, | 790 | x_scale_fp, |
| 680 | block_w, | 791 | block_w, |
| 792 | + kern_w, | ||
| 681 | rows, | 793 | rows, |
| 682 | h_kind, | 794 | h_kind, |
| 683 | &mut intermediate, | 795 | &mut intermediate, |
crates/ec-av1/src/stream.rsmodified+210 -3
| @@ -1125,6 +1125,15 @@ mod tests { | |||
| 1125 | "{NAME}: {width}x{height} {bit_depth}-bit cq {cq}: {luma_bad} of {frames} \ | 1125 | "{NAME}: {width}x{height} {bit_depth}-bit cq {cq}: {luma_bad} of {frames} \ |
| 1126 | frames differ from ffmpeg in LUMA (edge hits {hits:?})" | 1126 | frames differ from ffmpeg in LUMA (edge hits {hits:?})" |
| 1127 | ); | 1127 | ); |
| 1128 | + // merge J, after lane-rectchroma2: the chroma residue this | ||
| 1129 | + // gate used to tolerate WAS this decoder's -- the per-axis | ||
| 1130 | + // narrow-block MC kernel decision read side x side instead | ||
| 1131 | + // of the block's true dims. Full-plane now. | ||
| 1132 | + assert_eq!( | ||
| 1133 | + chroma_bad, 0, | ||
| 1134 | + "{NAME}: {width}x{height} {bit_depth}-bit cq {cq}: {chroma_bad} of \ | ||
| 1135 | + {frames} frames differ from ffmpeg in CHROMA (edge hits {hits:?})" | ||
| 1136 | + ); | ||
| 1128 | for (t, h) in totals.iter_mut().zip(hits) { | 1137 | for (t, h) in totals.iter_mut().zip(hits) { |
| 1129 | *t += h; | 1138 | *t += h; |
| 1130 | } | 1139 | } |
| @@ -1150,9 +1159,9 @@ mod tests { | |||
| 1150 | // rather than about this lane's code. | 1159 | // rather than about this lane's code. |
| 1151 | let (chits, cluma, cchroma) = inter_edge_strip_attempt(NAME, 192, 128, 8, 32, frames); | 1160 | let (chits, cluma, cchroma) = inter_edge_strip_attempt(NAME, 192, 128, 8, 32, frames); |
| 1152 | assert_eq!( | 1161 | assert_eq!( |
| 1153 | - (chits, cluma), | 1162 | + (chits, cluma, cchroma), |
| 1154 | - ([0usize; 6], 0usize), | 1163 | + ([0usize; 6], 0usize, 0usize), |
| 1155 | - "{NAME}: control 192x128 (no frame-edge node) must be luma-exact with no edge hits" | 1164 | + "{NAME}: control 192x128 (no frame-edge node) must be pixel-exact with no edge hits" |
| 1156 | ); | 1165 | ); |
| 1157 | eprintln!( | 1166 | eprintln!( |
| 1158 | "{NAME}: {compared} attempts luma-exact over {} sizes, edge hits \ | 1167 | "{NAME}: {compared} attempts luma-exact over {} sizes, edge hits \ |
| @@ -25214,4 +25223,202 @@ mod tests { | |||
| 25214 | // instead; this counter is reported, not gated. | 25223 | // instead; this counter is reported, not gated. |
| 25215 | eprintln!("{NAME}: {skip_split_tx_total} skipped 8x8 TX_4X4 leaves across compared attempts"); | 25224 | eprintln!("{NAME}: {skip_split_tx_total} skipped 8x8 TX_4X4 leaves across compared attempts"); |
| 25216 | } | 25225 | } |
| 25226 | + | ||
| 25227 | + /// lane-rectchroma2 r1, the defect this gate exists for: our inter path | ||
| 25228 | + /// predicts a RECTANGULAR block over its enclosing SQUARE buffer | ||
| 25229 | + /// (`side`x`side`, `chroma_side`x`chroma_side` -- see | ||
| 25230 | + /// [`crate::decode`]'s `write_w`/`write_h` corner-cut), and | ||
| 25231 | + /// [`crate::mc::predict_with_filters`] took libaom's narrow-block 4-tap | ||
| 25232 | + /// decision from that buffer's dimensions. libaom | ||
| 25233 | + /// (`av1_get_interp_filter_params_with_block_size`, called per axis from | ||
| 25234 | + /// `inter_predictor` with `w` then `h`) takes it from the PREDICTION | ||
| 25235 | + /// block's own dimensions, so an 8x16 / 16x8 inter block -- whose chroma | ||
| 25236 | + /// is 4x8 / 8x4 -- must use the 4-tap kernel on the short axis. Luma is | ||
| 25237 | + /// never <= 4 wide here, which is exactly why every such stream decoded | ||
| 25238 | + /// LUMA EXACT and differed by +-1 on scattered chroma samples of those | ||
| 25239 | + /// blocks (lane-interedge r1's 192x128 control, a size with no frame-edge | ||
| 25240 | + /// node at all). | ||
| 25241 | + /// | ||
| 25242 | + /// Full-plane (Y+U+V) compare of EVERY decode-order frame | ||
| 25243 | + /// (`--lag-in-frames=0`), both orientations (192x128 and its transposed | ||
| 25244 | + /// twin, so the 4x8 and 8x4 chroma shapes both fire -- class | ||
| 25245 | + /// `scan-weights-cross-axis`), 8 AND 10 bit (his films are yuv420p10le), | ||
| 25246 | + /// cq 20/32/45, CDEF and loop restoration left ON. The counter is reset | ||
| 25247 | + /// per attempt and read only on an attempt that decoded and compared | ||
| 25248 | + /// (class `counter-from-refused-stream`); it counts predictions whose | ||
| 25249 | + /// kernel choice DIFFERS from what the square buffer would have given, so | ||
| 25250 | + /// a zero means the recipe lost the shape this gate pins. | ||
| 25251 | + #[test] | ||
| 25252 | + fn a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact() { | ||
| 25253 | + const NAME: &str = | ||
| 25254 | + "a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact"; | ||
| 25255 | + let _gate_lock = lock_gate_counters(); | ||
| 25256 | + if !have_ffmpeg() { | ||
| 25257 | + eprintln!("SKIP {NAME}: no ffmpeg"); | ||
| 25258 | + return; | ||
| 25259 | + } | ||
| 25260 | + if !have_aomenc() { | ||
| 25261 | + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); | ||
| 25262 | + return; | ||
| 25263 | + } | ||
| 25264 | + const FRAMES: usize = 6; | ||
| 25265 | + let mut compared = 0usize; | ||
| 25266 | + let mut narrow_by_depth = [0usize; 2]; | ||
| 25267 | + let mut narrow_by_shape = [0usize; 2]; | ||
| 25268 | + for (si, (width, height)) in [(192usize, 128usize), (128usize, 192usize)] | ||
| 25269 | + .into_iter() | ||
| 25270 | + .enumerate() | ||
| 25271 | + { | ||
| 25272 | + for (di, depth) in [8usize, 10].into_iter().enumerate() { | ||
| 25273 | + let pix = if depth == 10 { "yuv420p10le" } else { "yuv420p" }; | ||
| 25274 | + let y4m = Command::new("ffmpeg") | ||
| 25275 | + .args([ | ||
| 25276 | + "-v", "error", "-f", "lavfi", "-i", | ||
| 25277 | + &format!("mandelbrot=size={width}x{height}:rate=25"), | ||
| 25278 | + "-pix_fmt", pix, "-strict", "-1", "-vframes", &FRAMES.to_string(), | ||
| 25279 | + "-f", "yuv4mpegpipe", "-", | ||
| 25280 | + ]) | ||
| 25281 | + .stdin(Stdio::null()) | ||
| 25282 | + .stdout(Stdio::piped()) | ||
| 25283 | + .stderr(Stdio::piped()) | ||
| 25284 | + .output() | ||
| 25285 | + .expect("ffmpeg failed to run"); | ||
| 25286 | + assert!( | ||
| 25287 | + y4m.status.success(), | ||
| 25288 | + "{NAME}: ffmpeg fixture ({width}x{height}, depth={depth}): {}", | ||
| 25289 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 25290 | + ); | ||
| 25291 | + for cq in [20usize, 32, 45] { | ||
| 25292 | + let encode = || { | ||
| 25293 | + let mut child = Command::new(aomenc_path()) | ||
| 25294 | + .args([ | ||
| 25295 | + "--codec=av1", "--passes=1", "--end-usage=q", | ||
| 25296 | + &format!("--cq-level={cq}"), | ||
| 25297 | + "--cpu-used=4", "--threads=1", "--row-mt=0", | ||
| 25298 | + "--kf-max-dist=9999", &format!("--limit={FRAMES}"), | ||
| 25299 | + "--lag-in-frames=0", | ||
| 25300 | + &format!("--bit-depth={depth}"), | ||
| 25301 | + &format!("--input-bit-depth={depth}"), | ||
| 25302 | + // Rect partitions ON is the whole point; every | ||
| 25303 | + // other tool below is another lane's open gap | ||
| 25304 | + // that would refuse before a pixel compare. | ||
| 25305 | + "--enable-rect-partitions=1", "--enable-ab-partitions=0", | ||
| 25306 | + "--enable-1to4-partitions=0", "--min-partition-size=8", | ||
| 25307 | + "--max-partition-size=64", "--enable-palette=0", | ||
| 25308 | + "--enable-intrabc=0", "--enable-warped-motion=0", | ||
| 25309 | + "--enable-obmc=0", "--enable-masked-comp=0", | ||
| 25310 | + "--enable-interintra-comp=0", "--enable-onesided-comp=0", | ||
| 25311 | + "--enable-interintra-wedge=0", "--enable-smooth-interintra=0", | ||
| 25312 | + "--enable-ref-frame-mvs=0", "--enable-angle-delta=0", | ||
| 25313 | + "--enable-cfl-intra=0", "--enable-directional-intra=0", | ||
| 25314 | + "--enable-smooth-intra=0", "--enable-paeth-intra=0", | ||
| 25315 | + "--enable-filter-intra=0", "--enable-tx-size-search=0", | ||
| 25316 | + "--obu", "-o", "-", "-", | ||
| 25317 | + ]) | ||
| 25318 | + .stdin(Stdio::piped()) | ||
| 25319 | + .stdout(Stdio::piped()) | ||
| 25320 | + .stderr(Stdio::piped()) | ||
| 25321 | + .spawn() | ||
| 25322 | + .expect("aomenc failed to start"); | ||
| 25323 | + child | ||
| 25324 | + .stdin | ||
| 25325 | + .take() | ||
| 25326 | + .expect("aomenc stdin") | ||
| 25327 | + .write_all(&y4m.stdout) | ||
| 25328 | + .expect("writing y4m to aomenc"); | ||
| 25329 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 25330 | + assert!( | ||
| 25331 | + out.status.success(), | ||
| 25332 | + "aomenc refused the fixture ({width}x{height}, depth={depth}, \ | ||
| 25333 | + cq={cq}): {}", | ||
| 25334 | + String::from_utf8_lossy(&out.stderr) | ||
| 25335 | + ); | ||
| 25336 | + out.stdout | ||
| 25337 | + }; | ||
| 25338 | + let stream = encode(); | ||
| 25339 | + assert_eq!( | ||
| 25340 | + stream, | ||
| 25341 | + encode(), | ||
| 25342 | + "{NAME}: aomenc output is not reproducible ({width}x{height}, \ | ||
| 25343 | + depth={depth}, cq={cq})" | ||
| 25344 | + ); | ||
| 25345 | + crate::mc::reset_rect_narrow_kern_hits(); | ||
| 25346 | + let frames = match decode_stream(&stream) { | ||
| 25347 | + Ok(frames) => frames, | ||
| 25348 | + Err(e) => { | ||
| 25349 | + let msg = e.to_string(); | ||
| 25350 | + assert!( | ||
| 25351 | + msg.contains("unsupported"), | ||
| 25352 | + "{NAME}: decode failed ({width}x{height}, depth={depth}, \ | ||
| 25353 | + cq={cq}): {msg}" | ||
| 25354 | + ); | ||
| 25355 | + eprintln!( | ||
| 25356 | + "{NAME}: {width}x{height} depth={depth} cq={cq} arm refused \ | ||
| 25357 | + (not compared): {msg}" | ||
| 25358 | + ); | ||
| 25359 | + continue; | ||
| 25360 | + } | ||
| 25361 | + }; | ||
| 25362 | + let narrow = crate::mc::rect_narrow_kern_hits(); | ||
| 25363 | + let ffmpeg_frames = if depth == 10 { | ||
| 25364 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) | ||
| 25365 | + } else { | ||
| 25366 | + ffmpeg_decode_sequence(&stream, width, height, frames.len()) | ||
| 25367 | + }; | ||
| 25368 | + assert_eq!( | ||
| 25369 | + ffmpeg_frames.len(), | ||
| 25370 | + frames.len(), | ||
| 25371 | + "{NAME}: ffmpeg frame count ({width}x{height}, depth={depth}, cq={cq})" | ||
| 25372 | + ); | ||
| 25373 | + assert_eq!( | ||
| 25374 | + frames.len(), | ||
| 25375 | + FRAMES, | ||
| 25376 | + "{NAME}: not every coded frame was decoded ({width}x{height}, \ | ||
| 25377 | + depth={depth}, cq={cq})" | ||
| 25378 | + ); | ||
| 25379 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 25380 | + assert_eq!( | ||
| 25381 | + got.y, want.y, | ||
| 25382 | + "{NAME} frame {i} luma vs ffmpeg ({width}x{height}, depth={depth}, \ | ||
| 25383 | + cq={cq}, narrow-kernel hits {narrow})" | ||
| 25384 | + ); | ||
| 25385 | + assert_eq!( | ||
| 25386 | + got.u, want.u, | ||
| 25387 | + "{NAME} frame {i} U vs ffmpeg ({width}x{height}, depth={depth}, \ | ||
| 25388 | + cq={cq}, narrow-kernel hits {narrow})" | ||
| 25389 | + ); | ||
| 25390 | + assert_eq!( | ||
| 25391 | + got.v, want.v, | ||
| 25392 | + "{NAME} frame {i} V vs ffmpeg ({width}x{height}, depth={depth}, \ | ||
| 25393 | + cq={cq}, narrow-kernel hits {narrow})" | ||
| 25394 | + ); | ||
| 25395 | + } | ||
| 25396 | + compared += 1; | ||
| 25397 | + narrow_by_depth[di] += narrow; | ||
| 25398 | + narrow_by_shape[si] += narrow; | ||
| 25399 | + eprintln!( | ||
| 25400 | + "{NAME}: {width}x{height} depth={depth} cq={cq} {} frames full-plane \ | ||
| 25401 | + exact, narrow-kernel hits {narrow}", | ||
| 25402 | + frames.len() | ||
| 25403 | + ); | ||
| 25404 | + } | ||
| 25405 | + } | ||
| 25406 | + } | ||
| 25407 | + assert_eq!( | ||
| 25408 | + compared, 12, | ||
| 25409 | + "{NAME}: only {compared} of 12 arms were pixel-compared -- a refusal makes this \ | ||
| 25410 | + gate vacuous" | ||
| 25411 | + ); | ||
| 25412 | + assert!( | ||
| 25413 | + narrow_by_depth[0] > 0 && narrow_by_depth[1] > 0, | ||
| 25414 | + "{NAME}: no rect-chroma narrow kernel fired at 8-bit ({}) or 10-bit ({}) -- the \ | ||
| 25415 | + recipe lost the shape this gate pins", | ||
| 25416 | + narrow_by_depth[0], narrow_by_depth[1] | ||
| 25417 | + ); | ||
| 25418 | + assert!( | ||
| 25419 | + narrow_by_shape[0] > 0 && narrow_by_shape[1] > 0, | ||
| 25420 | + "{NAME}: the shape fired in only one orientation (192x128 {}, 128x192 {})", | ||
| 25421 | + narrow_by_shape[0], narrow_by_shape[1] | ||
| 25422 | + ); | ||
| 25423 | + } | ||
| 25217 | } | 25424 | } |
lanes/rectchroma2-r1.report.mdadded+87 -0
| @@ -0,0 +1,87 @@ | |||
| 1 | +# lane-rectchroma2 r1 -- rect INTER blocks predicted chroma with the WIDE kernel | ||
| 2 | + | ||
| 3 | +## Premise re-measured first | ||
| 4 | + | ||
| 5 | +lane-interedge r1's residue reproduced on this tree (main 2c04819 + lane-cdef + lane-golomb | ||
| 6 | +173b793): mandelbrot 192x128 (the CONTROL size -- zero frame-edge nodes), 6 frames, | ||
| 7 | +`--enable-rect-partitions=1 --min-partition-size=8 --enable-tx-size-search=0 --lag-in-frames=0`, | ||
| 8 | +intra tools off, cq 20/32/45, 8- and 10-bit: **luma exact, chroma differs on frames 2..5 in all | ||
| 9 | +six arms**. Streams hashed twice, identical. | ||
| 10 | + | ||
| 11 | +EVIDENCE: `~/.cache/rectchroma2-tmp/c192-128-{8,10}-{20,32,45}.obu` (each sha256 twice, equal) | ||
| 12 | +| `decode_probe` with `EC_AV1_FINAL_DUMP` vs `ffmpeg -pix_fmt yuv420p[10le]`, every decode-order | ||
| 13 | +frame, per plane | e.g. cq32 8-bit: `[(2,'chroma (0,32)..(1,40) n=17'), (4,...), (5,...)]`, luma | ||
| 14 | +exact in all 6 arms. | ||
| 15 | + | ||
| 16 | +## Stage bisect | ||
| 17 | + | ||
| 18 | +Regenerated the same recipe with `--loopfilter-control=0` (deblock off; CDEF/LR already off in | ||
| 19 | +that recipe): **the chroma mismatch survives unchanged** -> not a filter-stage defect, so the | ||
| 20 | +charter's suspect (d) (chroma deblock levels / uv tx grid for rect inter blocks) is exonerated. | ||
| 21 | +The surviving diffs are +-1 on scattered samples inside 4-wide-by-8-tall and 8-wide-by-4-tall | ||
| 22 | +CHROMA regions (e.g. frame 4: chroma x32..35 rows 26..39, and x48..55 rows 16..19) -- i.e. the | ||
| 23 | +chroma halves of 8x16 and 16x8 LUMA blocks. | ||
| 24 | + | ||
| 25 | +EVIDENCE: `~/.cache/rectchroma2-tmp/n192-128-8-32.obu` (`gen_nolf.sh`) | decode + full-plane | ||
| 26 | +compare | `MISMATCH [(2,'chroma ... n=15'), (4,...n=36), (5,...n=45)]`, luma exact. | ||
| 27 | + | ||
| 28 | +## Root cause (charter suspect (a), confirmed) | ||
| 29 | + | ||
| 30 | +`crates/ec-av1/src/decode.rs` `decode_inter_block` predicts a RECTANGULAR block over its | ||
| 31 | +enclosing SQUARE buffer (`side`x`side`, chroma `chroma_side`x`chroma_side`; `write_w`/`write_h` | ||
| 32 | +govern only the pixel write -- the lane-partitions r1 corner-cut). The 4-tap decision lived | ||
| 33 | +inside `mc::predict_with_filters` and read that BUFFER's dimensions. libaom | ||
| 34 | +`av1_get_interp_filter_params_with_block_size` (reconinter.h, called per axis from | ||
| 35 | +`inter_predictor` with `w` then `h`) reads the PREDICTION BLOCK's dimensions: `w <= 4` -> | ||
| 36 | +`av1_interp_4tap[0]` (SHARP and REGULAR both) / `[1]` (SMOOTH). Luma is never <= 4 wide on this | ||
| 37 | +path, so only chroma of a rect block (4x8 / 8x4 / 4x16 ...) was affected -- exactly the | ||
| 38 | +"luma exact, chroma wrong" signature. | ||
| 39 | + | ||
| 40 | +- `crates/ec-av1/src/mc.rs`: `predict_with_filters_kern` / `predict_scaled_kern` / | ||
| 41 | + `predict_compound_intermediate_kern` -- the existing three entry points keep their signatures | ||
| 42 | + and delegate with `kern = block dims`; `horizontal_scaled_pass` takes `kern_w`. | ||
| 43 | +- `crates/ec-av1/src/mc.rs`: `RECT_NARROW_KERN_HITS` + `rect_narrow_kern_hits()` / | ||
| 44 | + `reset_rect_narrow_kern_hits()` / `note_narrow_kern()` -- counts predictions whose kernel | ||
| 45 | + choice DIFFERS from what the square buffer would have given (one bump per prediction). | ||
| 46 | +- `crates/ec-av1/src/decode.rs`: the 12 prediction calls inside `decode_inter_block` now pass | ||
| 47 | + `write_w/write_h` (luma) and `write_chroma_w/write_chroma_h` (chroma) as the kernel dims. | ||
| 48 | + | ||
| 49 | +Class sweep: every other `mc::predict*` call site passes a buffer whose dims ARE the block's | ||
| 50 | +(`obmc_neighbour_pred` takes the neighbour's true w/h; the 8x8 leaf path is square, chroma 4x4; | ||
| 51 | +the CfL bilinear path is unrelated), so no sibling site needed the change. | ||
| 52 | + | ||
| 53 | +## Gate (GREEN) | ||
| 54 | + | ||
| 55 | +``` | ||
| 56 | +CARGO_TARGET_DIR=$HOME/.cache/cargo-target-rectchroma2 EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 \ | ||
| 57 | +PATH="$HOME/.cache/aom-oracle/build:$PATH" cargo test -p ec-av1 --lib narrow_kernel -- --nocapture | ||
| 58 | +``` | ||
| 59 | +`a_real_aomenc_rect_inter_block_predicts_chroma_with_the_narrow_kernel_pixel_exact` | ||
| 60 | +(`crates/ec-av1/src/stream.rs`): real aomenc, mandelbrot 192x128 AND its transposed twin | ||
| 61 | +128x192 (so 4x8 and 8x4 chroma both fire), 8- and 10-bit, cq 20/32/45, 6 frames, | ||
| 62 | +`--lag-in-frames=0` so decode order == display order and EVERY frame is compared on Y, U AND V | ||
| 63 | +against ffmpeg. CDEF and loop restoration left ON. Streams encoded twice and asserted equal. | ||
| 64 | +`compared == 12` is a hard assert (a refusal fails the gate, never SKIPs), and the narrow-kernel | ||
| 65 | +counter -- reset per attempt, read only on compared attempts -- must be nonzero at BOTH depths | ||
| 66 | +and in BOTH orientations. | ||
| 67 | + | ||
| 68 | +EVIDENCE: gate stdout | 12 aomenc -> ec-av1 -> ffmpeg attempts, 6 frames each, all three planes | ||
| 69 | +| `12/12 arms 6 frames full-plane exact; narrow-kernel hits 24/4/16 (192x128 8-bit cq20/32/45), | ||
| 70 | +18/26/36 (10-bit), 42/20/18 and 36/36/34 for 128x192` -- 0 refusals, 0 out-of-scope mismatches. | ||
| 71 | + | ||
| 72 | +Before the fix the SAME recipe mismatched chroma in every arm (the premise sweep above), so the | ||
| 73 | +gate is not vacuous. | ||
| 74 | + | ||
| 75 | +## Refusals | ||
| 76 | +None lifted (no inventory string covers this defect -- it was a wrong-pixels defect behind an | ||
| 77 | +already-accepted path). `refusal_inventory.rs`/`gate_coverage.rs` untouched by intent, both green | ||
| 78 | +in the suite below. | ||
| 79 | + | ||
| 80 | +## Suite | ||
| 81 | +`$HOME/.cache/rectchroma2-suite-r1.log`: **388 passed, 0 failed, 35 ignored** (1668s), including the new gate. Baseline before this round on the same tree shape was 387/0/35 (this round adds one gate). | ||
| 82 | + | ||
| 83 | +## Residue | ||
| 84 | +- accepted: `predict_scaled_kern` (scaled reference / superres) got the same fix by construction | ||
| 85 | + but is not exercised by this gate -- superres rect-chroma has no aomenc recipe on this lane. | ||
| 86 | +- deferred(lane-interedge merge): that lane's frame-edge gate can now become a FULL-PLANE arm; | ||
| 87 | + its luma-only compare was a workaround for exactly this defect. | ||