edith
Clone
https://git.tahinli.com/Tahinli/edith.git
0 watching0 forksRust18.3 MiB2b647eaTahinli3 months ago190 commits
| 1 | //! Hardware encode checks. These need a built `libengine_hw.so` plus a working |
| 2 | //! VA-API driver with an H.264 encode entrypoint, so they are `#[ignore]`d by |
| 3 | //! default. Run them with: |
| 4 | //! |
| 5 | //! ```text |
| 6 | //! cargo build --workspace --release |
| 7 | //! LD_LIBRARY_PATH=target/release \ |
| 8 | //! cargo test -p engine --release --test hw_encode -- --ignored --nocapture --test-threads=1 |
| 9 | //! ``` |
| 10 | //! |
| 11 | //! The round trip goes out through the plugin and back in through the *software* |
| 12 | //! decoder (`rusty_h264` directly, not `DecodeSession`), so a bug on one side |
| 13 | //! cannot cancel out a bug on the other. |
| 14 | |
| 15 | use ; |
| 16 | |
| 17 | use ; |
| 18 | |
| 19 | const FPS: u32 = 30; |
| 20 | const BITRATE: u64 = 4_000_000; |
| 21 | |
| 22 | /// A moving diagonal gradient: something that actually costs bits, so the |
| 23 | /// encoder cannot make the whole test pass by emitting skip frames. |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | /// Encodes `count` synthetic pictures and returns the whole Annex-B stream plus |
| 38 | /// the number of access units the plugin handed back. |
| 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 | |
| 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 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | /// 322x242 is even (NV12 needs that) but neither dimension is a multiple of 16, |
| 122 | /// so the surface is padded and the encoded stream has to crop it back. This is |
| 123 | /// the 1080p case in miniature: 1080 pads to 1088. |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | /// Decode and encode resolve through two independent symbol tables, so an |
| 144 | /// encoder that cannot load must not cost us the decoder (and vice versa). |
| 145 | /// |
| 146 | /// This is the positive half only: the negative half -- a plugin built without |
| 147 | /// `vh_enc_*` -- needs a second build of the `.so` and belongs to the slice's |
| 148 | /// verifier, not here. |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 |