edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB7aaf710Tahinli6 days ago3935 commits
| 1 | #!/usr/bin/env python3 |
| 2 | """Flip control: prove the ffmpeg comparator BITES, before any verdict. |
| 3 | |
| 4 | [`cmp422-ffmpeg`][c] re-derives the decode->display assignment from LUMA |
| 5 | identity on every call, so a flipped oracle sample can never be re-mapped -- |
| 6 | the identity it keys on is exactly what the flip breaks. This control |
| 7 | therefore maps ONCE from the untouched streams and then flips one SAMPLE per |
| 8 | arm with the mapping PINNED, which is the only way to ask "does one wrong |
| 9 | sample move the count by exactly one?". |
| 10 | |
| 11 | Two independent directions, both required to pass: |
| 12 | |
| 13 | * **oracle arm** -- flip one ffmpeg sample. The plane that owns it must move by |
| 14 | EXACTLY +1, every other plane by exactly 0. On a byte-exact cell this is the |
| 15 | only thing that can move, so a `0/0/0` that survives a flip is a comparator |
| 16 | that is not reading the oracle. |
| 17 | * **ours arm** -- flip one of OUR samples with the oracle untouched. Same |
| 18 | delta. This is the direction the whole corpus verdict rests on, and on a |
| 19 | `0/0/0` cell it is what separates "we agree" from "we never looked". |
| 20 | |
| 21 | Every decode->display SOLUTION is exercised, so an ambiguous mapping cannot |
| 22 | hide a failure behind the one that was picked. |
| 23 | |
| 24 | Usage: |
| 25 | python3 scripts/flipctl-422.py cells.json |
| 26 | |
| 27 | `cells.json` entries: `{"name", "path", "prefix"}`, `prefix` being our |
| 28 | `EC_AV1_FINAL_DUMP` prefix. Exit status 0 only if every arm passes. |
| 29 | """ |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | = |
| 36 | = |
| 37 | |
| 38 | = |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | """The comparator's own accounting (`cmp422-ffmpeg.compare`'s `measure`), |
| 44 | with the decode->display assignment PINNED so a flipped sample cannot |
| 45 | re-map.""" |
| 46 | = |
| 47 | |
| 48 | |
| 49 | continue |
| 50 | = |
| 51 | = 0 |
| 52 | |
| 53 | |
| 54 | = + * |
| 55 | |
| 56 | += 1 |
| 57 | += * |
| 58 | return |
| 59 | |
| 60 | |
| 61 | |
| 62 | """Flip bit 0 of one SAMPLE's low byte: exactly +1 wrong sample at both |
| 63 | depths (2**bitdepth < 2**16, so nothing carries out of the container).""" |
| 64 | = |
| 65 | ^= 1 |
| 66 | return |
| 67 | |
| 68 | |
| 69 | |
| 70 | """(plane, sample_index) per plane: the first, the middle and the last.""" |
| 71 | = |
| 72 | |
| 73 | += |
| 74 | return |
| 75 | |
| 76 | |
| 77 | |
| 78 | , , , , , = |
| 79 | = 1 |
| 80 | , = |
| 81 | = |
| 82 | = |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | = |
| 90 | = |
| 91 | |
| 92 | |= |
| 93 | = |
| 94 | # Two shown display frames per cell -- the first and one in the middle -- |
| 95 | # so the arm is not confined to frame 0. |
| 96 | = |
| 97 | , = , 0 |
| 98 | = |
| 99 | |
| 100 | |
| 101 | = |
| 102 | |
| 103 | continue |
| 104 | = |
| 105 | = |
| 106 | |
| 107 | = + # sample index inside the frame |
| 108 | = |
| 109 | = 1 |
| 110 | |
| 111 | |
| 112 | = |
| 113 | = |
| 114 | = |
| 115 | |
| 116 | = |
| 117 | = |
| 118 | = |
| 119 | = |
| 120 | = == |
| 121 | |
| 122 | += 1 |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | return |
| 130 | |
| 131 | |
| 132 | |
| 133 | = |
| 134 | |
| 135 | += |
| 136 | |
| 137 | return 0 |
| 138 | |
| 139 | |
| 140 | |
| 141 |