wip(av1): lane-tiles r5 inter per-tile loop at the 75-turn cap (orchestrator commit, mid-edit, does not compile)
Browse files at this commitf79846b66adee2a5fd65dd720e433d20df3da769Parent: 10b55451 changed file +52 -5
- crates/ec-av1/src/decode.rs +52 -5
crates/ec-av1/src/decode.rsmodified+52 -5
| @@ -2844,6 +2844,13 @@ struct PlaneBuf { | ||
| 2844 | 2844 | /// right/bottom reach bound is still open, tracked in the report. |
| 2845 | 2845 | tile_x0: usize, |
| 2846 | 2846 | tile_y0: usize, |
| 2847 | + /// lane-tiles r5: this plane's own tile's right/bottom pixel bound | |
| 2848 | + /// (exclusive) -- a non-last tile column/row's own reach must stop at | |
| 2849 | + /// its own SB-aligned tile boundary. `width`/`height` (this plane's | |
| 2850 | + /// full padded extent) for the single-tile/last-tile case, matching the | |
| 2851 | + /// old unclipped behaviour exactly. | |
| 2852 | + tile_x1: usize, | |
| 2853 | + tile_y1: usize, | |
| 2847 | 2854 | } |
| 2848 | 2855 | |
| 2849 | 2856 | /// One entry per `MV_REFERENCE_FRAME` (index 0/1 unused -- `NONE`/ |
| @@ -2859,9 +2866,11 @@ impl PlaneBuf { | ||
| 2859 | 2866 | /// [`Self::tile_y0`]) before that tile's own superblock walk. `x0`/`y0` |
| 2860 | 2867 | /// are already in this plane's own units (luma pixels for `y`, chroma |
| 2861 | 2868 | /// pixels — halved — for `u`/`v`). |
| 2862 | - fn set_tile_origin(&mut self, x0: usize, y0: usize) { | |
| 2869 | + fn set_tile_origin(&mut self, x0: usize, y0: usize, x1: usize, y1: usize) { | |
| 2863 | 2870 | self.tile_x0 = x0; |
| 2864 | 2871 | self.tile_y0 = y0; |
| 2872 | + self.tile_x1 = x1; | |
| 2873 | + self.tile_y1 = y1; | |
| 2865 | 2874 | } |
| 2866 | 2875 | |
| 2867 | 2876 | fn edges( |
| @@ -2877,14 +2886,16 @@ impl PlaneBuf { | ||
| 2877 | 2886 | } else { |
| 2878 | 2887 | own_across |
| 2879 | 2888 | } |
| 2880 | - .min(self.width); | |
| 2889 | + .min(self.width) | |
| 2890 | + .min(self.tile_x1); | |
| 2881 | 2891 | let own_down = y + side.min(self.true_height.saturating_sub(y)); |
| 2882 | 2892 | let down = if reach.below_left { |
| 2883 | 2893 | own_down + side.min(self.true_height.saturating_sub(own_down)) |
| 2884 | 2894 | } else { |
| 2885 | 2895 | own_down |
| 2886 | 2896 | } |
| 2887 | - .min(self.height); | |
| 2897 | + .min(self.height) | |
| 2898 | + .min(self.tile_y1); | |
| 2888 | 2899 | let above = (y > self.tile_y0 && across > x) |
| 2889 | 2900 | .then(|| self.data[(y - 1) * self.width + x..][..across - x].to_vec()); |
| 2890 | 2901 | let left = (x > self.tile_x0 && down > y).then(|| { |
| @@ -2914,14 +2925,16 @@ impl PlaneBuf { | ||
| 2914 | 2925 | } else { |
| 2915 | 2926 | own_across |
| 2916 | 2927 | } |
| 2917 | - .min(self.width); | |
| 2928 | + .min(self.width) | |
| 2929 | + .min(self.tile_x1); | |
| 2918 | 2930 | let own_down = y + bh.min(self.true_height.saturating_sub(y)); |
| 2919 | 2931 | let down = if reach.below_left { |
| 2920 | 2932 | own_down + bh.min(self.true_height.saturating_sub(own_down)) |
| 2921 | 2933 | } else { |
| 2922 | 2934 | own_down |
| 2923 | 2935 | } |
| 2924 | - .min(self.height); | |
| 2936 | + .min(self.height) | |
| 2937 | + .min(self.tile_y1); | |
| 2925 | 2938 | let above = (y > self.tile_y0 && across > x) |
| 2926 | 2939 | .then(|| self.data[(y - 1) * self.width + x..][..across - x].to_vec()); |
| 2927 | 2940 | let left = (x > self.tile_x0 && down > y).then(|| { |
| @@ -4818,6 +4831,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 4818 | 4831 | true_height, |
| 4819 | 4832 | tile_x0: 0, |
| 4820 | 4833 | tile_y0: 0, |
| 4834 | + tile_x1: width, | |
| 4835 | + tile_y1: height, | |
| 4821 | 4836 | }; |
| 4822 | 4837 | let mut u = PlaneBuf { |
| 4823 | 4838 | data: vec![0u8; width * height / 4], |
| @@ -4827,6 +4842,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 4827 | 4842 | true_height: true_height / 2, |
| 4828 | 4843 | tile_x0: 0, |
| 4829 | 4844 | tile_y0: 0, |
| 4845 | + tile_x1: width / 2, | |
| 4846 | + tile_y1: height / 2, | |
| 4830 | 4847 | }; |
| 4831 | 4848 | let mut v = PlaneBuf { |
| 4832 | 4849 | data: vec![0u8; width * height / 4], |
| @@ -4836,6 +4853,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 4836 | 4853 | true_height: true_height / 2, |
| 4837 | 4854 | tile_x0: 0, |
| 4838 | 4855 | tile_y0: 0, |
| 4856 | + tile_x1: width / 2, | |
| 4857 | + tile_y1: height / 2, | |
| 4839 | 4858 | }; |
| 4840 | 4859 | |
| 4841 | 4860 | let scan32 = default_scan(TX32); |
| @@ -9584,6 +9603,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9584 | 9603 | true_height: reference.height, |
| 9585 | 9604 | tile_x0: 0, |
| 9586 | 9605 | tile_y0: 0, |
| 9606 | + tile_x1: reference.width, | |
| 9607 | + tile_y1: reference.height, | |
| 9587 | 9608 | }; |
| 9588 | 9609 | let ref_u = PlaneBuf { |
| 9589 | 9610 | data: reference.u.clone(), |
| @@ -9593,6 +9614,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9593 | 9614 | true_height: reference.height / 2, |
| 9594 | 9615 | tile_x0: 0, |
| 9595 | 9616 | tile_y0: 0, |
| 9617 | + tile_x1: reference.width / 2, | |
| 9618 | + tile_y1: reference.height / 2, | |
| 9596 | 9619 | }; |
| 9597 | 9620 | let ref_v = PlaneBuf { |
| 9598 | 9621 | data: reference.v.clone(), |
| @@ -9602,6 +9625,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9602 | 9625 | true_height: reference.height / 2, |
| 9603 | 9626 | tile_x0: 0, |
| 9604 | 9627 | tile_y0: 0, |
| 9628 | + tile_x1: reference.width / 2, | |
| 9629 | + tile_y1: reference.height / 2, | |
| 9605 | 9630 | }; |
| 9606 | 9631 | // Every non-`LAST_FRAME` reference this frame header's own `ref_frame_idx` |
| 9607 | 9632 | // names a live DPB slot for (lane-av1refs: generalised from the old |
| @@ -9623,6 +9648,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9623 | 9648 | true_height: g.height, |
| 9624 | 9649 | tile_x0: 0, |
| 9625 | 9650 | tile_y0: 0, |
| 9651 | + tile_x1: g.width, | |
| 9652 | + tile_y1: g.height, | |
| 9626 | 9653 | }, |
| 9627 | 9654 | PlaneBuf { |
| 9628 | 9655 | data: g.u.clone(), |
| @@ -9632,6 +9659,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9632 | 9659 | true_height: g.height / 2, |
| 9633 | 9660 | tile_x0: 0, |
| 9634 | 9661 | tile_y0: 0, |
| 9662 | + tile_x1: g.width / 2, | |
| 9663 | + tile_y1: g.height / 2, | |
| 9635 | 9664 | }, |
| 9636 | 9665 | PlaneBuf { |
| 9637 | 9666 | data: g.v.clone(), |
| @@ -9641,6 +9670,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9641 | 9670 | true_height: g.height / 2, |
| 9642 | 9671 | tile_x0: 0, |
| 9643 | 9672 | tile_y0: 0, |
| 9673 | + tile_x1: g.width / 2, | |
| 9674 | + tile_y1: g.height / 2, | |
| 9644 | 9675 | }, |
| 9645 | 9676 | ) |
| 9646 | 9677 | }) |
| @@ -9656,6 +9687,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9656 | 9687 | true_height, |
| 9657 | 9688 | tile_x0: 0, |
| 9658 | 9689 | tile_y0: 0, |
| 9690 | + tile_x1: width, | |
| 9691 | + tile_y1: height, | |
| 9659 | 9692 | }; |
| 9660 | 9693 | let mut u = PlaneBuf { |
| 9661 | 9694 | data: vec![0u8; width * height / 4], |
| @@ -9665,6 +9698,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9665 | 9698 | true_height: true_height / 2, |
| 9666 | 9699 | tile_x0: 0, |
| 9667 | 9700 | tile_y0: 0, |
| 9701 | + tile_x1: width / 2, | |
| 9702 | + tile_y1: height / 2, | |
| 9668 | 9703 | }; |
| 9669 | 9704 | let mut v = PlaneBuf { |
| 9670 | 9705 | data: vec![0u8; width * height / 4], |
| @@ -9674,6 +9709,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 9674 | 9709 | true_height: true_height / 2, |
| 9675 | 9710 | tile_x0: 0, |
| 9676 | 9711 | tile_y0: 0, |
| 9712 | + tile_x1: width / 2, | |
| 9713 | + tile_y1: height / 2, | |
| 9677 | 9714 | }; |
| 9678 | 9715 | |
| 9679 | 9716 | let scan32 = default_scan(TX32); |
| @@ -11618,6 +11655,8 @@ mod tests { | ||
| 11618 | 11655 | true_height: height / scale, |
| 11619 | 11656 | tile_x0: 0, |
| 11620 | 11657 | tile_y0: 0, |
| 11658 | + tile_x1: width / scale, | |
| 11659 | + tile_y1: height / scale, | |
| 11621 | 11660 | }; |
| 11622 | 11661 | let ref_y = PlaneBuf { |
| 11623 | 11662 | data: ref_pattern.clone(), |
| @@ -11627,6 +11666,8 @@ mod tests { | ||
| 11627 | 11666 | true_height: height, |
| 11628 | 11667 | tile_x0: 0, |
| 11629 | 11668 | tile_y0: 0, |
| 11669 | + tile_x1: width, | |
| 11670 | + tile_y1: height, | |
| 11630 | 11671 | }; |
| 11631 | 11672 | let ref_u = ref_plane(2); |
| 11632 | 11673 | let ref_v = ref_plane(2); |
| @@ -11639,6 +11680,8 @@ mod tests { | ||
| 11639 | 11680 | true_height: height, |
| 11640 | 11681 | tile_x0: 0, |
| 11641 | 11682 | tile_y0: 0, |
| 11683 | + tile_x1: width, | |
| 11684 | + tile_y1: height, | |
| 11642 | 11685 | }; |
| 11643 | 11686 | let mut u = PlaneBuf { |
| 11644 | 11687 | data: vec![0u8; (width / 2) * (height / 2)], |
| @@ -11648,6 +11691,8 @@ mod tests { | ||
| 11648 | 11691 | true_height: height / 2, |
| 11649 | 11692 | tile_x0: 0, |
| 11650 | 11693 | tile_y0: 0, |
| 11694 | + tile_x1: width / 2, | |
| 11695 | + tile_y1: height / 2, | |
| 11651 | 11696 | }; |
| 11652 | 11697 | let mut v = PlaneBuf { |
| 11653 | 11698 | data: vec![0u8; (width / 2) * (height / 2)], |
| @@ -11657,6 +11702,8 @@ mod tests { | ||
| 11657 | 11702 | true_height: height / 2, |
| 11658 | 11703 | tile_x0: 0, |
| 11659 | 11704 | tile_y0: 0, |
| 11705 | + tile_x1: width / 2, | |
| 11706 | + tile_y1: height / 2, | |
| 11660 | 11707 | }; |
| 11661 | 11708 | |
| 11662 | 11709 | let mut cdfs = Cdfs::new(q_ctx_of(100)); |