Code a 128x128 block's chroma as four TX_32X32 units and predict every skipped block per transform unit
Browse files at this commit260d4d59b2e0a8fe961a52a9f4d615b9cd4d78f4Parent: 480317d- feat
- code a 128x128 block's chroma as four TX_32X32 units and predict every skipped block per transform unit
3 changed files +201 -113
- crates/ec-av1/src/decode.rs +181 -102
- crates/ec-av1/src/refusal_inventory.rs +0 -1
- crates/ec-av1/src/stream.rs +20 -10
crates/ec-av1/src/decode.rsmodified+181 -102
| @@ -4761,6 +4761,32 @@ impl Neighbours { | |||
| 4761 | self.record_mi_luma_rect(at_mi, tx_px, tx_px, grid); | 4761 | self.record_mi_luma_rect(at_mi, tx_px, tx_px, grid); |
| 4762 | } | 4762 | } |
| 4763 | 4763 | ||
| 4764 | + /// [`Self::record_mi_luma`] for ONE CHROMA transform unit of a block whose | ||
| 4765 | + /// uv plane block is several units (lane-sb128b r2: a 128x128 block's | ||
| 4766 | + /// 64x64 uv plane block is four TX_32X32 units, `av1_get_max_uv_txsize`). | ||
| 4767 | + /// `w_px`/`h_px` are the unit's extent in LUMA pixels -- the chroma | ||
| 4768 | + /// coefficient-context arrays are indexed by luma mi, the convention | ||
| 4769 | + /// [`Self::record_split_luma_rect_mi`] already writes them in, frame-edge | ||
| 4770 | + /// clamp included. | ||
| 4771 | + fn record_mi_chroma( | ||
| 4772 | + &mut self, | ||
| 4773 | + (mi_r, mi_c): (usize, usize), | ||
| 4774 | + w_px: usize, | ||
| 4775 | + h_px: usize, | ||
| 4776 | + plane: usize, | ||
| 4777 | + grid: &[i32], | ||
| 4778 | + ) { | ||
| 4779 | + let round_up_even = |n: usize| n.div_ceil(2) * 2; | ||
| 4780 | + let (bound_h, bound_w) = (round_up_even(self.mi_rows), round_up_even(self.mi_cols)); | ||
| 4781 | + let state = neighbour_state(grid); | ||
| 4782 | + for cell in 0..(h_px / MI).min(bound_h.saturating_sub(mi_r)) { | ||
| 4783 | + self.left[mi_r + cell][plane] = state; | ||
| 4784 | + } | ||
| 4785 | + for cell in 0..(w_px / MI).min(bound_w.saturating_sub(mi_c)) { | ||
| 4786 | + self.above[mi_c + cell][plane] = state; | ||
| 4787 | + } | ||
| 4788 | + } | ||
| 4789 | + | ||
| 4764 | /// [`Self::record_mi_luma`] for a RECTANGULAR transform unit (lane-rectsplitx | 4790 | /// [`Self::record_mi_luma`] for a RECTANGULAR transform unit (lane-rectsplitx |
| 4765 | /// r1): the above context spans the unit's width, the left context its | 4791 | /// r1): the above context spans the unit's width, the left context its |
| 4766 | /// height, which for a square unit is the same loop it always was. | 4792 | /// height, which for a square unit is the same loop it always was. |
| @@ -8560,49 +8586,87 @@ fn decode_block( | |||
| 8560 | if skip { | 8586 | if skip { |
| 8561 | // A skipped block codes no residual syntax at all (spec 5.11.34): | 8587 | // A skipped block codes no residual syntax at all (spec 5.11.34): |
| 8562 | // straight prediction, on every plane. | 8588 | // straight prediction, on every plane. |
| 8563 | - y.reconstruct( | 8589 | + // Intra prediction is per TRANSFORM unit even with nothing coded |
| 8564 | - px, | 8590 | + // (libaom `predict_and_reconstruct_intra_block` runs inside the |
| 8565 | - py, | 8591 | + // transform-block loop), so a block whose transform is smaller than |
| 8566 | - side, | 8592 | + // itself predicts unit by unit here too. `n_axis`/`cn == 1` is the |
| 8567 | - mode, | 8593 | + // whole-block call this always made, unchanged; at 128 both are |
| 8568 | - angle_delta_y, | 8594 | + // forced >1 (`max_txsize_rect_lookup[BLOCK_128X128]` is TX_64X64 and |
| 8569 | - reach, | 8595 | + // its uv transform TX_32X32), lane-sb128b r2. |
| 8570 | - &vec![0i32; side * side], | 8596 | + let n_axis = side / logical_tx; |
| 8571 | - None, | 8597 | + for tu_row in 0..n_axis { |
| 8572 | - filter_intra, | 8598 | + for tu_col in 0..n_axis { |
| 8573 | - smooth_neighbor, | 8599 | + let (tu_px, tu_py) = (px + tu_col * logical_tx, py + tu_row * logical_tx); |
| 8574 | - ); | 8600 | + let tu_r = if n_axis == 1 { |
| 8575 | - let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); | 8601 | + reach |
| 8576 | - if let Some((ub, _)) = &palette_uv_bufs { | 8602 | + } else { |
| 8577 | - set_palette_pred(ub.clone()); | 8603 | + tu_reach( |
| 8604 | + side, side, | ||
| 8605 | + tu_col * logical_tx, tu_row * logical_tx, logical_tx, | ||
| 8606 | + reach, px, py, y.width, y.height, | ||
| 8607 | + ) | ||
| 8608 | + }; | ||
| 8609 | + y.reconstruct( | ||
| 8610 | + tu_px, | ||
| 8611 | + tu_py, | ||
| 8612 | + logical_tx, | ||
| 8613 | + mode, | ||
| 8614 | + angle_delta_y, | ||
| 8615 | + tu_r, | ||
| 8616 | + &vec![0i32; logical_tx * logical_tx], | ||
| 8617 | + None, | ||
| 8618 | + filter_intra, | ||
| 8619 | + smooth_neighbor, | ||
| 8620 | + ); | ||
| 8621 | + } | ||
| 8578 | } | 8622 | } |
| 8579 | - u.reconstruct( | 8623 | + let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 8580 | - cpx, | 8624 | + let cn = (chroma_side / chroma_tx).max(1); |
| 8581 | - cpy, | 8625 | + for cu_row in 0..cn { |
| 8582 | - chroma_side, | 8626 | + for cu_col in 0..cn { |
| 8583 | - uv_predict_mode, | 8627 | + let luma_span = chroma_tx * 2; |
| 8584 | - angle_delta_uv, | 8628 | + let cu_r = if cn == 1 { |
| 8585 | - reach, | 8629 | + reach |
| 8586 | - &vec![0i32; chroma_side * chroma_side], | 8630 | + } else { |
| 8587 | - alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | 8631 | + tu_reach( |
| 8588 | - None, | 8632 | + side, side, |
| 8589 | - smooth_neighbor_uv, | 8633 | + cu_col * luma_span, cu_row * luma_span, luma_span, |
| 8590 | - ); | 8634 | + reach, px, py, y.width, y.height, |
| 8591 | - if let Some((_, vb)) = &palette_uv_bufs { | 8635 | + ) |
| 8592 | - set_palette_pred(vb.clone()); | 8636 | + }; |
| 8637 | + let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx); | ||
| 8638 | + if let Some((ub, _)) = &palette_uv_bufs { | ||
| 8639 | + set_palette_pred(ub.clone()); | ||
| 8640 | + } | ||
| 8641 | + u.reconstruct( | ||
| 8642 | + cu_x, | ||
| 8643 | + cu_y, | ||
| 8644 | + chroma_tx, | ||
| 8645 | + uv_predict_mode, | ||
| 8646 | + angle_delta_uv, | ||
| 8647 | + cu_r, | ||
| 8648 | + &vec![0i32; chroma_tx * chroma_tx], | ||
| 8649 | + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | ||
| 8650 | + None, | ||
| 8651 | + smooth_neighbor_uv, | ||
| 8652 | + ); | ||
| 8653 | + if let Some((_, vb)) = &palette_uv_bufs { | ||
| 8654 | + set_palette_pred(vb.clone()); | ||
| 8655 | + } | ||
| 8656 | + v.reconstruct( | ||
| 8657 | + cu_x, | ||
| 8658 | + cu_y, | ||
| 8659 | + chroma_tx, | ||
| 8660 | + uv_predict_mode, | ||
| 8661 | + angle_delta_uv, | ||
| 8662 | + cu_r, | ||
| 8663 | + &vec![0i32; chroma_tx * chroma_tx], | ||
| 8664 | + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | ||
| 8665 | + None, | ||
| 8666 | + smooth_neighbor_uv, | ||
| 8667 | + ); | ||
| 8668 | + } | ||
| 8593 | } | 8669 | } |
| 8594 | - v.reconstruct( | ||
| 8595 | - cpx, | ||
| 8596 | - cpy, | ||
| 8597 | - chroma_side, | ||
| 8598 | - uv_predict_mode, | ||
| 8599 | - angle_delta_uv, | ||
| 8600 | - reach, | ||
| 8601 | - &vec![0i32; chroma_side * chroma_side], | ||
| 8602 | - alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | ||
| 8603 | - None, | ||
| 8604 | - smooth_neighbor_uv, | ||
| 8605 | - ); | ||
| 8606 | let luma_grid = vec![0i32; side * side]; | 8670 | let luma_grid = vec![0i32; side * side]; |
| 8607 | let u_grid = vec![0i32; chroma_side * chroma_side]; | 8671 | let u_grid = vec![0i32; chroma_side * chroma_side]; |
| 8608 | let v_grid = vec![0i32; chroma_side * chroma_side]; | 8672 | let v_grid = vec![0i32; chroma_side * chroma_side]; |
| @@ -8784,58 +8848,72 @@ fn decode_block( | |||
| 8784 | } | 8848 | } |
| 8785 | } | 8849 | } |
| 8786 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); | 8850 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 8787 | - let chroma_around = neighbours.around(at, side); | 8851 | + // The block's uv plane block is `chroma_side` across but its uv |
| 8788 | - if let Some((ub, _)) = &palette_uv_bufs { | 8852 | + // transform is `chroma_tx` (`av1_get_max_uv_txsize` = |
| 8789 | - set_palette_pred(ub.clone()); | 8853 | + // `av1_get_adjusted_tx_size(max_txsize_rect_lookup[uv_plane_bsize])`): |
| 8854 | + // identical at every size up to 64x64, but a 128x128 block's 64x64 uv | ||
| 8855 | + // plane block adjusts TX_64X64 down to TX_32X32, so each plane is | ||
| 8856 | + // FOUR units (lane-sb128b r2). `cn == 1` is byte-for-byte the single | ||
| 8857 | + // whole-plane read this always did. | ||
| 8858 | + let cn = (chroma_side / chroma_tx).max(1); | ||
| 8859 | + let mut last_grids = [Vec::new(), Vec::new()]; | ||
| 8860 | + let mut units: Vec<((usize, usize), usize, Vec<i32>, Vec<i32>)> = Vec::new(); | ||
| 8861 | + for cu_row in 0..cn { | ||
| 8862 | + for cu_col in 0..cn { | ||
| 8863 | + // The chroma context arrays are indexed in LUMA mi, so this | ||
| 8864 | + // unit's anchor is its own luma quadrant: `chroma_tx` chroma | ||
| 8865 | + // pixels span `2 * chroma_tx` luma ones. | ||
| 8866 | + let luma_span = chroma_tx * 2; | ||
| 8867 | + let cu_mi = ( | ||
| 8868 | + mi_r + cu_row * (luma_span / MI), | ||
| 8869 | + mi_c + cu_col * (luma_span / MI), | ||
| 8870 | + ); | ||
| 8871 | + let cu_around = neighbours.around_mi(cu_mi, luma_span); | ||
| 8872 | + let cu_reach = if cn == 1 { | ||
| 8873 | + reach | ||
| 8874 | + } else { | ||
| 8875 | + tu_reach( | ||
| 8876 | + side, side, | ||
| 8877 | + cu_col * luma_span, cu_row * luma_span, luma_span, | ||
| 8878 | + reach, px, py, y.width, y.height, | ||
| 8879 | + ) | ||
| 8880 | + }; | ||
| 8881 | + let (cu_x, cu_y) = (cpx + cu_col * chroma_tx, cpy + cu_row * chroma_tx); | ||
| 8882 | + if let Some((ub, _)) = &palette_uv_bufs { | ||
| 8883 | + set_palette_pred(ub.clone()); | ||
| 8884 | + } | ||
| 8885 | + let u_grid = read_plane( | ||
| 8886 | + dec, cdfs, chroma_set, scans.1, 1, cu_around[1], mode, | ||
| 8887 | + uv_predict_mode, angle_delta_uv, cu_reach, u, cu_x, cu_y, | ||
| 8888 | + chroma_tx, chroma_tx, base_q_idx, | ||
| 8889 | + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | ||
| 8890 | + None, None, smooth_neighbor_uv, | ||
| 8891 | + )?; | ||
| 8892 | + if let Some((_, vb)) = &palette_uv_bufs { | ||
| 8893 | + set_palette_pred(vb.clone()); | ||
| 8894 | + } | ||
| 8895 | + let v_grid = read_plane( | ||
| 8896 | + dec, cdfs, chroma_set, scans.1, 2, cu_around[2], mode, | ||
| 8897 | + uv_predict_mode, angle_delta_uv, cu_reach, v, cu_x, cu_y, | ||
| 8898 | + chroma_tx, chroma_tx, base_q_idx, | ||
| 8899 | + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | ||
| 8900 | + None, None, smooth_neighbor_uv, | ||
| 8901 | + )?; | ||
| 8902 | + if cn > 1 { | ||
| 8903 | + CHROMA_SPLIT_TX_HITS.with(|c| c.set(c.get() + 1)); | ||
| 8904 | + units.push((cu_mi, luma_span, u_grid.clone(), v_grid.clone())); | ||
| 8905 | + } | ||
| 8906 | + last_grids = [u_grid, v_grid]; | ||
| 8907 | + } | ||
| 8790 | } | 8908 | } |
| 8791 | - let u_grid = read_plane( | 8909 | + // Mode/side bookkeeping plus, at `cn == 1`, the whole-plane chroma |
| 8792 | - dec, | 8910 | + // context write; at `cn > 1` the per-unit writes above are what the |
| 8793 | - cdfs, | 8911 | + // next block reads, so they run after this (last writer wins). |
| 8794 | - chroma_set, | 8912 | + neighbours.record_split_luma(at, side, mode, uv_predict_mode, [&last_grids[0], &last_grids[1]]); |
| 8795 | - scans.1, | 8913 | + for (cu_mi, luma_span, u_grid, v_grid) in &units { |
| 8796 | - 1, | 8914 | + neighbours.record_mi_chroma(*cu_mi, *luma_span, *luma_span, 1, u_grid); |
| 8797 | - chroma_around[1], | 8915 | + neighbours.record_mi_chroma(*cu_mi, *luma_span, *luma_span, 2, v_grid); |
| 8798 | - mode, | ||
| 8799 | - uv_predict_mode, | ||
| 8800 | - angle_delta_uv, | ||
| 8801 | - reach, | ||
| 8802 | - u, | ||
| 8803 | - cpx, | ||
| 8804 | - cpy, | ||
| 8805 | - chroma_side, | ||
| 8806 | - chroma_tx, | ||
| 8807 | - base_q_idx, | ||
| 8808 | - alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | ||
| 8809 | - None, | ||
| 8810 | - None, | ||
| 8811 | - smooth_neighbor_uv, | ||
| 8812 | - )?; | ||
| 8813 | - if let Some((_, vb)) = &palette_uv_bufs { | ||
| 8814 | - set_palette_pred(vb.clone()); | ||
| 8815 | } | 8916 | } |
| 8816 | - let v_grid = read_plane( | ||
| 8817 | - dec, | ||
| 8818 | - cdfs, | ||
| 8819 | - chroma_set, | ||
| 8820 | - scans.1, | ||
| 8821 | - 2, | ||
| 8822 | - chroma_around[2], | ||
| 8823 | - mode, | ||
| 8824 | - uv_predict_mode, | ||
| 8825 | - angle_delta_uv, | ||
| 8826 | - reach, | ||
| 8827 | - v, | ||
| 8828 | - cpx, | ||
| 8829 | - cpy, | ||
| 8830 | - chroma_side, | ||
| 8831 | - chroma_tx, | ||
| 8832 | - base_q_idx, | ||
| 8833 | - alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | ||
| 8834 | - None, | ||
| 8835 | - None, | ||
| 8836 | - smooth_neighbor_uv, | ||
| 8837 | - )?; | ||
| 8838 | - neighbours.record_split_luma(at, side, mode, uv_predict_mode, [&u_grid, &v_grid]); | ||
| 8839 | } | 8917 | } |
| 8840 | // Unconditional, `size == 0` for a non-palette block: clears any stale | 8918 | // Unconditional, `size == 0` for a non-palette block: clears any stale |
| 8841 | // neighbour palette state the same way [`Neighbours::record`] always | 8919 | // neighbour palette state the same way [`Neighbours::record`] always |
| @@ -11779,6 +11857,18 @@ pub(crate) fn part128_none_hits() -> usize { | |||
| 11779 | PART128_NONE_HITS.with(std::cell::Cell::get) | 11857 | PART128_NONE_HITS.with(std::cell::Cell::get) |
| 11780 | } | 11858 | } |
| 11781 | 11859 | ||
| 11860 | +thread_local! { | ||
| 11861 | + /// How many CHROMA transform units were coded inside a block whose uv | ||
| 11862 | + /// plane block is more than one unit (lane-sb128b r2 -- only a 128x128 | ||
| 11863 | + /// block, four per plane). | ||
| 11864 | + pub(crate) static CHROMA_SPLIT_TX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 11865 | +} | ||
| 11866 | + | ||
| 11867 | +/// [`CHROMA_SPLIT_TX_HITS`], for a gate's own before/after delta. | ||
| 11868 | +pub(crate) fn chroma_split_tx_hits() -> usize { | ||
| 11869 | + CHROMA_SPLIT_TX_HITS.with(std::cell::Cell::get) | ||
| 11870 | +} | ||
| 11871 | + | ||
| 11782 | fn read_sb128_root( | 11872 | fn read_sb128_root( |
| 11783 | dec: &mut SymbolDecoder, | 11873 | dec: &mut SymbolDecoder, |
| 11784 | cdfs: &mut Cdfs, | 11874 | cdfs: &mut Cdfs, |
| @@ -11839,17 +11929,6 @@ fn read_sb128_root( | |||
| 11839 | PART128_SPLIT_HITS.with(|c| c.set(c.get() + 1)); | 11929 | PART128_SPLIT_HITS.with(|c| c.set(c.get() + 1)); |
| 11840 | } else { | 11930 | } else { |
| 11841 | PART128_NONE_HITS.with(|c| c.set(c.get() + 1)); | 11931 | PART128_NONE_HITS.with(|c| c.set(c.get() + 1)); |
| 11842 | - // lane-sb128b r1 RESIDUAL: the luma half of a 128x128 `PARTITION_NONE` | ||
| 11843 | - // block is coded below (four TX_64X64 units), but its CHROMA is not: | ||
| 11844 | - // `av1_get_max_uv_txsize` runs `av1_get_adjusted_tx_size` over the | ||
| 11845 | - // 64x64 uv plane block, so the uv transform is TX_32X32 and each | ||
| 11846 | - // plane is FOUR units -- `decode_block` codes exactly one whole-plane | ||
| 11847 | - // chroma unit, which desyncs the tile at the first such block (gate | ||
| 11848 | - // `a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact`, | ||
| 11849 | - // 384x384 cq63: decoded, small deltas over 94% of the luma plane). | ||
| 11850 | - return Err(unsupported( | ||
| 11851 | - "a 128x128 PARTITION_NONE block's chroma (its 64x64 uv plane block is four TX_32X32 units, and this decoder codes one whole-plane chroma unit per block)", | ||
| 11852 | - )); | ||
| 11853 | } | 11932 | } |
| 11854 | Ok(part128) | 11933 | Ok(part128) |
| 11855 | } | 11934 | } |
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
| @@ -45,7 +45,6 @@ const REFUSALS: &[&str] = &[ | |||
| 45 | "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", | 45 | "a superblock-level partition value outside PARTITION_NONE..PARTITION_VERT_4", |
| 46 | "a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are decoded at the 128 root)", | 46 | "a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are decoded at the 128 root)", |
| 47 | "a 128x128 superblock PARTITION_NONE root on an inter frame (only the key-frame path codes a whole 128x128 block)", | 47 | "a 128x128 superblock PARTITION_NONE root on an inter frame (only the key-frame path codes a whole 128x128 block)", |
| 48 | - "a 128x128 PARTITION_NONE block's chroma (its 64x64 uv plane block is four TX_32X32 units, and this decoder codes one whole-plane chroma unit per block)", | ||
| 49 | "intrabc under a 128x128 superblock (libaom's av1_is_dv_valid derives the block-vector delay from sb_size, which this decoder hardcodes to 64)", | 48 | "intrabc under a 128x128 superblock (libaom's av1_is_dv_valid derives the block-vector delay from sb_size, which this decoder hardcodes to 64)", |
| 50 | "an inter frame under a 128x128 superblock (this decoder's inter tile path recurses a 64x64 superblock root only)", | 49 | "an inter frame under a 128x128 superblock (this decoder's inter tile path recurses a 64x64 superblock root only)", |
| 51 | "a palette block on a HORZ/VERT intra strip below 16x16 (reconstruction not ported)", | 50 | "a palette block on a HORZ/VERT intra strip below 16x16 (reconstruction not ported)", |
crates/ec-av1/src/stream.rsmodified+20 -10
| @@ -17677,17 +17677,14 @@ mod tests { | |||
| 17677 | 17677 | ||
| 17678 | /// lane-sb128b r1 gate: a real `aomenc --sb-size=128` KEY frame whose 128 | 17678 | /// lane-sb128b r1 gate: a real `aomenc --sb-size=128` KEY frame whose 128 |
| 17679 | /// roots resolve to `PARTITION_NONE` -- one whole 128x128 intra block, | 17679 | /// roots resolve to `PARTITION_NONE` -- one whole 128x128 intra block, |
| 17680 | - /// four TX_64X64 luma transform units and ONE TX_64X64 chroma unit per | 17680 | + /// four TX_64X64 luma transform units and FOUR TX_32X32 chroma units per |
| 17681 | - /// plane (`av1_get_max_uv_txsize(BLOCK_128X128)` over its 64x64 uv plane | 17681 | + /// plane (`av1_get_max_uv_txsize(BLOCK_128X128)` is |
| 17682 | - /// block), a coefficient set (`TxbSet::Chroma64`) no block at 64 or below | 17682 | + /// `av1_get_adjusted_tx_size` of its 64x64 uv plane block's TX_64X64, so |
| 17683 | - /// can reach. The r1 gate above pins `--max-partition-size=64`, which | 17683 | + /// TX_32X32) -- lane-sb128b r2's `chroma_split_tx_hits` asserts them. The r1 gate above pins `--max-partition-size=64`, which |
| 17684 | /// makes every 128 root a forced SPLIT and leaves this arm unexercised. | 17684 | /// makes every 128 root a forced SPLIT and leaves this arm unexercised. |
| 17685 | /// Smooth gradients at a high `--cq-level` are what make the RD search | 17685 | /// Smooth gradients at a high `--cq-level` are what make the RD search |
| 17686 | /// keep a whole 128x128 block; `part128_none_hits` HARD-asserts it did. | 17686 | /// keep a whole 128x128 block; `part128_none_hits` HARD-asserts it did. |
| 17687 | #[test] | 17687 | #[test] |
| 17688 | - #[ignore = "lane-sb128b r1 reproducer: the 128 NONE luma path decodes, its \ | ||
| 17689 | - chroma (four TX_32X32 units, not one) is not coded yet, so the \ | ||
| 17690 | - product path refuses the arm by name"] | ||
| 17691 | fn a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact() { | 17688 | fn a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact() { |
| 17692 | const NAME: &str = | 17689 | const NAME: &str = |
| 17693 | "a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact"; | 17690 | "a_real_aomenc_key_frame_with_a_128x128_none_partition_decodes_pixel_exact"; |
| @@ -17794,9 +17791,22 @@ mod tests { | |||
| 17794 | }; | 17791 | }; |
| 17795 | assert_eq!(frames.len(), 1); | 17792 | assert_eq!(frames.len(), 1); |
| 17796 | for (i, (got, want)) in frames.iter().zip(&want).enumerate() { | 17793 | for (i, (got, want)) in frames.iter().zip(&want).enumerate() { |
| 17797 | - assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (seed {seed})"); | 17794 | + for (name, a, b, w) in [ |
| 17798 | - assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})"); | 17795 | + ("Y", &got.y, &want.y, width), |
| 17799 | - assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})"); | 17796 | + ("U", &got.u, &want.u, width / 2), |
| 17797 | + ("V", &got.v, &want.v, width / 2), | ||
| 17798 | + ] { | ||
| 17799 | + let n = a.iter().zip(b.iter()).filter(|(x, y)| x != y).count(); | ||
| 17800 | + let first = a.iter().zip(b.iter()).position(|(x, y)| x != y); | ||
| 17801 | + assert_eq!( | ||
| 17802 | + n, 0, | ||
| 17803 | + "{NAME} frame {i} {name} vs ffmpeg (seed {seed}): {n} differ, first row {} col {} ours {:?} ffmpeg {:?}", | ||
| 17804 | + first.unwrap_or(0) / w, | ||
| 17805 | + first.unwrap_or(0) % w, | ||
| 17806 | + first.map(|k| a[k]), | ||
| 17807 | + first.map(|k| b[k]), | ||
| 17808 | + ); | ||
| 17809 | + } | ||
| 17800 | } | 17810 | } |
| 17801 | let hits = crate::decode::part128_none_hits() - before; | 17811 | let hits = crate::decode::part128_none_hits() - before; |
| 17802 | eprintln!("seed {seed} cq {cq} {width}x{height}: part128_none_hits +{hits}"); | 17812 | eprintln!("seed {seed} cq {cq} {width}x{height}: part128_none_hits +{hits}"); |