Release 2.6.3
Summary
- Binary Floyd–Steinberg dithering and repeated ThinPlateSpline crops take substantially less CPU time in the measured pipelines.
- Sparse SaltAndPepper updates sampled positions directly. Existing mask-based replay records still work.
- CPU NumPy-to-PyTorch conversion now uses Albucore’s shared bridge and copies read-only arrays before wrapping them as tensors.
Breaking changes
Upgrade workers that consume new sparse replay records
SaltAndPepper now records flat positions and a salt count in ReplayCompose when noise affects up to 16% of the spatial positions. Dense records still use two masks, and 2.6.3 accepts mask-based records from 2.6.2. Upgrade replay consumers to 2.6.3 before they receive the new sparse records. Continue passing the whole record to A.ReplayCompose.replay(record, image=image). #660
Performance
Dithering, repeated geometry, and sparse noise
- Dithering processes independent diagonals together for binary uint8 Floyd–Steinberg error diffusion. It keeps the original order of FP32 additions and uses the scalar loop on short diagonals. Binary random and ordered dithering also allocate fewer intermediate arrays. #646, #664
- ThinPlateSpline reuses grid bases for the two most recent eligible map shapes and control-point grids. The cache retains up to 16 MiB per process. Each call still samples its own deformation. PixelSpread builds coordinate maps from one-dimensional axes and writes into the final arrays. #647, #651
- SaltAndPepper applies sparse noise at the sampled positions without allocating and scanning two full masks. Dense noise still uses masks. The sampled positions and outputs matched bit for bit in the paired tests. #660
These are paired median times from the cited PRs on an Apple M4 Max with one CPU thread. Each row compares the implementation with its own PR baseline and covers the listed CPU workload.
| Workload | Before | After | Evidence |
|---|---|---|---|
| Resize RGB 480×640 to 224×224, then apply binary Floyd–Steinberg dithering | 29.64 ms/image | 2.96 ms/image | #646 |
| Crop RGB to 224×224, then apply warm-cache ThinPlateSpline with the default grid | 2.154 ms/image | 0.504 ms/image | #647 |
| Decoded RGB batch of 16 through 224×224 crop, sparse SaltAndPepper, ToTensorV2, and collation | 308.1 µs/image | 91.6 µs/image | #660 |
On Linux x86-64, the Floyd–Steinberg PR measured 8.1–11.8× speedups across nine Compose cases. ThinPlateSpline benefits most when the same grids recur. The SaltAndPepper PR also timed the full path starting from JPEGs on Python 3.11. Median savings fell to 10.1% on the M4 Max and 6.1% on the Linux Intel Xeon runner when read and decode were included. Dithering results, ThinPlateSpline results, SaltAndPepper results
Faster CPU paths for conversion, color, and noise
ToTensorV2,ToTensor3D, and CPU Tensor fallback use the Albucore NumPy–Torch bridge. Terminal transforms produce contiguous tensors. Fallback can retain compatible strided views. #650- ChannelSwap reverses RGB channels with one OpenCV operation per supported image or batch, including FP16 inputs whose bit patterns are preserved. Identity RGB orders return an independent copy directly. #648, #649, #654
- Equalize uses Albucore’s histogram kernels. Colorize uses a shared byte lookup for each output plane and reuses those planes across frames. #653, #655
- GaussNoise samples directly into a float32 buffer while preserving tested seed streams. Shared uint8 RGB noise no longer needs an expanded field for each channel in
GaussNoiseand AdditiveNoise. RGBShift picks up Albucore’s saturated uint8 RGB addition path. #656, #657, #661 - CLAHE equalizes the lightness plane in its work buffer. ColorJitter reuses the uint8 hue plane for lookup. ChromaticAberration and eligible multichannel JPEG ImageCompression assemble output with
cv2.merge. #658, #659, #662 - PlasmaBrightnessContrast and PlasmaShadow reuse Diamond–Square work buffers. Paired tests verified bitwise equality of generated maps and identical final RNG state. #663
Bug fixes
- CPU NumPy-to-Tensor conversion copies read-only storage before wrapping it. This prevents a returned tensor from writing into its read-only source array. Compatible writable arrays can still share storage. #650
Dependencies
- The Python and Conda manifests now pin Albucore 0.3.9 in place of 0.3.5. #661
Commits
| Commit | PR | Description |
|---|---|---|
beb6ab5 | #646 | Vectorize binary Floyd–Steinberg Dithering |
062ed3b | #647 | Cache ThinPlateSpline grid bases |
dd12884 | #648 | Speed up RGB channel reversal in images |
c7c1e50 | #649 | Reverse RGB channels in one batch operation |
4d994b0 | #650 | Adopt the Albucore CPU NumPy–Torch bridge |
9ede7cf | #655 | Use StringZilla byte lookup for Colorize |
6e9f133 | #654 | Copy RGB identity channel orders directly |
855bd83 | #653 | Delegate Equalize histogram kernels to Albucore |
97fc617 | #651 | Build PixelSpread maps without dense grids |
d1b6d0d | #656 | Fill Gaussian noise through a flat buffer |
2fa2d18 | #657 | Apply shared uint8 noise through Albucore |
bddb30d | #658 | Reuse the CLAHE lightness plane |
592c92e | #659 | Merge aberration and JPEG channels with OpenCV |
fdf3d43 | #660 | Apply sparse SaltAndPepper by index |
8df83e8 | #661 | Pin Albucore to 0.3.9 |
b0664b3 | #662 | Update the HSV hue plane in place |
1668e05 | #663 | Reuse Diamond–Square work buffers |
2b760df | #664 | Avoid binary dithering temporaries |
e494aeb | #665 | Bump to 2.6.3 and update the release inventory |