edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! Frame-accurate seeking on `test_av1_grain.mkv` (AV1 in Matroska, film grain, |
| 2 | //! keyframes every 30 frames). The source carries its own timecode burned into |
| 3 | //! the top-left corner, so a composed frame names the source frame it shows by |
| 4 | //! that text: `compose_at(f)` must show source frame `f`. |
| 5 | //! |
| 6 | //! Was failing: a hardware AV1 open at a mid-stream frame of this file showed a |
| 7 | //! later source frame (`compose_at(30)` showed source 60). The cause was in the |
| 8 | //! VA-API plugin, not the seek: AV1 is decoded one OBU per call, and the plugin |
| 9 | //! dropped the rest of each temporal unit on the Annex-B start-code rule, so no |
| 10 | //! keyframe was ever decoded and every seek drifted by a GOP. Fixed in |
| 11 | //! `crates/engine-hw`; the sequential and software paths are unchanged. |
| 12 | //! |
| 13 | //! ```text |
| 14 | //! cargo test -p engine --release --test grain_seek -- --nocapture |
| 15 | //! ``` |
| 16 | |
| 17 | use PathBuf; |
| 18 | use Command; |
| 19 | |
| 20 | use PlaybackSession; |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | const W: u32 = 1280; |
| 29 | const H: u32 = 720; |
| 30 | /// The timecode box, top-left, in full-size pixels. |
| 31 | const CW: u32 = 200; |
| 32 | const CH: u32 = 28; |
| 33 | const CROP: usize = as usize; |
| 34 | |
| 35 | /// The top-left timecode crop of a full-size BGRA frame, row by row. |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | /// `1 - r` of two crops, `r` their Pearson correlation. Lower is a better match. |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | /// The source frame each timeline frame shows, by its timecode crop against an |
| 59 | /// ffmpeg decode of the same file. |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 |