edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! The BD gate's source arming, shared with `examples/enc_probe` (lane-probe). |
| 2 | //! |
| 3 | //! The probe used to build its own ffmpeg command line and dropped the gate's |
| 4 | //! `-ss` seek, so it read film B's black leader and every census taken through |
| 5 | //! it was probe-relative (59 kB where the gate's own ladder point coded 89 kB |
| 6 | //! of the same title). One definition now serves both: the gate's |
| 7 | //! `clip_frames_vf` and the probe both call [`source`], so the two can only |
| 8 | //! differ in the arguments they pass, which |
| 9 | //! `encode::tests::the_probe_arms_the_gates_source` pins. |
| 10 | |
| 11 | use cratePicture; |
| 12 | use Command; |
| 13 | |
| 14 | /// The video stream's coded size, from ffprobe. |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | /// The native BD gate's window on `clip`: a whole number of 128-wide |
| 32 | /// superblocks, at most 1920x1024, out of the MIDDLE of the coded frame, with |
| 33 | /// even offsets for 4:2:0 -- as an ffmpeg `crop` filter plus its size. |
| 34 | /// |
| 35 | /// This lives here because the probe used to be handed the crop by hand, and |
| 36 | /// a hand-written `crop=1920:1024:960:568` (a 2160-high frame that film B, |
| 37 | /// coded 3840x1608, is not) put the instrument on different pixels than the |
| 38 | /// gate: 60 kB where the gate's own q=150 point coded 90 kB. |
| 39 | /// |
| 40 | /// # Panics |
| 41 | /// When ffprobe cannot read the size, or the frame is under one superblock. |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | /// `frames` pictures of `clip` from `skip` through the filter chain `vf`, as |
| 56 | /// planar 8-bit 4:2:0 at `width`x`height` -- the BD gate's loader recipe. |
| 57 | /// |
| 58 | /// # Panics |
| 59 | /// When ffmpeg cannot be run, fails, or delivers a different number of frames. |
| 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 | /// Runs a test-harness child (`aomenc`, `ffmpeg`) with `input` on its stdin |
| 106 | /// and all three pipes drained concurrently, returning the child's |
| 107 | /// [`std::process::Output`] (status, stdout, stderr) for the caller to |
| 108 | /// assert on. |
| 109 | /// |
| 110 | /// The ONE spawn path for every test that feeds a child on stdin |
| 111 | /// (lane-av1-pipedrain). Writing the input INLINE before |
| 112 | /// `wait_with_output()` deadlocks as soon as the child's stdout pipe buffer |
| 113 | /// (~64 KiB) fills before the last input byte is written: the child blocks |
| 114 | /// in write(2), the test blocks in `write_all`, both at 0% CPU until the |
| 115 | /// harness timeout -- measured at 45 minutes on a 1.1 MB fixture decoding |
| 116 | /// to 150 MB of raw frames (lane-t900 r10), and four aomenc gates still sat |
| 117 | /// on the inline pattern after that fix. Here a writer thread owns stdin |
| 118 | /// while the parent drains stdout/stderr, so a multi-MB y4m always meets a |
| 119 | /// reader, never a blocked writer. |
| 120 | /// |
| 121 | /// A child that exits early (bad flags, refused input) breaks the writer's |
| 122 | /// pipe: the EPIPE from `write_all` is swallowed on purpose, and the |
| 123 | /// child's own exit status and stderr -- which the caller asserts on -- |
| 124 | /// carry the real diagnosis. |
| 125 | /// |
| 126 | /// # Panics |
| 127 | /// When the child cannot be spawned or reaped, when the writer thread |
| 128 | /// panics, or when the child is still running after the deadline (below): |
| 129 | /// it is killed and the test fails naming the command, the timeout and the |
| 130 | /// kill -- the CFL suite lost 11h41m to a wedged aomenc child because the |
| 131 | /// pre-pipedrain spawn had no bound (class: aomenc-stdin-pipe-deadlock). |
| 132 | /// |
| 133 | /// The deadline is 1800 s per child, overridable with |
| 134 | /// `EC_AV1_CHILD_TIMEOUT_SECS`. Every legitimate child here is an |
| 135 | /// aomenc/ffmpeg over an at-most-a-few-MB fixture: seconds, not minutes. |
| 136 | |
| 137 | pub |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 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 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 |