wip(av1): lane-tiles r2 per-tile decode in progress, committed at the 75-turn cap
Browse files at this commit6416aca4f7ffcb1e66405b55d2b64021bfa65947Parent: 34716e82 changed files +139 -23
- crates/ec-av1/src/decode.rs +137 -22
- crates/ec-av1/src/stream.rs +2 -1
crates/ec-av1/src/decode.rsmodified+137 -22
| @@ -21,7 +21,7 @@ | |||
| 21 | //! too). Anything outside that refuses with [`Error::unsupported`] rather than | 21 | //! too). Anything outside that refuses with [`Error::unsupported`] rather than |
| 22 | //! silently miscoding. | 22 | //! silently miscoding. |
| 23 | 23 | ||
| 24 | -use ec_av1_syntax::{CdefParams, LoopFilterParams}; | 24 | +use ec_av1_syntax::{CdefParams, LoopFilterParams, TileInfo}; |
| 25 | use ec_core::{Error, Result}; | 25 | use ec_core::{Error, Result}; |
| 26 | 26 | ||
| 27 | use crate::cdf; | 27 | use crate::cdf; |
| @@ -66,6 +66,20 @@ 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 tiles [`decode_key_frame_tile_with_cdfs`] has actually decoded a | ||
| 70 | +// full superblock walk over, across every call on the current thread -- | ||
| 71 | +// lane-tiles r2's own gate-blind-to-feature guard: a gate over a | ||
| 72 | +// multi-tile stream must prove more than one tile actually fired, not just | ||
| 73 | +// that the stream carried tile_info.cols > 1. | ||
| 74 | +thread_local! { | ||
| 75 | + static TILE_HITS: std::cell::Cell<usize> = | ||
| 76 | + const { std::cell::Cell::new(0) }; | ||
| 77 | +} | ||
| 78 | +/// Current value of [`TILE_HITS`]. | ||
| 79 | +pub(crate) fn tile_hits() -> usize { | ||
| 80 | + TILE_HITS.with(|c| c.get()) | ||
| 81 | +} | ||
| 82 | + | ||
| 69 | // How many 4-pixel deblocking edge groups [`edge_params`] has actually | 83 | // How many 4-pixel deblocking edge groups [`edge_params`] has actually |
| 70 | // selected for filtering, across every call on the current thread -- the same | 84 | // selected for filtering, across every call on the current thread -- the same |
| 71 | // before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream | 85 | // before/after counter pattern as [`FILTER_INTRA_HITS`], proving a stream |
| @@ -2661,6 +2675,16 @@ struct PlaneBuf { | |||
| 2661 | /// real decoder's edge or reach reads. | 2675 | /// real decoder's edge or reach reads. |
| 2662 | true_width: usize, | 2676 | true_width: usize, |
| 2663 | true_height: usize, | 2677 | true_height: usize, |
| 2678 | + /// This plane's own tile's top-left pixel origin (spec: intra prediction | ||
| 2679 | + /// never reaches across a tile boundary even though an earlier-decoded | ||
| 2680 | + /// tile's real pixels sit right there in the shared buffer) — set via | ||
| 2681 | + /// [`Self::set_tile_origin`] before each tile's own superblock walk, | ||
| 2682 | + /// `0` for the single-tile case. lane-tiles r2: only the left/top bound | ||
| 2683 | + /// is threaded (the two-tile column-split stage 1 fixture's tile always | ||
| 2684 | + /// ends at the frame's own right/bottom edge); a non-last tile's own | ||
| 2685 | + /// right/bottom reach bound is still open, tracked in the report. | ||
| 2686 | + tile_x0: usize, | ||
| 2687 | + tile_y0: usize, | ||
| 2664 | } | 2688 | } |
| 2665 | 2689 | ||
| 2666 | /// One entry per `MV_REFERENCE_FRAME` (index 0/1 unused -- `NONE`/ | 2690 | /// One entry per `MV_REFERENCE_FRAME` (index 0/1 unused -- `NONE`/ |
| @@ -2672,6 +2696,15 @@ struct PlaneBuf { | |||
| 2672 | type RefSlots<'a> = [Option<(&'a PlaneBuf, &'a PlaneBuf, &'a PlaneBuf)>; 8]; | 2696 | type RefSlots<'a> = [Option<(&'a PlaneBuf, &'a PlaneBuf, &'a PlaneBuf)>; 8]; |
| 2673 | 2697 | ||
| 2674 | impl PlaneBuf { | 2698 | impl PlaneBuf { |
| 2699 | + /// Sets this plane's own tile pixel origin ([`Self::tile_x0`]/ | ||
| 2700 | + /// [`Self::tile_y0`]) before that tile's own superblock walk. `x0`/`y0` | ||
| 2701 | + /// are already in this plane's own units (luma pixels for `y`, chroma | ||
| 2702 | + /// pixels — halved — for `u`/`v`). | ||
| 2703 | + fn set_tile_origin(&mut self, x0: usize, y0: usize) { | ||
| 2704 | + self.tile_x0 = x0; | ||
| 2705 | + self.tile_y0 = y0; | ||
| 2706 | + } | ||
| 2707 | + | ||
| 2675 | fn edges( | 2708 | fn edges( |
| 2676 | &self, | 2709 | &self, |
| 2677 | x: usize, | 2710 | x: usize, |
| @@ -2693,14 +2726,15 @@ impl PlaneBuf { | |||
| 2693 | own_down | 2726 | own_down |
| 2694 | } | 2727 | } |
| 2695 | .min(self.height); | 2728 | .min(self.height); |
| 2696 | - let above = (y > 0 && across > x) | 2729 | + let above = (y > self.tile_y0 && across > x) |
| 2697 | .then(|| self.data[(y - 1) * self.width + x..][..across - x].to_vec()); | 2730 | .then(|| self.data[(y - 1) * self.width + x..][..across - x].to_vec()); |
| 2698 | - let left = (x > 0 && down > y).then(|| { | 2731 | + let left = (x > self.tile_x0 && down > y).then(|| { |
| 2699 | (y..down) | 2732 | (y..down) |
| 2700 | .map(|row| self.data[row * self.width + x - 1]) | 2733 | .map(|row| self.data[row * self.width + x - 1]) |
| 2701 | .collect::<Vec<_>>() | 2734 | .collect::<Vec<_>>() |
| 2702 | }); | 2735 | }); |
| 2703 | - let corner = (x > 0 && y > 0).then(|| self.data[(y - 1) * self.width + x - 1]); | 2736 | + let corner = |
| 2737 | + (x > self.tile_x0 && y > self.tile_y0).then(|| self.data[(y - 1) * self.width + x - 1]); | ||
| 2704 | (above, left, corner) | 2738 | (above, left, corner) |
| 2705 | } | 2739 | } |
| 2706 | 2740 | ||
| @@ -2729,14 +2763,15 @@ impl PlaneBuf { | |||
| 2729 | own_down | 2763 | own_down |
| 2730 | } | 2764 | } |
| 2731 | .min(self.height); | 2765 | .min(self.height); |
| 2732 | - let above = (y > 0 && across > x) | 2766 | + let above = (y > self.tile_y0 && across > x) |
| 2733 | .then(|| self.data[(y - 1) * self.width + x..][..across - x].to_vec()); | 2767 | .then(|| self.data[(y - 1) * self.width + x..][..across - x].to_vec()); |
| 2734 | - let left = (x > 0 && down > y).then(|| { | 2768 | + let left = (x > self.tile_x0 && down > y).then(|| { |
| 2735 | (y..down) | 2769 | (y..down) |
| 2736 | .map(|row| self.data[row * self.width + x - 1]) | 2770 | .map(|row| self.data[row * self.width + x - 1]) |
| 2737 | .collect::<Vec<_>>() | 2771 | .collect::<Vec<_>>() |
| 2738 | }); | 2772 | }); |
| 2739 | - let corner = (x > 0 && y > 0).then(|| self.data[(y - 1) * self.width + x - 1]); | 2773 | + let corner = |
| 2774 | + (x > self.tile_x0 && y > self.tile_y0).then(|| self.data[(y - 1) * self.width + x - 1]); | ||
| 2740 | (above, left, corner) | 2775 | (above, left, corner) |
| 2741 | } | 2776 | } |
| 2742 | 2777 | ||
| @@ -4490,8 +4525,14 @@ pub fn decode_key_frame_tile( | |||
| 4490 | allow_screen_content_tools: bool, | 4525 | allow_screen_content_tools: bool, |
| 4491 | allow_intrabc: bool, | 4526 | allow_intrabc: bool, |
| 4492 | ) -> Result<Picture> { | 4527 | ) -> Result<Picture> { |
| 4528 | + let single_tile = TileInfo { | ||
| 4529 | + mi_col_starts: vec![0, mi_cols], | ||
| 4530 | + mi_row_starts: vec![0, mi_rows], | ||
| 4531 | + ..TileInfo::default() | ||
| 4532 | + }; | ||
| 4493 | decode_key_frame_tile_with_cdfs( | 4533 | decode_key_frame_tile_with_cdfs( |
| 4494 | - data, | 4534 | + &[data], |
| 4535 | + &single_tile, | ||
| 4495 | mi_cols, | 4536 | mi_cols, |
| 4496 | mi_rows, | 4537 | mi_rows, |
| 4497 | base_q_idx, | 4538 | base_q_idx, |
| @@ -4519,7 +4560,8 @@ pub fn decode_key_frame_tile( | |||
| 4519 | /// alongside the picture, for the caller to save into whichever reference | 4560 | /// alongside the picture, for the caller to save into whichever reference |
| 4520 | /// slots this frame's `refresh_frame_flags` names. | 4561 | /// slots this frame's `refresh_frame_flags` names. |
| 4521 | pub(crate) fn decode_key_frame_tile_with_cdfs( | 4562 | pub(crate) fn decode_key_frame_tile_with_cdfs( |
| 4522 | - data: &[u8], | 4563 | + tiles: &[&[u8]], |
| 4564 | + tile_info: &TileInfo, | ||
| 4523 | mi_cols: u32, | 4565 | mi_cols: u32, |
| 4524 | mi_rows: u32, | 4566 | mi_rows: u32, |
| 4525 | base_q_idx: u8, | 4567 | base_q_idx: u8, |
| @@ -4550,6 +4592,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4550 | height, | 4592 | height, |
| 4551 | true_width, | 4593 | true_width, |
| 4552 | true_height, | 4594 | true_height, |
| 4595 | + tile_x0: 0, | ||
| 4596 | + tile_y0: 0, | ||
| 4553 | }; | 4597 | }; |
| 4554 | let mut u = PlaneBuf { | 4598 | let mut u = PlaneBuf { |
| 4555 | data: vec![0u8; width * height / 4], | 4599 | data: vec![0u8; width * height / 4], |
| @@ -4557,6 +4601,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4557 | height: height / 2, | 4601 | height: height / 2, |
| 4558 | true_width: true_width / 2, | 4602 | true_width: true_width / 2, |
| 4559 | true_height: true_height / 2, | 4603 | true_height: true_height / 2, |
| 4604 | + tile_x0: 0, | ||
| 4605 | + tile_y0: 0, | ||
| 4560 | }; | 4606 | }; |
| 4561 | let mut v = PlaneBuf { | 4607 | let mut v = PlaneBuf { |
| 4562 | data: vec![0u8; width * height / 4], | 4608 | data: vec![0u8; width * height / 4], |
| @@ -4564,6 +4610,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4564 | height: height / 2, | 4610 | height: height / 2, |
| 4565 | true_width: true_width / 2, | 4611 | true_width: true_width / 2, |
| 4566 | true_height: true_height / 2, | 4612 | true_height: true_height / 2, |
| 4613 | + tile_x0: 0, | ||
| 4614 | + tile_y0: 0, | ||
| 4567 | }; | 4615 | }; |
| 4568 | 4616 | ||
| 4569 | let scan32 = default_scan(TX32); | 4617 | let scan32 = default_scan(TX32); |
| @@ -4571,15 +4619,8 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4571 | let scan8 = default_scan(TX8); | 4619 | let scan8 = default_scan(TX8); |
| 4572 | let scan4 = default_scan(TX4); | 4620 | let scan4 = default_scan(TX4); |
| 4573 | 4621 | ||
| 4574 | - let mut cdfs = initial_cdfs.unwrap_or_else(|| Cdfs::new(q_ctx_of(base_q_idx))); | 4622 | + let base_cdfs = initial_cdfs.unwrap_or_else(|| Cdfs::new(q_ctx_of(base_q_idx))); |
| 4575 | - if std::env::var_os("EC_AV1_TRACE").is_some() { | 4623 | + let mut result_cdfs = base_cdfs.clone(); |
| 4576 | - eprintln!( | ||
| 4577 | - "TRACE key_tile_bytes len={} first8={:02x?} base_q_idx={base_q_idx} mi_cols={mi_cols} mi_rows={mi_rows}", | ||
| 4578 | - data.len(), | ||
| 4579 | - &data[..data.len().min(8)] | ||
| 4580 | - ); | ||
| 4581 | - } | ||
| 4582 | - let mut dec = SymbolDecoder::new(data); | ||
| 4583 | let mut neighbours = Neighbours::new( | 4624 | let mut neighbours = Neighbours::new( |
| 4584 | cols32 as usize * 2, | 4625 | cols32 as usize * 2, |
| 4585 | rows32 as usize * 2, | 4626 | rows32 as usize * 2, |
| @@ -4587,9 +4628,50 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4587 | mi_rows as usize, | 4628 | mi_rows as usize, |
| 4588 | ); | 4629 | ); |
| 4589 | 4630 | ||
| 4590 | - for sb_r in 0..sb_rows { | 4631 | + // lane-tiles r2: each tile gets its own fresh `SymbolDecoder` over its |
| 4632 | + // own byte range and its own fresh copy of the frame's initial CDFs | ||
| 4633 | + // (spec 5.11.2 `decode_tile`'s `init_symbol`); only the tile named by | ||
| 4634 | + // `context_update_tile_id` has its end-of-tile adapted table kept as the | ||
| 4635 | + // frame's own output (spec `exit_symbol`) -- every other tile's | ||
| 4636 | + // adaptation is discarded, matching the refusal this replaces. | ||
| 4637 | + for (tile_idx, &tile_bytes) in tiles.iter().enumerate() { | ||
| 4638 | + let tile_num = tile_idx as u32; | ||
| 4639 | + let (trow, tcol) = (tile_num / tile_info.cols, tile_num % tile_info.cols); | ||
| 4640 | + let mi_row0 = tile_info.mi_row_starts[trow as usize]; | ||
| 4641 | + let mi_row1 = tile_info.mi_row_starts[trow as usize + 1]; | ||
| 4642 | + let mi_col0 = tile_info.mi_col_starts[tcol as usize]; | ||
| 4643 | + let mi_col1 = tile_info.mi_col_starts[tcol as usize + 1]; | ||
| 4644 | + // Tile boundaries are always superblock-aligned in mi units (spec | ||
| 4645 | + // 5.9.15's uniform/non-uniform derivation both only ever emit | ||
| 4646 | + // multiples of the superblock's own mi size), so plain division is | ||
| 4647 | + // exact here -- no rounding needed. | ||
| 4648 | + // `mi_row0`/`mi_col0` (this tile's own start, `0` or an interior | ||
| 4649 | + // tile boundary) are always superblock-aligned by spec 5.9.15; the | ||
| 4650 | + // frame's own true final edge (`mi_row_starts`/`mi_col_starts`' | ||
| 4651 | + // last entry) is not, so the upper bound needs `div_ceil` the same | ||
| 4652 | + // way the whole-frame `sb_rows`/`sb_cols` above does, to keep the | ||
| 4653 | + // trailing partial superblock row/column in scope. | ||
| 4654 | + let (sb_r0, sb_r1) = ((mi_row0 / SB_MI).min(sb_rows), mi_row1.div_ceil(SB_MI).min(sb_rows)); | ||
| 4655 | + let (sb_c0, sb_c1) = ((mi_col0 / SB_MI).min(sb_cols), mi_col1.div_ceil(SB_MI).min(sb_cols)); | ||
| 4656 | + | ||
| 4657 | + let mut cdfs = base_cdfs.clone(); | ||
| 4658 | + if std::env::var_os("EC_AV1_TRACE").is_some() { | ||
| 4659 | + eprintln!( | ||
| 4660 | + "TRACE key_tile_bytes tile={tile_num} len={} first8={:02x?} base_q_idx={base_q_idx} mi_cols={mi_cols} mi_rows={mi_rows}", | ||
| 4661 | + tile_bytes.len(), | ||
| 4662 | + &tile_bytes[..tile_bytes.len().min(8)] | ||
| 4663 | + ); | ||
| 4664 | + } | ||
| 4665 | + let mut dec = SymbolDecoder::new(tile_bytes); | ||
| 4666 | + neighbours.start_tile(mi_row0 as usize, mi_col0 as usize, mi_col1 as usize); | ||
| 4667 | + y.set_tile_origin(mi_col0 as usize * 4, mi_row0 as usize * 4); | ||
| 4668 | + u.set_tile_origin(mi_col0 as usize * 2, mi_row0 as usize * 2); | ||
| 4669 | + v.set_tile_origin(mi_col0 as usize * 2, mi_row0 as usize * 2); | ||
| 4670 | + TILE_HITS.with(|c| c.set(c.get() + 1)); | ||
| 4671 | + | ||
| 4672 | + for sb_r in sb_r0..sb_r1 { | ||
| 4591 | neighbours.start_row(); | 4673 | neighbours.start_row(); |
| 4592 | - for sb_c in 0..sb_cols { | 4674 | + for sb_c in sb_c0..sb_c1 { |
| 4593 | let at = (sb_r as usize * 4, sb_c as usize * 4); | 4675 | let at = (sb_r as usize * 4, sb_c as usize * 4); |
| 4594 | let ctx = neighbours.partition_ctx(at, SB); | 4676 | let ctx = neighbours.partition_ctx(at, SB); |
| 4595 | let (has_cols, has_rows) = ( | 4677 | let (has_cols, has_rows) = ( |
| @@ -4989,6 +5071,11 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 4989 | } | 5071 | } |
| 4990 | } | 5072 | } |
| 4991 | 5073 | ||
| 5074 | + if tile_num == tile_info.context_update_tile_id { | ||
| 5075 | + result_cdfs = cdfs; | ||
| 5076 | + } | ||
| 5077 | + } | ||
| 5078 | + | ||
| 4992 | // lane-comppin r4: pre-loop-filter decode-order dump, matching aomdec's | 5079 | // lane-comppin r4: pre-loop-filter decode-order dump, matching aomdec's |
| 4993 | // own EC_AV1_PREFILT_DUMP shape (decodeframe.c ~5451) -- diffs against | 5080 | // own EC_AV1_PREFILT_DUMP shape (decodeframe.c ~5451) -- diffs against |
| 4994 | // that isolate whether a decode-order frame's mismatch already exists | 5081 | // that isolate whether a decode-order frame's mismatch already exists |
| @@ -5018,7 +5105,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 5018 | u: u.data, | 5105 | u: u.data, |
| 5019 | v: v.data, | 5106 | v: v.data, |
| 5020 | }, | 5107 | }, |
| 5021 | - cdfs, | 5108 | + result_cdfs, |
| 5022 | )); | 5109 | )); |
| 5023 | } | 5110 | } |
| 5024 | let crop = |plane: &PlaneBuf, w: usize, h: usize| -> Vec<u8> { | 5111 | let crop = |plane: &PlaneBuf, w: usize, h: usize| -> Vec<u8> { |
| @@ -5036,7 +5123,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 5036 | u: crop(&u, fw / 2, fh / 2), | 5123 | u: crop(&u, fw / 2, fh / 2), |
| 5037 | v: crop(&v, fw / 2, fh / 2), | 5124 | v: crop(&v, fw / 2, fh / 2), |
| 5038 | }, | 5125 | }, |
| 5039 | - cdfs, | 5126 | + result_cdfs, |
| 5040 | )) | 5127 | )) |
| 5041 | } | 5128 | } |
| 5042 | 5129 | ||
| @@ -9220,6 +9307,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9220 | height: reference.height, | 9307 | height: reference.height, |
| 9221 | true_width: reference.width, | 9308 | true_width: reference.width, |
| 9222 | true_height: reference.height, | 9309 | true_height: reference.height, |
| 9310 | + tile_x0: 0, | ||
| 9311 | + tile_y0: 0, | ||
| 9223 | }; | 9312 | }; |
| 9224 | let ref_u = PlaneBuf { | 9313 | let ref_u = PlaneBuf { |
| 9225 | data: reference.u.clone(), | 9314 | data: reference.u.clone(), |
| @@ -9227,6 +9316,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9227 | height: reference.height / 2, | 9316 | height: reference.height / 2, |
| 9228 | true_width: reference.width / 2, | 9317 | true_width: reference.width / 2, |
| 9229 | true_height: reference.height / 2, | 9318 | true_height: reference.height / 2, |
| 9319 | + tile_x0: 0, | ||
| 9320 | + tile_y0: 0, | ||
| 9230 | }; | 9321 | }; |
| 9231 | let ref_v = PlaneBuf { | 9322 | let ref_v = PlaneBuf { |
| 9232 | data: reference.v.clone(), | 9323 | data: reference.v.clone(), |
| @@ -9234,6 +9325,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9234 | height: reference.height / 2, | 9325 | height: reference.height / 2, |
| 9235 | true_width: reference.width / 2, | 9326 | true_width: reference.width / 2, |
| 9236 | true_height: reference.height / 2, | 9327 | true_height: reference.height / 2, |
| 9328 | + tile_x0: 0, | ||
| 9329 | + tile_y0: 0, | ||
| 9237 | }; | 9330 | }; |
| 9238 | // Every non-`LAST_FRAME` reference this frame header's own `ref_frame_idx` | 9331 | // Every non-`LAST_FRAME` reference this frame header's own `ref_frame_idx` |
| 9239 | // names a live DPB slot for (lane-av1refs: generalised from the old | 9332 | // names a live DPB slot for (lane-av1refs: generalised from the old |
| @@ -9253,6 +9346,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9253 | height: g.height, | 9346 | height: g.height, |
| 9254 | true_width: g.width, | 9347 | true_width: g.width, |
| 9255 | true_height: g.height, | 9348 | true_height: g.height, |
| 9349 | + tile_x0: 0, | ||
| 9350 | + tile_y0: 0, | ||
| 9256 | }, | 9351 | }, |
| 9257 | PlaneBuf { | 9352 | PlaneBuf { |
| 9258 | data: g.u.clone(), | 9353 | data: g.u.clone(), |
| @@ -9260,6 +9355,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9260 | height: g.height / 2, | 9355 | height: g.height / 2, |
| 9261 | true_width: g.width / 2, | 9356 | true_width: g.width / 2, |
| 9262 | true_height: g.height / 2, | 9357 | true_height: g.height / 2, |
| 9358 | + tile_x0: 0, | ||
| 9359 | + tile_y0: 0, | ||
| 9263 | }, | 9360 | }, |
| 9264 | PlaneBuf { | 9361 | PlaneBuf { |
| 9265 | data: g.v.clone(), | 9362 | data: g.v.clone(), |
| @@ -9267,6 +9364,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9267 | height: g.height / 2, | 9364 | height: g.height / 2, |
| 9268 | true_width: g.width / 2, | 9365 | true_width: g.width / 2, |
| 9269 | true_height: g.height / 2, | 9366 | true_height: g.height / 2, |
| 9367 | + tile_x0: 0, | ||
| 9368 | + tile_y0: 0, | ||
| 9270 | }, | 9369 | }, |
| 9271 | ) | 9370 | ) |
| 9272 | }) | 9371 | }) |
| @@ -9280,6 +9379,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9280 | height, | 9379 | height, |
| 9281 | true_width, | 9380 | true_width, |
| 9282 | true_height, | 9381 | true_height, |
| 9382 | + tile_x0: 0, | ||
| 9383 | + tile_y0: 0, | ||
| 9283 | }; | 9384 | }; |
| 9284 | let mut u = PlaneBuf { | 9385 | let mut u = PlaneBuf { |
| 9285 | data: vec![0u8; width * height / 4], | 9386 | data: vec![0u8; width * height / 4], |
| @@ -9287,6 +9388,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9287 | height: height / 2, | 9388 | height: height / 2, |
| 9288 | true_width: true_width / 2, | 9389 | true_width: true_width / 2, |
| 9289 | true_height: true_height / 2, | 9390 | true_height: true_height / 2, |
| 9391 | + tile_x0: 0, | ||
| 9392 | + tile_y0: 0, | ||
| 9290 | }; | 9393 | }; |
| 9291 | let mut v = PlaneBuf { | 9394 | let mut v = PlaneBuf { |
| 9292 | data: vec![0u8; width * height / 4], | 9395 | data: vec![0u8; width * height / 4], |
| @@ -9294,6 +9397,8 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 9294 | height: height / 2, | 9397 | height: height / 2, |
| 9295 | true_width: true_width / 2, | 9398 | true_width: true_width / 2, |
| 9296 | true_height: true_height / 2, | 9399 | true_height: true_height / 2, |
| 9400 | + tile_x0: 0, | ||
| 9401 | + tile_y0: 0, | ||
| 9297 | }; | 9402 | }; |
| 9298 | 9403 | ||
| 9299 | let scan32 = default_scan(TX32); | 9404 | let scan32 = default_scan(TX32); |
| @@ -11180,6 +11285,8 @@ mod tests { | |||
| 11180 | height: height / scale, | 11285 | height: height / scale, |
| 11181 | true_width: width / scale, | 11286 | true_width: width / scale, |
| 11182 | true_height: height / scale, | 11287 | true_height: height / scale, |
| 11288 | + tile_x0: 0, | ||
| 11289 | + tile_y0: 0, | ||
| 11183 | }; | 11290 | }; |
| 11184 | let ref_y = PlaneBuf { | 11291 | let ref_y = PlaneBuf { |
| 11185 | data: ref_pattern.clone(), | 11292 | data: ref_pattern.clone(), |
| @@ -11187,6 +11294,8 @@ mod tests { | |||
| 11187 | height, | 11294 | height, |
| 11188 | true_width: width, | 11295 | true_width: width, |
| 11189 | true_height: height, | 11296 | true_height: height, |
| 11297 | + tile_x0: 0, | ||
| 11298 | + tile_y0: 0, | ||
| 11190 | }; | 11299 | }; |
| 11191 | let ref_u = ref_plane(2); | 11300 | let ref_u = ref_plane(2); |
| 11192 | let ref_v = ref_plane(2); | 11301 | let ref_v = ref_plane(2); |
| @@ -11197,6 +11306,8 @@ mod tests { | |||
| 11197 | height, | 11306 | height, |
| 11198 | true_width: width, | 11307 | true_width: width, |
| 11199 | true_height: height, | 11308 | true_height: height, |
| 11309 | + tile_x0: 0, | ||
| 11310 | + tile_y0: 0, | ||
| 11200 | }; | 11311 | }; |
| 11201 | let mut u = PlaneBuf { | 11312 | let mut u = PlaneBuf { |
| 11202 | data: vec![0u8; (width / 2) * (height / 2)], | 11313 | data: vec![0u8; (width / 2) * (height / 2)], |
| @@ -11204,6 +11315,8 @@ mod tests { | |||
| 11204 | height: height / 2, | 11315 | height: height / 2, |
| 11205 | true_width: width / 2, | 11316 | true_width: width / 2, |
| 11206 | true_height: height / 2, | 11317 | true_height: height / 2, |
| 11318 | + tile_x0: 0, | ||
| 11319 | + tile_y0: 0, | ||
| 11207 | }; | 11320 | }; |
| 11208 | let mut v = PlaneBuf { | 11321 | let mut v = PlaneBuf { |
| 11209 | data: vec![0u8; (width / 2) * (height / 2)], | 11322 | data: vec![0u8; (width / 2) * (height / 2)], |
| @@ -11211,6 +11324,8 @@ mod tests { | |||
| 11211 | height: height / 2, | 11324 | height: height / 2, |
| 11212 | true_width: width / 2, | 11325 | true_width: width / 2, |
| 11213 | true_height: height / 2, | 11326 | true_height: height / 2, |
| 11327 | + tile_x0: 0, | ||
| 11328 | + tile_y0: 0, | ||
| 11214 | }; | 11329 | }; |
| 11215 | 11330 | ||
| 11216 | let mut cdfs = Cdfs::new(q_ctx_of(100)); | 11331 | let mut cdfs = Cdfs::new(q_ctx_of(100)); |
crates/ec-av1/src/stream.rsmodified+2 -1
| @@ -360,7 +360,8 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | |||
| 360 | 360 | ||
| 361 | let (picture, end_cdfs, motion_field) = if header.frame_type == FrameType::Key { | 361 | let (picture, end_cdfs, motion_field) = if header.frame_type == FrameType::Key { |
| 362 | let (picture, end_cdfs) = decode_key_frame_tile_with_cdfs( | 362 | let (picture, end_cdfs) = decode_key_frame_tile_with_cdfs( |
| 363 | - tile_bytes, | 363 | + &[tile_bytes], |
| 364 | + &header.tile_info, | ||
| 364 | header.mi_cols, | 365 | header.mi_cols, |
| 365 | header.mi_rows, | 366 | header.mi_rows, |
| 366 | header.quantization.base_q_idx, | 367 | header.quantization.base_q_idx, |