edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB4e368e4Tahinli2 months ago2295 commits
| 1 | #!/usr/bin/env bash |
| 2 | # Regenerates ec-mp3's measured constant tables. |
| 3 | # |
| 4 | # Layer III's Huffman codes and its 512-tap polyphase window are normative data |
| 5 | # that no formula produces. Rather than copy them out of an existing |
| 6 | # implementation, these scripts measure them: they write legal Layer III frames |
| 7 | # whose main-data bits they choose, decode them with ffmpeg, and read the answer |
| 8 | # back through a model of the decode chain. |
| 9 | # |
| 10 | # learn_window.py least-squares fits the 512 window taps to the PCM ffmpeg |
| 11 | # returns for spectra we chose (residual 1.6e-6, the f32 |
| 12 | # noise floor of the decoder being measured) |
| 13 | # mp3op.py builds the spectrum -> PCM operator and its pseudo-inverse |
| 14 | # learn_huffman.py walks every code tree: a bit prefix is a codeword exactly |
| 15 | # when all continuations decode to the same pair. Checks a |
| 16 | # Kraft sum of 1, full coverage and uniqueness per table |
| 17 | # learn_sfb.py MPEG-1 long scalefactor band widths, one band attenuated |
| 18 | # at a time (these agreed with the published layouts) |
| 19 | # lsf_probe.py short-block reorder at the low sampling frequencies |
| 20 | # emit_tables.py writes huffman_tables.rs |
| 21 | # |
| 22 | # Needs ffmpeg, python3 and numpy. Output lands beside the scripts; copy |
| 23 | # huffman_tables.rs and window.rs into crates/ec-mp3/src/. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 |