image_pack 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/README.md +13 -3
- data/ext/image_pack/image_pack.c +742 -263
- data/ext/image_pack/mozjpeg_sources.rb +5 -0
- data/ext/image_pack/vendor/mozjpeg/simd/arm/neon-compat.h +26 -0
- data/ext/image_pack/vendor/mozjpeg/transupp.c +2373 -0
- data/lib/image_pack/version.rb +1 -1
- data/lib/image_pack.rb +119 -5
- metadata +4 -73
- data/ext/image_pack/vendor/mozjpeg/croptest.in +0 -95
- data/ext/image_pack/vendor/mozjpeg/libjpeg.map.in +0 -11
- data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch32/jsimd_neon.S +0 -1200
- data/ext/image_pack/vendor/mozjpeg/simd/arm/aarch64/jsimd_neon.S +0 -2254
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolext-avx2.asm +0 -578
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolext-mmx.asm +0 -476
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolext-sse2.asm +0 -503
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolor-avx2.asm +0 -121
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolor-mmx.asm +0 -121
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jccolor-sse2.asm +0 -120
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgray-avx2.asm +0 -113
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgray-mmx.asm +0 -113
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgray-sse2.asm +0 -112
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgryext-avx2.asm +0 -457
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgryext-mmx.asm +0 -355
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcgryext-sse2.asm +0 -382
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jchuff-sse2.asm +0 -761
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcphuff-sse2.asm +0 -662
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcsample-avx2.asm +0 -388
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcsample-mmx.asm +0 -324
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jcsample-sse2.asm +0 -351
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolext-avx2.asm +0 -515
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolext-mmx.asm +0 -404
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolext-sse2.asm +0 -458
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolor-avx2.asm +0 -118
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolor-mmx.asm +0 -117
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdcolor-sse2.asm +0 -117
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmerge-avx2.asm +0 -136
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmerge-mmx.asm +0 -123
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmerge-sse2.asm +0 -135
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmrgext-avx2.asm +0 -575
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmrgext-mmx.asm +0 -460
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdmrgext-sse2.asm +0 -517
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdsample-avx2.asm +0 -760
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdsample-mmx.asm +0 -731
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jdsample-sse2.asm +0 -724
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctflt-3dn.asm +0 -318
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctflt-sse.asm +0 -369
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctfst-mmx.asm +0 -395
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctfst-sse2.asm +0 -403
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctint-avx2.asm +0 -331
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctint-mmx.asm +0 -620
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jfdctint-sse2.asm +0 -633
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctflt-3dn.asm +0 -451
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctflt-sse.asm +0 -571
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctflt-sse2.asm +0 -497
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctfst-mmx.asm +0 -499
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctfst-sse2.asm +0 -501
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctint-avx2.asm +0 -453
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctint-mmx.asm +0 -851
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctint-sse2.asm +0 -858
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctred-mmx.asm +0 -704
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jidctred-sse2.asm +0 -592
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jquant-3dn.asm +0 -230
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jquant-mmx.asm +0 -276
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jquant-sse.asm +0 -208
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jquantf-sse2.asm +0 -168
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jquanti-avx2.asm +0 -188
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jquanti-sse2.asm +0 -201
- data/ext/image_pack/vendor/mozjpeg/simd/i386/jsimdcpu.asm +0 -135
- data/ext/image_pack/vendor/mozjpeg/simd/mips/jsimd_dspr2.S +0 -4543
- data/ext/image_pack/vendor/mozjpeg/simd/mips/jsimd_dspr2_asm.h +0 -292
- data/ext/image_pack/vendor/mozjpeg/simd/mips64/jcsample.h +0 -28
- data/ext/image_pack/vendor/mozjpeg/simd/mips64/jsimd_mmi.h +0 -69
- data/ext/image_pack/vendor/mozjpeg/simd/mips64/loongson-mmintrin.h +0 -1334
- data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jcsample.h +0 -28
- data/ext/image_pack/vendor/mozjpeg/simd/powerpc/jsimd_altivec.h +0 -98
- data/ext/image_pack/vendor/mozjpeg/tjbenchtest.in +0 -256
- data/ext/image_pack/vendor/mozjpeg/tjbenchtest.java.in +0 -215
- data/ext/image_pack/vendor/mozjpeg/tjexampletest.in +0 -149
- data/ext/image_pack/vendor/mozjpeg/tjexampletest.java.in +0 -151
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f474c5c23864c265a479c5c711277dc2c3b42dc43217b17822cf6e6aef86a26
|
|
4
|
+
data.tar.gz: 9f60517520b04ee7a0ca6a69f20b821a1c8603b58b1491f0319edb9732466942
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7b78d6fd999b204c36e843eac3b07867219a774e5590b8a0e59ac93a4f1af684bf241b7ea3622a2daa4de7b05e2f217595821ac149944420659befdcb896e82b
|
|
7
|
+
data.tar.gz: 8721a5ec476e76a4d1ae667eac4730dce4b1e86971db413f7b1f60ea77d5d27ecff2d36382ea215857486a7bf85355f2bfd194fd41109a750f991f76af1a0f10
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.7
|
|
4
|
+
|
|
5
|
+
**Correctness**
|
|
6
|
+
|
|
7
|
+
- `optimize_jpeg(progressive: false)` now explicitly disables `JBOOLEAN_OPTIMIZE_SCANS`. The previous path cleared `scan_info` but left mozjpeg's max-compression scan search enabled, which ran `memcpy(NULL, 0)` in `select_scans`.
|
|
8
|
+
- `optimize_jpeg(progressive: true)` now enables scan optimization explicitly instead of inheriting it from `jpeg_set_defaults`.
|
|
9
|
+
- Marker bombs are rejected before `jpeg_read_header` (and again when copying markers). The budget only counts marker types that will actually be saved for the current `strip_metadata` / `strip_icc` flags. APP1/APP2 profile chains allow up to 256 segments; other saved markers stay capped at 64. Combined payload stays at 8 MiB.
|
|
10
|
+
- Default `compress` (`strip_metadata: true`) keeps the ICC profile. Pass `strip_icc: true` to drop it.
|
|
11
|
+
- `mozjpeg_trellis: false` no longer disables overshoot deringing.
|
|
12
|
+
|
|
13
|
+
**API**
|
|
14
|
+
|
|
15
|
+
- `subsampling: :auto/:420/:422/:444` on `compress` / `compress_pixels`. For `algo: :size` / `:mozjpeg`, `:auto` uses 4:4:4 at quality >= 90, otherwise 4:2:0. `algo: :fast` / `:jpeg_turbo` keeps 4:2:0 unless `subsampling:` is set. The luma `min_ssim` guard still retries 4:4:4 before raising `QualityConstraintError`.
|
|
16
|
+
- `tune: :hvs/:ssim/:ms_ssim/:psnr` and `effort: :default/:fast/:max`.
|
|
17
|
+
- `scale:` decode-time downscale (`1`, `0.5`, `0.25`, `0.125`, Rational, or `[num, denom]`).
|
|
18
|
+
- `strip_icc:` on `compress` and `optimize_jpeg`.
|
|
19
|
+
- JPEG→JPEG `compress` uses a raw YCbCr path when chroma sampling can be preserved.
|
|
20
|
+
- `optimize_jpeg(strip_metadata: true)` losslessly applies EXIF Orientation via `transupp` when the transform is MCU-perfect. Otherwise it raises `UnsupportedError` instead of silently cropping. Pass `trim: true` to opt in to jpegtran-style edge trim.
|
|
21
|
+
|
|
22
|
+
**Distribution**
|
|
23
|
+
|
|
24
|
+
- `rake vendor` applies `patches/*.patch` after unpacking MozJPEG; `rake release:check` dry-runs them.
|
|
25
|
+
- Unused SIMD trees (`i386`, `mips`, `mips64`, `powerpc`, `aarch32`) are no longer packaged.
|
|
26
|
+
- Scalar builds emit a one-time runtime warning instead of failing install.
|
|
27
|
+
|
|
3
28
|
## 0.2.6
|
|
4
29
|
|
|
5
30
|
- Lowered the supported Ruby floor to `>= 2.7.1`. The core JPEG API, vendored MozJPEG build, `:direct`, and `:nogvl` execution modes work on Ruby 2.7.1.
|
data/README.md
CHANGED
|
@@ -55,6 +55,9 @@ ImagePack.compress_bytes(jpeg, min_ssim: 0.985)
|
|
|
55
55
|
ImagePack.compress_bytes(jpeg, progressive: false) # force baseline output
|
|
56
56
|
ImagePack.compress_bytes(jpeg, strict: true)
|
|
57
57
|
ImagePack.compress_bytes(jpeg, report: true)
|
|
58
|
+
ImagePack.compress_bytes(jpeg, subsampling: 444)
|
|
59
|
+
ImagePack.compress_bytes(jpeg, scale: 0.5) # decode-time 1/2, 1/4, or 1/8
|
|
60
|
+
ImagePack.compress_bytes(jpeg, tune: :hvs, effort: :max)
|
|
58
61
|
```
|
|
59
62
|
|
|
60
63
|
|
|
@@ -62,7 +65,13 @@ ImagePack.compress_bytes(jpeg, report: true)
|
|
|
62
65
|
|
|
63
66
|
`algo: :fast` / `:jpeg_turbo` keeps baseline output by default and remains the throughput path.
|
|
64
67
|
|
|
65
|
-
`min_ssim:` searches for the lowest acceptable quality using a fast native luma SSIM guard.
|
|
68
|
+
`min_ssim:` searches for the lowest acceptable quality using a fast native luma SSIM guard. The metric is luma-only; with `subsampling: :auto` (the default) a failed guard retries 4:4:4 before raising `QualityConstraintError`. Pass `subsampling: 420`, `422`, or `444` (or the symbols `:auto`, `:"420"`, `:"422"`, `:"444"`) to force chroma sampling. For `algo: :size` / `:mozjpeg`, `:auto` uses 4:4:4 at `quality >= 90` and 4:2:0 otherwise. `algo: :fast` / `:jpeg_turbo` keeps 4:2:0 unless you set `subsampling:` explicitly.
|
|
69
|
+
|
|
70
|
+
`strip_metadata: true` (the compress default) still keeps the ICC profile. Pass `strip_icc: true` to drop it. Existing JPEG→JPEG compress uses a planar YCbCr path when sampling can be preserved, so chroma is not upsampled and downsampled again.
|
|
71
|
+
|
|
72
|
+
`tune:` is one of `:hvs` (default), `:ssim`, `:ms_ssim`, `:psnr` — the cjpeg-style MozJPEG presets. `effort:` is `:default`, `:fast` (skips scan search unless `mozjpeg_scan_opt:` is passed), or `:max` (extra trellis loops + quant-table opt).
|
|
73
|
+
|
|
74
|
+
`scale:` is decode-time only (`1`, `0.5`, `0.25`, `0.125`, a Rational, or `[num, denom]`).
|
|
66
75
|
|
|
67
76
|
`strict: true` raises `ImagePack::InvalidImageError` on damaged/truncated JPEG warnings.
|
|
68
77
|
|
|
@@ -90,11 +99,11 @@ ImagePack.optimize_bytes(jpeg)
|
|
|
90
99
|
ImagePack.optimize_file("photo.jpg", output: "photo.optimized.jpg")
|
|
91
100
|
```
|
|
92
101
|
|
|
93
|
-
This rewrites JPEG coefficients without decoding and re-encoding pixels. It is the right path for existing JPEGs when you only want optimized Huffman tables and optional progressive scans.
|
|
102
|
+
This rewrites JPEG coefficients without decoding and re-encoding pixels. It is the right path for existing JPEGs when you only want optimized Huffman tables and optional progressive scans. `progressive: true` (the default) runs MozJPEG scan optimization (the jpegrescan-style search). Pass `progressive: false` for a baseline Huffman rewrite; that flag is applied explicitly and does not inherit the max-compression scan search.
|
|
94
103
|
|
|
95
104
|
Defaults: `progressive: true`, `strip_metadata: false`.
|
|
96
105
|
|
|
97
|
-
If `strip_metadata: true` would remove EXIF Orientation, `optimize_jpeg` raises `UnsupportedError` instead of
|
|
106
|
+
If `strip_metadata: true` would remove EXIF Orientation, `optimize_jpeg` applies a lossless coefficient rotate/flip when the image is MCU-aligned. If a rotate/flip would crop partial MCU edges, it raises `UnsupportedError` instead of trimming. Pass `trim: true` to allow jpegtran-style cropping. ICC is kept unless `strip_icc: true`.
|
|
98
107
|
|
|
99
108
|
## Raw pixels
|
|
100
109
|
|
|
@@ -186,6 +195,7 @@ bundle exec rake release:check
|
|
|
186
195
|
- JPEG only.
|
|
187
196
|
- Ruby `>= 2.7.1`; `execution: :offload` requires Ruby `>= 3.4`. On Ruby 2.7–3.3, `:auto` uses `:direct` or `:nogvl`; it never attempts scheduler offload.
|
|
188
197
|
- Pixel-level `compress` rejects CMYK/YCCK JPEG input; use `optimize_jpeg` for existing CMYK/YCCK JPEGs.
|
|
198
|
+
- `min_ssim` is luma-only. Color artifacts from 4:2:0 are not scored; use `subsampling:` or rely on the auto 4:4:4 retry (size profile).
|
|
189
199
|
- Arithmetic-coded JPEG support is disabled in `0.2.5`.
|
|
190
200
|
- Streaming output is not supported; file output uses atomic write-through-temp-file and rename.
|
|
191
201
|
- `ImagePack.compress(input, ...)` keeps a legacy path-vs-bytes heuristic; prefer explicit `*_bytes` / `*_file` helpers.
|