edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiBff99ad6Tahinli6 days ago1055 commits
| 1 | //! A per-clip colour grade, end to end: what the renderer shows and what the |
| 2 | //! export writes have to be the same picture, and a clip nobody graded has to |
| 3 | //! come out of both untouched. |
| 4 | //! |
| 5 | //! `test_baseline.mp4` is colour bars (mean channel spread 249 of 255), so |
| 6 | //! saturation 0 is not a subtle claim: every pixel of a graded span is grey to |
| 7 | //! within the converter's own rounding, and every pixel outside it is not. |
| 8 | //! |
| 9 | //! ```text |
| 10 | //! cargo test -p engine --release --test color -- --nocapture --test-threads=1 |
| 11 | //! ``` |
| 12 | |
| 13 | use ; |
| 14 | use sleep; |
| 15 | use ; |
| 16 | |
| 17 | use ColorParams; |
| 18 | use ExportSettings; |
| 19 | use Lane; |
| 20 | use Scratch; |
| 21 | use ; |
| 22 | |
| 23 | const FPS: f64 = 30.0; |
| 24 | /// Where the first clip ends and the ungraded one begins. |
| 25 | const CUT: u32 = 30; |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | /// Silent, like every other suite that plays a real file: the grade is a |
| 34 | /// picture setting and nothing here listens. |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | /// Two clips on `V1`, the first of them drained of all colour. |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | /// How far a BGRA frame is from grey: the mean spread between its channels, |
| 60 | /// which is 0 for a greyscale picture and ~250 for these colour bars. |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | /// The next frame off a freshly seeked channel. |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | /// The render half: the grade reaches the picture, and it stops at the clip's |
| 89 | /// own edge rather than colouring the whole timeline. |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | /// Live: a grade set while the session is up repaints what is on screen. The |
| 110 | /// engine reseeks on the edit, so the very next frame is the graded one -- no |
| 111 | /// scrub, no reopen by the caller. |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | /// The export half, decoded back off disk: the same picture the renderer |
| 148 | /// showed, graded span for graded span. Software encoder, so it needs nothing |
| 149 | /// installed -- the same pin `tests/export.rs`'s default suite uses. |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 |