edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! Where a picture is decoded: on the calling thread, or on a worker thread of its own. |
| 2 | //! |
| 3 | //! With frame threads each picture gets one worker thread. The decoder sends the worker |
| 4 | //! the picture's slices in decoding order, then its finish, and goes on with the next |
| 5 | //! picture. The worker runs the slices on its [`PicJob`] and publishes each row as it |
| 6 | //! becomes final ([`super::shared`]). A worker only waits for pictures decoded before its |
| 7 | //! own (its references and collocated picture), and the decoder keeps at most `threads` |
| 8 | //! pictures in flight, so the waits form no cycle. |
| 9 | //! |
| 10 | //! With one thread every picture is decoded inline: the same job, run on the calling |
| 11 | //! thread as each slice arrives, so an error comes back from the call that caused it. |
| 12 | //! |
| 13 | //! A worker that fails (a corrupt slice, or a panic) marks its picture as failed in the |
| 14 | //! shared picture, so anything waiting on it wakes with the error. |
| 15 | |
| 16 | use ; |
| 17 | use ; |
| 18 | use ; |
| 19 | use JoinHandle; |
| 20 | |
| 21 | use ; |
| 22 | use ; |
| 23 | use ; |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | /// The worker threads of the decoder, shared by the pictures in flight (frame threads) |
| 31 | /// and the wavefront row workers of each picture. A picture always holds one thread while |
| 32 | /// it is in flight; the rest of the budget is handed out as extra row workers by |
| 33 | /// [`Budget::take_extra`], which never waits. |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | /// Extra threads taken from a [`Budget`] for one picture's row workers. |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | /// One picture's hold on the budget: taken when the picture is created, released when it |
| 90 | /// is dropped (after its worker has finished, or with the inline job). |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | /// The motion checksum of one picture (see [`super::Decoder::motion_checksum`]), set when |
| 111 | /// the picture finishes. The value is `None` for a picture no slice ran in, and also for a |
| 112 | /// picture that failed. |
| 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 | /// A message to a picture's worker. |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | /// The decoding of one picture, on the calling thread or on its own worker. |
| 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 | /// The body of a picture's worker thread. A failure, a panic, or a picture dropped before |
| 209 | /// its finish marks the picture as failed, so that nothing waits on it forever. |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 |