edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiBcfa93c0Tahinli3 months ago1659 commits
| 1 | #!/usr/bin/env bash |
| 2 | # gen-bitstream-fixtures.sh — raw VP9/AV1 elementary streams for the syntax crates. |
| 3 | # |
| 4 | # ffmpeg is ORACLE/test-input tooling only; no ec-* crate depends on it at runtime. |
| 5 | # Two sources: (a) the container fixtures from gen-fixtures.sh, remuxed to IVF so a |
| 6 | # header parser sees the elementary stream with no container in the way, and (b) |
| 7 | # small purpose-built clips for the header branches the 4:2:0 8/10-bit set never |
| 8 | # reaches — VP9 superframes with a hidden ALTREF plus show_existing_frame, 4:4:4 |
| 9 | # (VP9 profile 1/3, AV1 profile 1), monochrome AV1, multi-tile AV1. |
| 10 | # |
| 11 | # Idempotent: non-empty outputs are skipped, partial outputs are deleted on failure. |
| 12 | # |
| 13 | # Usage: scripts/gen-bitstream-fixtures.sh [-f] (-f: regenerate everything) |
| 14 | # Env: EC_FIXTURES=<dir> (default <repo>/fixtures) |
| 15 | |
| 16 | |
| 17 | |
| 18 | ROOT= |
| 19 | FIXTURES= |
| 20 | OUT=/bitstreams |
| 21 | FORCE=0 |
| 22 | [ && FORCE=1 |
| 23 | |
| 24 | || { ; ; } |
| 25 | |
| 26 | || |
| 27 | TMPLOG= || |
| 28 | |
| 29 | |
| 30 | fail=0 |
| 31 | |
| 32 | # run <output> <ffmpeg args...> |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | # (a) remux every VP9/AV1 container fixture into IVF, keeping the codec bytes. |
| 51 | for; do |
| 52 | [ || continue |
| 53 | base= |
| 54 | |
| 55 | done |
| 56 | |
| 57 | # (a2) H.264/HEVC elementary streams in Annex B form, for the hardware decoder: |
| 58 | # a stateless decoder is fed NAL units, and the mp4 fixtures carry them |
| 59 | # length-prefixed. `-bsf` puts the start codes and the in-band parameter sets back. |
| 60 | for; do |
| 61 | [ || continue |
| 62 | base= |
| 63 | |
| 64 | done |
| 65 | for; do |
| 66 | [ || continue |
| 67 | base= |
| 68 | |
| 69 | done |
| 70 | |
| 71 | # (b) branch coverage the container set does not have. |
| 72 | SYN="-f lavfi -i testsrc2=size=320x240:rate=30:duration=2" |
| 73 | |
| 74 | # VP9 superframes: a hidden ALTREF is packed with the next frame, and the frame |
| 75 | # that finally shows it is a show_existing_frame header. libvpx only picks |
| 76 | # alternate references in two-pass mode ("2-pass only" in its own option help), |
| 77 | # so a single-pass encode here yields no superframe at all. |
| 78 | if [ || [; then |
| 79 | PASSLOG= |
| 80 | # shellcheck disable=SC2086 |
| 81 | |
| 82 | |
| 83 | |
| 84 | # shellcheck disable=SC2086 |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | else |
| 90 | |
| 91 | fi |
| 92 | # VP9 profile 1 (4:4:4 8-bit) and profile 3 (4:4:4 10-bit): the color_config |
| 93 | # branches where subsampling_x/y are coded rather than assumed. |
| 94 | # shellcheck disable=SC2086 |
| 95 | |
| 96 | |
| 97 | # shellcheck disable=SC2086 |
| 98 | |
| 99 | |
| 100 | # VP9 tiles: 4 tile columns needs a frame wide enough for log2_tile_cols > 0. |
| 101 | |
| 102 | |
| 103 | |
| 104 | # AV1 profile 1 (4:4:4) and monochrome, plus a multi-tile frame. |
| 105 | # shellcheck disable=SC2086 |
| 106 | |
| 107 | |
| 108 | # shellcheck disable=SC2086 |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | # H.264 with B frames and an open GOP: reordering, so the decoder's output order |
| 114 | # is exercised rather than assumed, plus 4 reference frames for the DPB. |
| 115 | # shellcheck disable=SC2086 |
| 116 | |
| 117 | |
| 118 | # HEVC with B frames, for the same reason on the reference-picture-set side. |
| 119 | # shellcheck disable=SC2086 |
| 120 | |
| 121 | |
| 122 | |
| 123 | # AV1 with a hidden ALTREF: forward keyframe + show_existing_frame headers. |
| 124 | # shellcheck disable=SC2086 |
| 125 | |
| 126 | |
| 127 | |
| 128 |