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