edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli4 days ago4021 commits
| 1 | //! Scaled-reference witness: an inter frame whose reference slot holds a |
| 2 | //! picture of a DIFFERENT coded size must scale that reference during |
| 3 | //! prediction (`vp9_setup_scale_factors_for_frame` + the scaled convolve |
| 4 | //! walk) and come out byte-identical to libvpx. `scaledref.ivf` scales |
| 5 | //! 1280x720 -> 640x360 (`x_step_q4 == y_step_q4 == 32`); the paired |
| 6 | //! `scaledref_odd.ivf` is the same stream with the keyframe patched to |
| 7 | //! 1279x719, so the reference is an ODD coded extent and its chroma crop |
| 8 | //! ceils — the interaction with the odd-dimension layout. |
| 9 | //! |
| 10 | //! The fixtures are committed under `tests/data/` because no ffmpeg |
| 11 | //! invocation can produce a size change: libvpx's encoder emits one only |
| 12 | //! through its rate-control resize path (ffmpeg exposes neither |
| 13 | //! `rc_resize_allowed` nor SVC), and a hand-spliced explicit-size inter frame trips |
| 14 | //! libvpx's own header reparsing. The generator is recorded in |
| 15 | //! `lanes/vp9refsetup.report.md`: a 1280x720 one-pass CBR encode at 200 kbps, |
| 16 | //! whose `vp9_resize_one_pass_cbr` downscales frame 1 to 640x360 against the |
| 17 | //! keyframe. `scaledref_odd.ivf` is that same file through |
| 18 | //! `$HOME/.cache/vp9pix/patch_kf_size.py <in> <out> 1279 719` (which rewrites |
| 19 | //! the IVF container size too). |
| 20 | //! |
| 21 | //! Oracle caveat: ffmpeg locks its rawvideo output size to the FIRST decoded |
| 22 | //! frame's, so a two-size stream cannot be dumped in one pass. Frame 0 is |
| 23 | //! decoded on its own (`-frames:v 1`, identity); frames 2..N are decoded with |
| 24 | //! `select=gte(n,1)` at the small size, where the filtergraph has |
| 25 | //! re-initialised and every frame passes through unchanged. The size-change |
| 26 | //! frame (file frame 1) is the one ffmpeg mangles during that |
| 27 | //! re-initialisation, so it is checked INDIRECTLY: every later frame predicts |
| 28 | //! from its reconstruction, so a wrong scaler fails frames 2..N. |
| 29 | |
| 30 | use crateivf; |
| 31 | |
| 32 | use Decoder; |
| 33 | use ; |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | /// Run ffmpeg over `path` with `args` and return its rawvideo stdout. |
| 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 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | /// The same size change with an ODD coded reference: 1279x719 -> 640x360, |
| 168 | /// where the reference's chroma crop ceils (`(1279 + 1) / 2`). |
| 169 | |
| 170 | |
| 171 | |
| 172 |