Drop two bindings the multi-tile merge left dead
Browse files at this commit547a1fa2212d92cd5ae0b22861760922e3ea5d6fParent: 97ae517- style
- drop two bindings the multi-tile merge left dead
1 changed file +8 -6
crates/ec-av1/src/stream.rsmodified+8 -6
| @@ -120,9 +120,14 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> { | |||
| 120 | let ObuKind::Frame(header, tiles) = obu.kind else { | 120 | let ObuKind::Frame(header, tiles) = obu.kind else { |
| 121 | continue; | 121 | continue; |
| 122 | }; | 122 | }; |
| 123 | - let tile = tiles.first().ok_or_else(|| { | 123 | + // Every tile is decoded below through `tile_bufs`; this only rejects a |
| 124 | - Error::unsupported("AV1 decode_stream", "a frame OBU with no tile group") | 124 | + // frame OBU that carries no tile group at all. |
| 125 | - })?; | 125 | + if tiles.is_empty() { |
| 126 | + return Err(Error::unsupported( | ||
| 127 | + "AV1 decode_stream", | ||
| 128 | + "a frame OBU with no tile group", | ||
| 129 | + )); | ||
| 130 | + } | ||
| 126 | // `read_cdef` (spec `decodeframe.c`, called at the first non-skip | 131 | // `read_cdef` (spec `decodeframe.c`, called at the first non-skip |
| 127 | // block of each 64x64) only reads a literal `cdef_idx` when | 132 | // block of each 64x64) only reads a literal `cdef_idx` when |
| 128 | // `cdef_bits > 0`; at `cdef_bits == 0` there is nothing to read (a | 133 | // `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>> { | |||
| 325 | // `Tile::offset` is relative to the buffer `parse_obu` was handed | 330 | // `Tile::offset` is relative to the buffer `parse_obu` was handed |
| 326 | // (`&data[pos..]` at the time this OBU was parsed), so it is relative | 331 | // (`&data[pos..]` at the time this OBU was parsed), so it is relative |
| 327 | // to `obu_offset`, not to `data` as a whole. | 332 | // 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)?; | ||
| 330 | let tile_bufs: Vec<&[u8]> = tiles | 333 | let tile_bufs: Vec<&[u8]> = tiles |
| 331 | .iter() | 334 | .iter() |
| 332 | .map(|t| { | 335 | .map(|t| { |
| @@ -6664,7 +6667,6 @@ mod tests { | |||
| 6664 | let mut pos = 0usize; | 6667 | let mut pos = 0usize; |
| 6665 | let mut saw_multi_tile_inter = false; | 6668 | let mut saw_multi_tile_inter = false; |
| 6666 | while pos < stream.len() { | 6669 | while pos < stream.len() { |
| 6667 | - let obu_offset = pos; | ||
| 6668 | let obu = parser.parse_obu(&stream[pos..]).unwrap(); | 6670 | let obu = parser.parse_obu(&stream[pos..]).unwrap(); |
| 6669 | pos += obu.total_size; | 6671 | pos += obu.total_size; |
| 6670 | if let ObuKind::Frame(header, _) = obu.kind | 6672 | if let ObuKind::Frame(header, _) = obu.kind |