Three refusals claimed the encoder never writes what it writes
Browse files at this commit177de6ad43147e5c4e848cd78fb91a4875b3f7a4Parent: 2cf5984- fix
- three refusals claimed the encoder never writes what it writes
3 changed files +23 -4
- crates/ec-av1/examples/decode_probe.rs +9 -0
- crates/ec-av1/src/decode.rs +6 -3
- crates/ec-av1/src/refusal_inventory.rs +8 -1
crates/ec-av1/examples/decode_probe.rsadded+9 -0
| @@ -0,0 +1,9 @@ | |||
| 1 | +//! Temporary probe: decode an IVF and print what the decoder says. | ||
| 2 | +fn main() { | ||
| 3 | + let path = std::env::args().nth(1).expect("usage: decode_probe <file.ivf>"); | ||
| 4 | + let data = std::fs::read(&path).expect("read"); | ||
| 5 | + match ec_av1::stream::decode_stream(&data) { | ||
| 6 | + Ok(frames) => println!("OK: {} frames decoded", frames.len()), | ||
| 7 | + Err(e) => println!("REFUSED: {e}"), | ||
| 8 | + } | ||
| 9 | +} | ||
crates/ec-av1/src/decode.rsmodified+6 -3
| @@ -5283,14 +5283,17 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | |||
| 5283 | } | 5283 | } |
| 5284 | _ => { | 5284 | _ => { |
| 5285 | return Err(unsupported(format!( | 5285 | return Err(unsupported(format!( |
| 5286 | - "a partition type this encoder never writes (value={part32})" | 5286 | + "a 32x32 partition type this decoder does not code (value={part32})" |
| 5287 | ))); | 5287 | ))); |
| 5288 | } | 5288 | } |
| 5289 | } | 5289 | } |
| 5290 | } | 5290 | } |
| 5291 | } | 5291 | } |
| 5292 | _ => { | 5292 | _ => { |
| 5293 | - return Err(unsupported("a partition type this encoder never writes")); | 5293 | + return Err(unsupported( |
| 5294 | + "a superblock-level partition type other than NONE or SPLIT (this \ | ||
| 5295 | + decoder's intra tile path codes only those two at 64x64)", | ||
| 5296 | + )); | ||
| 5294 | } | 5297 | } |
| 5295 | } | 5298 | } |
| 5296 | } | 5299 | } |
| @@ -10885,7 +10888,7 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | |||
| 10885 | } | 10888 | } |
| 10886 | _ => { | 10889 | _ => { |
| 10887 | return Err(unsupported(format!( | 10890 | return Err(unsupported(format!( |
| 10888 | - "an INTER 32x32 partition type this encoder never writes (value={part32})" | 10891 | + "an INTER 32x32 partition type this decoder does not code (value={part32})" |
| 10889 | ))); | 10892 | ))); |
| 10890 | } | 10893 | } |
| 10891 | } | 10894 | } |
crates/ec-av1/src/refusal_inventory.rsmodified+8 -1
| @@ -29,7 +29,6 @@ const CAPABILITY_CLAIMS: &[&str] = &[ | |||
| 29 | "a nonzero angle delta (this encoder never writes one)", | 29 | "a nonzero angle delta (this encoder never writes one)", |
| 30 | "a partition below 16x16 other than a clean split (this encoder never writes one)", | 30 | "a partition below 16x16 other than a clean split (this encoder never writes one)", |
| 31 | "a partition below 8x8 (this encoder never writes one)", | 31 | "a partition below 8x8 (this encoder never writes one)", |
| 32 | - "a partition type this encoder never writes", | ||
| 33 | "a tx_type symbol on a rectangular transform (never expected at this size)", | 32 | "a tx_type symbol on a rectangular transform (never expected at this size)", |
| 34 | ]; | 33 | ]; |
| 35 | 34 | ||
| @@ -38,7 +37,11 @@ const REFUSALS: &[&str] = &[ | |||
| 38 | "GLOBALMV (round 3)", | 37 | "GLOBALMV (round 3)", |
| 39 | "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", | 38 | "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
| 40 | "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", | 39 | "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
| 40 | + "a 32x32 partition type this decoder does not code (value={part32})", | ||
| 41 | "a Golomb tail longer than this decoder reads", | 41 | "a Golomb tail longer than this decoder reads", |
| 42 | + "a tx_type symbol outside its CDF's own set: {t}", | ||
| 43 | + "an INTER 32x32 partition type this decoder does not code (value={part32})", | ||
| 44 | + "a superblock-level partition type other than NONE or SPLIT (this decoder's intra tile path codes only those two at 64x64)", | ||
| 42 | "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)", | 45 | "a HORZ/VERT intra strip in a screen-content frame (palette syntax is consumed for square blocks only)", |
| 43 | "a HORZ/VERT intra strip with a split transform (per-unit rect prediction is not ported)", | 46 | "a HORZ/VERT intra strip with a split transform (per-unit rect prediction is not ported)", |
| 44 | "a block that actually uses a palette (UV) -- reconstruction is out of scope", | 47 | "a block that actually uses a palette (UV) -- reconstruction is out of scope", |
| @@ -107,6 +110,10 @@ mod tests { | |||
| 107 | for (start, _) in src.match_indices("unsupported(") { | 110 | for (start, _) in src.match_indices("unsupported(") { |
| 108 | // `Error::unsupported(` and the bare helper both end here. | 111 | // `Error::unsupported(` and the bare helper both end here. |
| 109 | let mut i = start + "unsupported(".len(); | 112 | let mut i = start + "unsupported(".len(); |
| 113 | + // `unsupported(format!("..."))` is the same refusal, one layer in. | ||
| 114 | + if src[i..].starts_with("format!(") { | ||
| 115 | + i += "format!(".len(); | ||
| 116 | + } | ||
| 110 | let mut last: Option<String> = None; | 117 | let mut last: Option<String> = None; |
| 111 | loop { | 118 | loop { |
| 112 | while i < bytes.len() && (bytes[i] as char).is_whitespace() { | 119 | while i < bytes.len() && (bytes[i] as char).is_whitespace() { |