edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | #!/usr/bin/env bash |
| 2 | # Still-image fixtures for ec-image's differential tests: every PNG colour |
| 3 | # type and bit depth, both JPEG processes at each chroma layout, and both WebP |
| 4 | # bitstreams with and without alpha. |
| 5 | # |
| 6 | # The corpus is generated rather than committed, so the repository stays free |
| 7 | # of binaries and every machine can rebuild it: ImageMagick writes the PNG and |
| 8 | # JPEG variants, ffmpeg the WebP ones. |
| 9 | |
| 10 | |
| 11 | root="" |
| 12 | out="/fixtures/stills" |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | # Source pictures: one with smooth and hard content at even dimensions, one at |
| 22 | # odd dimensions (chroma subsampling and Adam7 both round there), and one with |
| 23 | # a real alpha channel. |
| 24 | # Seeded, so the corpus is byte-identical on every machine and a differential |
| 25 | # bar measured today still means the same thing tomorrow. |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | # --- PNG: every colour type, every bit depth, both interlace methods -------- |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | # Palette with a transparent entry, and a colour-keyed truecolour image. |
| 54 | |
| 55 | || |
| 56 | |
| 57 | || |
| 58 | |
| 59 | # --- JPEG: both processes, every chroma layout, restarts, EXIF ------------- |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | # --- WebP: lossy and lossless, with and without alpha ---------------------- |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | # A palette-friendly picture, so the lossless colour-indexing transform is |
| 86 | # exercised rather than only the predictor one. |
| 87 | |
| 88 | |
| 89 | |
| 90 | # An animation, which the decoder must refuse by name rather than decode. |
| 91 | # ffmpeg's libwebp_anim silently writes a single still here, so ImageMagick |
| 92 | # writes this one: its output really does carry ANIM/ANMF chunks. |
| 93 | |
| 94 | |
| 95 | # A second animation whose frames carry alpha and ask for dispose-to-background: |
| 96 | # the first one is opaque and disposes nothing, so it leaves the blending and |
| 97 | # the disposal rectangle untested. Lossless, so the frames are exact and the |
| 98 | # only thing the comparison can catch is the compositing. |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | # libwebp's own composited frames, through Pillow, as the reference for that |
| 109 | # animation: the `image` crate ignores the dispose-to-background flag, so it |
| 110 | # cannot be the oracle for the frame that follows a disposal. |
| 111 | if ; then |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | else |
| 123 | |
| 124 | fi |
| 125 | |
| 126 | # --- GIF: still, interlaced, transparent, odd-size, animated --------------- |
| 127 | # GIF is palette-only, so every source is quantised first; the differential bar |
| 128 | # is pixel-exact, which only means anything if both decoders see the same file. |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | # Three frames, each with its own delay, and a disposal method that clears the |
| 134 | # frame's rectangle -- the compositing path only runs when frames differ. |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | # --- BMP: every depth, both compressions, both row orders ------------------ |
| 140 | # ImageMagick writes the ordinary files; the shapes it has no switch for (16-bit |
| 141 | # bitfields, top-down rows, a 32-bit alpha channel, the 12-byte OS/2 header, |
| 142 | # and RLE4, which its RLE switch never chooses) are written by the helper. |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | # A BITMAPV5HEADER, whose 124 bytes carry the colour space fields a v3 file |
| 155 | # has no room for; ImageMagick writes one when asked for alpha. |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | # --- TIFF: both byte orders, four compressions, strips and tiles ----------- |
| 167 | # TIFF fixes almost nothing about its layout, so the corpus is a cross-product: |
| 168 | # each compression, each sample depth, both byte orders, strips and tiles, and |
| 169 | # both plane arrangements. ImageMagick writes all of them. |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | # The horizontal-differencing predictor, which is what an encoder reaches for |
| 177 | # when the compression is LZW or Deflate. |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | # Big-endian: the same picture with every field byte-swapped. |
| 183 | |
| 184 | |
| 185 | # Tiles rather than strips, and planes rather than interleaved samples. |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | # Depths: bilevel, 4-bit palette, 8-bit grey, 16-bit grey and 16-bit colour. |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | # The incumbent refuses a 4-bit palette outright, so ffmpeg -- which reads it -- |
| 196 | # writes the reference picture for that one fixture. |
| 197 | |
| 198 | # -alpha off, or ImageMagick attaches an alpha channel to a grey picture that |
| 199 | # has none, and a two-sample grey file is a shape the incumbent refuses. |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | # Alpha, which TIFF carries as a fourth sample plus an ExtraSamples tag: both |
| 206 | # the straight and the premultiplied tagging, neither of which ImageMagick will |
| 207 | # write on request. |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | # Small versions of each format, for the fuzz sweep: ten thousand mutations |
| 214 | # per format is only affordable on a picture that decodes in microseconds. |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 |