From 547a1fa2212d92cd5ae0b22861760922e3ea5d6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sun, 30 Aug 2026 17:01:01 +0300 Subject: [PATCH] style(av1): drop two bindings the multi-tile merge left dead decode_stream's `tile`/`tile_bytes` were the single-tile path; every tile is decoded through `tile_bufs` now, so the first binding survived only to spell the 'frame OBU with no tile group' refusal -- said directly instead -- and the second was pure dead computation. A test's `obu_offset` went the same way. Refusal string unchanged, so the inventory is untouched. Suite 245 passed / 0 failed. --- crates/ec-av1/src/stream.rs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 810361fa..94285209 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -120,9 +120,14 @@ pub fn decode_stream(data: &[u8]) -> Result> { let ObuKind::Frame(header, tiles) = obu.kind else { continue; }; - let tile = tiles.first().ok_or_else(|| { - Error::unsupported("AV1 decode_stream", "a frame OBU with no tile group") - })?; + // Every tile is decoded below through `tile_bufs`; this only rejects a + // frame OBU that carries no tile group at all. + if tiles.is_empty() { + return Err(Error::unsupported( + "AV1 decode_stream", + "a frame OBU with no tile group", + )); + } // `read_cdef` (spec `decodeframe.c`, called at the first non-skip // block of each 64x64) only reads a literal `cdef_idx` when // `cdef_bits > 0`; at `cdef_bits == 0` there is nothing to read (a @@ -325,8 +330,6 @@ pub fn decode_stream(data: &[u8]) -> Result> { // `Tile::offset` is relative to the buffer `parse_obu` was handed // (`&data[pos..]` at the time this OBU was parsed), so it is relative // to `obu_offset`, not to `data` as a whole. - let start = obu_offset + tile.offset; - let tile_bytes = data.get(start..start + tile.size).ok_or(Error::NeedMore)?; let tile_bufs: Vec<&[u8]> = tiles .iter() .map(|t| { @@ -6664,7 +6667,6 @@ mod tests { let mut pos = 0usize; let mut saw_multi_tile_inter = false; while pos < stream.len() { - let obu_offset = pos; let obu = parser.parse_obu(&stream[pos..]).unwrap(); pos += obu.total_size; if let ObuKind::Frame(header, _) = obu.kind