edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBe12d32fTahinli6 days ago3982 commits
| 1 | //! Debug switches the AAC/SBR decoder reads from the environment, with a |
| 2 | //! per-thread override that tests set instead of editing the process |
| 3 | //! environment (which is `unsafe` in Rust 2024). |
| 4 | //! |
| 5 | //! The decoder reads these on the thread that calls `decode`, so an override |
| 6 | //! set on a test's own thread covers exactly that test's decodes and nothing |
| 7 | //! running in parallel. With no override set, each reader answers from the |
| 8 | //! environment exactly as it always has, so manual runs with `EC_AAC_*` set |
| 9 | //! behave as before. |
| 10 | |
| 11 | use Cell; |
| 12 | use LocalKey; |
| 13 | |
| 14 | type Slot = ; |
| 15 | |
| 16 | thread_local! |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | /// The override on this thread if one is set, else whether `var` is set. |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | /// Restores the value a knob had before [`set_tool_sideinfo_debug`] and its |
| 36 | /// siblings were called, when dropped. |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | /// `EC_AAC_TOOL_SIDEINFO_DEBUG`. |
| 51 | pub |
| 52 | |
| 53 | |
| 54 | |
| 55 | /// `EC_AAC_SBR_SIDEINFO_DEBUG`. |
| 56 | pub |
| 57 | |
| 58 | |
| 59 | |
| 60 | /// `EC_AAC_SBR_HF_BYPASS`. |
| 61 | pub |
| 62 | |
| 63 | |
| 64 | |
| 65 | /// `EC_AAC_SBR_NOISE_ZERO`. |
| 66 | pub |
| 67 | |
| 68 | |
| 69 | |
| 70 | /// `EC_AAC_SBR_NOISE_FRACTION`. |
| 71 | pub |
| 72 | |
| 73 | |
| 74 | |
| 75 | /// Forces `EC_AAC_TOOL_SIDEINFO_DEBUG` on (`Some(true)`), off (`Some(false)`) |
| 76 | /// or back to the environment (`None`) on this thread, until the guard drops. |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | /// [`set_tool_sideinfo_debug`] for `EC_AAC_SBR_SIDEINFO_DEBUG`. |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | /// [`set_tool_sideinfo_debug`] for `EC_AAC_SBR_HF_BYPASS`. |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | /// [`set_tool_sideinfo_debug`] for `EC_AAC_SBR_NOISE_ZERO`. |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | /// [`set_tool_sideinfo_debug`] for `EC_AAC_SBR_NOISE_FRACTION`. |
| 101 | |
| 102 | |
| 103 | |
| 104 |