edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB978e685Tahinli3 months ago627 commits
| 1 | [package] |
| 2 | name = "engine" |
| 3 | version.workspace = true |
| 4 | edition.workspace = true |
| 5 | |
| 6 | # No UI dependency here, ever: the engine must stay reusable across front-ends. |
| 7 | [dependencies] |
| 8 | # The two audio-only export formats. Pure Rust, both of them, which is the whole |
| 9 | # reason they are the two: `hound` writes the RIFF header and the PCM, `flacenc` |
| 10 | # encodes FLAC. No default features on flacenc -- its `par` (rayon), `log` and |
| 11 | # `serde` are for its own command-line front-end, and this needs none of them. |
| 12 | hound = "3.5.1" |
| 13 | flacenc = { version = "0.5.1", default-features = false } |
| 14 | libloading = "0.8" |
| 15 | # `memfd_create`, `mmap` and `SCM_RIGHTS` -- the three things std has no door to |
| 16 | # and the whole of what puts the video driver in another process |
| 17 | # (`crate::hwproc`). Not a new crate tree: it was already in this workspace's |
| 18 | # lock file, pulled in by half the dependencies here, so this line compiles |
| 19 | # nothing that was not compiled before. |
| 20 | libc = "0.2" |
| 21 | # Still images, decoded once per placed clip (`decode::Still`). Pure Rust like |
| 22 | # everything else here, and already in the app's tree (gpui pulls it), so this |
| 23 | # costs the build nothing new. Exactly the formats `crate::is_image` admits: no |
| 24 | # default features, which would drag in a dozen decoders nothing opens. |
| 25 | image = { version = "0.25", default-features = false, features = [ |
| 26 | "png", |
| 27 | "jpeg", |
| 28 | "webp", |
| 29 | ] } |
| 30 | mp4 = "0.14" |
| 31 | # zlib, for the one Matroska `ContentEncodings` scheme that is not a byte off |
| 32 | # the front of every block: mkvmerge compressed subtitle tracks with it for |
| 33 | # years. No new crate tree and nothing new to compile -- `image` above already |
| 34 | # pulls this exact version in through `png`, and it is the pure-Rust inflate the |
| 35 | # rest of the ecosystem is built on. |
| 36 | miniz_oxide = "0.8" |
| 37 | # The software H.264 pair, and the only software decoder this project has for |
| 38 | # any format. Pinned exactly, like `ruopus` and `oxideav-ac3` below, because a |
| 39 | # decoder is a bit-exactness dependency -- and 0.9.1 is where that stopped being |
| 40 | # a figure of speech. Measured 2026-08-12 against ffmpeg's own decode of a 1080p |
| 41 | # High and a 720p Main clip, 750 pictures between them: 0.8 matched it |
| 42 | # byte-for-byte on 26 of the 750 and drifted on the rest (worst 69.8 dB PSNR -- |
| 43 | # invisible, but wrong); 0.9.1 matches on all 750. It is also 1.44x faster at it |
| 44 | # (247 Mpx/s against 171 on the 1080p clip, single-threaded); software *encode* |
| 45 | # is unchanged within noise, so this is a decode bump that the encoder came |
| 46 | # along with. `default-features = false` is what keeps `asm` off: those are |
| 47 | # vendored openh264 SIMD kernels that want `nasm` at build time, which this |
| 48 | # project's no-install rule forbids, and the crate enables them by default. |
| 49 | # |
| 50 | # What that line does not turn off, and cannot: the facade asks for its three |
| 51 | # sub-crates with *their* defaults, and `rusty_h264-common`'s default installs |
| 52 | # `rusty_alloc` -- a pure-Rust mimalloc remake, MIT -- as the process-wide |
| 53 | # `#[global_allocator]`, for the whole application rather than the codec. It was |
| 54 | # faster on a synthetic 2M-allocation churn (0.104 s against glibc's 0.142 s) |
| 55 | # and it crashed the editor: sustained scrubbing churns decode-worker threads, |
| 56 | # and it segfaulted on a new thread's *first* allocation. `common` is therefore |
| 57 | # vendored with that declaration removed (workspace root `[patch.crates-io]`), |
| 58 | # which is the only way to decline it -- the codec itself is untouched and still |
| 59 | # bit-exact. Frame-threaded decode arrived in 0.9 as well and |
| 60 | # is opt-in through `RS_H264_FRAME_THREADS`, unset here -- the decode loop is |
| 61 | # serial exactly as it was. |
| 62 | rusty_h264 = { version = "=0.9.1", default-features = false } |
| 63 | # Both halves of AAC, and the only crate here that is asked for both. The |
| 64 | # *encoder*, so an mp4's sound can be a mix rather than a copy: an equalized (or |
| 65 | # otherwise processed) lane has to be decoded, and what is decoded has to be |
| 66 | # encoded again. The *decoder*, because symphonia's own refuses anything wider |
| 67 | # than stereo outright (`aac/mod.rs:93`, "aac: aac too complex") and a 5.1 film |
| 68 | # soundtrack in an mkv is exactly that -- this one hands 5.1 back already |
| 69 | # reordered into FL, FR, FC, LFE, BL, BR, which is the order the downmix in |
| 70 | # `audio` folds. Pure Rust with no C or FFI, Apache-2.0, same family as |
| 71 | # `rusty_h264` above. Nothing else in the ecosystem encodes AAC without linking |
| 72 | # Fraunhofer's C library, which this project's no-install rule forbids. Built |
| 73 | # from `vendor/rusty_aac` -- see the patch table in the workspace manifest. |
| 74 | rusty_aac = "0.5" |
| 75 | # The MP3 encoder, so that format is a row a user can pick rather than a licence |
| 76 | # note: pure Rust, Apache-2.0, CBR and VBR. The decoder side of mp3 is |
| 77 | # symphonia's below -- an mp3 has always been importable here, and until this it |
| 78 | # was the one format the editor could read and never write. |
| 79 | rusty_mp3 = "0.6" |
| 80 | # The Vorbis encoder, same family and the same reason as the three above: pure |
| 81 | # Rust, Apache-2.0, no C and no FFI. It is the *first* permissively-licensed |
| 82 | # pure-Rust Vorbis encoder -- `vorbis_rs` and `vorbis-encoder` are both bindings |
| 83 | # to Xiph's C library, which this project's no-install rule forbids, and |
| 84 | # `oxideav-vorbis` (whose own manifest calls itself an "orphan-rebuild scaffold") |
| 85 | # ships encoder-side *bitstream writers* with no analysis stage at all: no psy |
| 86 | # model, no floor fit, no residue quantiser, nothing that turns PCM into a |
| 87 | # packet. This one does the whole pipeline. Its quirks are measured and worked |
| 88 | # around in [`crate::export::write_ogg`] -- read that before touching this line. |
| 89 | rusty_vorbis = "0.1.1" |
| 90 | # The Opus decoder: pure Rust, MIT, no C and no FFI. |
| 91 | # |
| 92 | # `spectrograms` is not, as this line long claimed, "for its own analysis tools": |
| 93 | # it is the crate's *FFT backend*, and it is default-on because CELT synthesis is |
| 94 | # an N/4 complex FFT per block. Turned off -- which is what asking for `std` |
| 95 | # alone did -- `celt/mdct.rs` falls back to an O(n²) DFT evaluated in f64, and a |
| 96 | # 5.1 film soundtrack decodes at **0.95x realtime**: slower than playing it. |
| 97 | # With the backend on, the same file decodes at **104x** (7.1: 0.93x -> 112x, |
| 98 | # stereo: 10.4x -> 135x). The cost is fifteen pure-Rust crates (`spectrograms` -> |
| 99 | # `realfft`/`rustfft`, `ndarray`, `regex`), still no C and no `build.rs`. |
| 100 | # The output is *not* bit-identical to the DFT build -- FFT summation order |
| 101 | # differs -- but the two agree to 144 dB SNR (max |Δ| 3.7e-8, half an LSB at |
| 102 | # 24-bit) while *both* sit 93 dB from ffmpeg's own libopus decode of the same |
| 103 | # file. The change is 40 dB below the decoder's existing distance to the |
| 104 | # reference, i.e. inside float noise, and upstream says as much: Opus conformance |
| 105 | # is a quality threshold (`opus_compare`), not bit-exactness, and every |
| 106 | # bitstream-affecting computation stays exact either way. |
| 107 | # Symphonia has no Opus at any version -- its feature list stops at vorbis and |
| 108 | # there is no `symphonia-codec-opus` crate -- while both of its containers *read* |
| 109 | # the format already: `A_OPUS` and `OpusHead` have always mapped to |
| 110 | # `CODEC_ID_OPUS`. The decoder was the one missing half, and the reason a 5.1 |
| 111 | # Opus film played silent while its picture was fine. |
| 112 | # |
| 113 | # Multistream is what decides which crate: a 5.1 track is four elementary Opus |
| 114 | # streams in one packet, all but the last **self-delimited** (RFC 6716 App. B), |
| 115 | # and this one strips that framing per stream (`multistream.rs:71`). The obvious |
| 116 | # sibling pick, `rusty-opus 0.9.1` -- same family as `rusty_aac`/`rusty_mp3` |
| 117 | # above -- hands each self-delimited slice to a decoder that parses it as an |
| 118 | # ordinary packet, so every stream but the last decodes the length prefix as |
| 119 | # payload: measured on a real 5.1 Opus remux as full-scale noise at -13 dBFS |
| 120 | # where the film is silent. This one matches ffmpeg's own decode of the same file to a |
| 121 | # correlation of 1.0000 on all six channels. Pinned exactly, like `oxideav-ac3` |
| 122 | # below, because a decoder is a bit-exactness dependency. |
| 123 | ruopus = { version = "=0.1.2", default-features = false, features = ["std", "spectrograms"] } |
| 124 | # The Opus *encoder*, the other half of that pair: a pure-Rust port of libopus |
| 125 | # 1.6, BSD-3, `build.rs`-less and with **no dependencies at all** -- checked, not |
| 126 | # taken from the README (`cargo tree` is two lines; there is not one `.c`, `.h` |
| 127 | # or `.S` file in the crate). It is what lets an edited Opus source leave in a |
| 128 | # Matroska file as Opus instead of being downgraded to AAC on the way out. |
| 129 | # |
| 130 | # Used inside a measured envelope, and that envelope is the whole reason this |
| 131 | # line is not simply "the encoder": 48 kHz **stereo** at **at most** |
| 132 | # [`crate::export::OPUS_MAX_KBPS`]. Above roughly 165 kbps stereo this encoder |
| 133 | # writes packets that only its *own* decoder reads back -- `ruopus` decodes them |
| 134 | # as noise (correlation 0.06 at 256 kbps against the source, 0.9999 at 160), and |
| 135 | # `ruopus` is not the suspect: it decodes ffmpeg's own libopus at 256 kbps to |
| 136 | # correlation 1.00000 on the same signal. Mono is worse and at every rate, which |
| 137 | # is why a mono mix keeps the AAC path. Both measured in |
| 138 | # `tests/opus_export.rs`, which fails the day the crate is unpinned onto a |
| 139 | # version that has fixed it -- that is the upgrade signal. |
| 140 | opus-rs = "=0.1.26" |
| 141 | # The Ogg container, and the only new *name* here that is not a new crate tree: |
| 142 | # its one dependency is `oxideav-core`, which the AC-3 decoder above already |
| 143 | # pulls in. MIT. Vorbis-aware where it counts -- `xiph_lace` builds the |
| 144 | # three-header blob and the muxer pages those ahead of the audio, which is the |
| 145 | # encapsulation order a Vorbis decoder needs and the part that is easy to get |
| 146 | # wrong by hand. |
| 147 | oxideav-ogg = "0.1.8" |
| 148 | symphonia-core = "0.6" |
| 149 | symphonia-codec-aac = "0.6" |
| 150 | # The umbrella crate for the standalone audio files: one dependency instead of |
| 151 | # seven, and its `default::get_probe`/`get_codecs` are the registries this would |
| 152 | # otherwise hand-build. Explicit feature list rather than the default one -- no |
| 153 | # ape, no adpcm: what is listed here is exactly what `is_audio` admits, plus |
| 154 | # `mkv`, which is not an `is_audio` container at all -- it is how the *sound* of |
| 155 | # a Matroska video file is read, the picture having its own demuxer here. |
| 156 | # There is no opus/ac3/dts feature at any symphonia version: AC-3 comes from |
| 157 | # `oxideav-ac3` and Opus from `ruopus` above, both plugged into this crate's |
| 158 | # own readers, and DTS is the one that really is refused. |
| 159 | symphonia = { version = "0.6", default-features = false, features = [ |
| 160 | "aac", |
| 161 | "alac", |
| 162 | "flac", |
| 163 | "id3v1", |
| 164 | "id3v2", |
| 165 | "isomp4", |
| 166 | "mkv", |
| 167 | "mp3", |
| 168 | "ogg", |
| 169 | "pcm", |
| 170 | "vorbis", |
| 171 | "wav", |
| 172 | ] } |
| 173 | oxideav-ac3 = "=0.0.10" |
| 174 | oxideav-core = "0.1.34" |
| 175 | # The subtitle parsers: SRT and WebVTT here, ASS/SSA in the sibling crate -- |
| 176 | # `oxideav-subtitle` hosts the shared IR and hands ASS to `oxideav-ass`, which |
| 177 | # is why both names are needed for the three formats. MIT, pure Rust, and both |
| 178 | # asked for without their default features: nothing here *draws* a cue yet (see |
| 179 | # `crate::subtitle`), so the rendering stacks are dead weight. Only `oxideav-ass` |
| 180 | # actually loses one -- it depends on `oxideav-subtitle` with defaults on, so |
| 181 | # that crate's `text` feature (the bitmap font and rasterizer) is unified back |
| 182 | # in whatever this line says. Nothing here calls into it. |
| 183 | oxideav-subtitle = { version = "0.1.2", default-features = false } |
| 184 | oxideav-ass = { version = "0.0.9", default-features = false } |
| 185 | # The software AV1 encoder, and the only new name in this list that was already |
| 186 | # in the lock file: `ravif` pulls the very same rav1e 0.8.1 in through the image |
| 187 | # crate, so this links what the build already compiled. BSD-2 with the AOM |
| 188 | # patent grant, and pure Rust with `asm` *off*: that feature wants `nasm`, which |
| 189 | # this project's build does not have and will not require. `threading` is rayon |
| 190 | # inside rav1e itself and is what keeps an export minutes rather than tens of |
| 191 | # minutes; the cost of no assembly is measured in `export::Enc::open_av1`. |
| 192 | rav1e = { version = "0.8.1", default-features = false, features = ["threading"] } |
| 193 | # The software HEVC encoder, intra-only: OxideAV's pure-Rust H.265, MIT, no C |
| 194 | # and no FFI like everything else here. Its *inter* modes run at 0.81 fps on |
| 195 | # 1080p across 12 cores (measured 2026-08-11) and are therefore not an export |
| 196 | # anyone would wait for; its intra AU is a stateless free function that fans out |
| 197 | # across cores at 4.30 fps for the same picture, which is the export this |
| 198 | # project offers -- an intraframe master, ProRes-shaped, large files and all. |
| 199 | # Built from `vendor/oxideav-h265`; see the note in the workspace manifest. |
| 200 | oxideav-h265 = { path = "../../vendor/oxideav-h265" } |
| 201 | oxideav-sub-image = "0.0.7" |
| 202 | |
| 203 | [dev-dependencies] |
| 204 | # The still-image suite compares what the timeline shows against the file's own |
| 205 | # pixels rather than against a constant. Already built for the engine itself. |
| 206 | image = { version = "0.25", default-features = false, features = ["png"] } |