forge
Explore
Log in

Don't you dare go Hollow

Drop two bindings the multi-tile merge left dead

Browse files at this commit

547a1fa2212d92cd5ae0b22861760922e3ea5d6fAhmet Kaan GümüşParent: 97ae517
  • style
    • drop two bindings the multi-tile merge left dead
Show full message
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.rsmodified+8 -6
@@ -120,9 +120,14 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
120120 let ObuKind::Frame(header, tiles) = obu.kind else {
121121 continue;
122122 };
123- let tile = tiles.first().ok_or_else(|| {
124- Error::unsupported("AV1 decode_stream", "a frame OBU with no tile group")
125- })?;
123+ // Every tile is decoded below through `tile_bufs`; this only rejects a
124+ // frame OBU that carries no tile group at all.
125+ if tiles.is_empty() {
126+ return Err(Error::unsupported(
127+ "AV1 decode_stream",
128+ "a frame OBU with no tile group",
129+ ));
130+ }
126131 // `read_cdef` (spec `decodeframe.c`, called at the first non-skip
127132 // block of each 64x64) only reads a literal `cdef_idx` when
128133 // `cdef_bits > 0`; at `cdef_bits == 0` there is nothing to read (a
@@ -325,8 +330,6 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
325330 // `Tile::offset` is relative to the buffer `parse_obu` was handed
326331 // (`&data[pos..]` at the time this OBU was parsed), so it is relative
327332 // to `obu_offset`, not to `data` as a whole.
328- let start = obu_offset + tile.offset;
329- let tile_bytes = data.get(start..start + tile.size).ok_or(Error::NeedMore)?;
330333 let tile_bufs: Vec<&[u8]> = tiles
331334 .iter()
332335 .map(|t| {
@@ -6664,7 +6667,6 @@ mod tests {
66646667 let mut pos = 0usize;
66656668 let mut saw_multi_tile_inter = false;
66666669 while pos < stream.len() {
6667- let obu_offset = pos;
66686670 let obu = parser.parse_obu(&stream[pos..]).unwrap();
66696671 pos += obu.total_size;
66706672 if let ObuKind::Frame(header, _) = obu.kind