-
Notifications
You must be signed in to change notification settings - Fork 144
Avif #674
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
… (and gif upgraded to 0.14)
…iven an opaque canvas color
…from a lossless format, even if lossless=None instead of Keep. . For lossy+transparent, choose avif>webp>png, for lossless, choose webp>png>avif. If jpeg disabled, try webp before avif/png/gif.
…re reading output buffers. Required for gif to write trailing segment.
…onToken; add instrumentation hooks in debug mode, and tests that test every possible cancellation point.
… ErrorKind::InternalError, "Maximum graph passes exceeded ({}>{}) instead
…e when given an opaque canvas color" This reverts commit 7da91c9.
…el presence (yes -> png etc, no -> jpeg etc)
…use png24 if there is no alpha.
…eg encoding, if a transparent matte color is provided, apply a final white matte.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds AVIF encoding support to imageflow, including a new AVIF encoder implementation, diagnostic data collection infrastructure, encoder finalization improvements, and comprehensive test coverage for format selection and AVIF encoding.
Key Changes:
- Implemented AVIF encoder with configurable quality, speed, and alpha quality parameters
- Added diagnostic data collection system for all encoders to track encoding parameters and results
- Enhanced encoder lifecycle with finalization support via
into_io()method - Improved format selection logic with preview and legacy modes
Reviewed changes
Copilot reviewed 37 out of 38 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| imageflow_types/src/lib.rs | Added AvifEncoderHints struct, Display traits for Color types, diagnostic_data field to EncodeResult, and enhanced BoolKeep resolution logic |
| imageflow_core/src/codecs/avif_encoder.rs | New AVIF encoder implementation using ravif library with quality/speed controls |
| imageflow_core/src/codecs/diagnostic_collector.rs | New diagnostic data collection utility for encoder telemetry |
| imageflow_core/src/codecs/mod.rs | Added into_io() method to Encoder trait and encoder finalization infrastructure |
| imageflow_riapi/src/ir4/encoder.rs | Updated allowed formats handling and added AVIF encoder hints mapping |
| imageflow_riapi/src/ir4/parsing.rs | Added AVIF-related IR4 keys and test coverage |
| imageflow_core/tests/smoke.rs | Comprehensive format selection integration tests with magic byte verification |
| imageflow_core/tests/visuals.rs | New AVIF encoding smoke tests and transparent canvas test |
| imageflow_tool/Cargo.toml | Updated zip dependency from 2.3.0 to 6.0.0 |
| Cargo.toml | Updated libwebp-sys patch and libpng-sys repository |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…g. Introduce new image sources, improve parallel processing, and update logging to include file sizes. Implement formula comparisons for quality adjustments based on calibration results.
…pr x viewing condition via DSSIM, to allow for useful and human-friendly quality profile settings.
Key fixes: - Use encode metadata for dimensions (workaround for decode metadata bug) - Start quality range at 1 instead of 0 (AVIF encoder requires >= 1) - Change MIN_REFERENCE_SCALE to MIN_REFERENCE_DIM (200px minimum) - Simplify prepare_references to always use Constrain::Within - Add per-codec versioning (MOZJPEG_VERSION, WEBP_VERSION, AVIF_VERSION) - Rename Codec::Jpeg to Codec::Mozjpeg for future jpegli support This version produced 159,744 measurements (v2 output). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
- quality_analysis.rs: New perceptual quality analysis with: - Perceptibility zones (Imperceptible/Marginal/Subtle/Noticeable/Degraded) - Diminishing returns analysis for quality upper bounds - Cross-codec equivalence mapping (MozJPEG → WebP/AVIF) - Multi-percentile reporting (P45/P50/P75/P90) - Viewing condition modeling (desktop/laptop/phone PPD) - calibration_analysis.rs: Fix percentile() to use linear interpolation matching numpy/Excel behavior (R-7 method) - codec_calibration.rs: Suppress dead_code warning for decode_to_jpeg100 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Major restructuring with modular, tested components: ## Configuration Types - ViewingCondition struct with standard conditions module - DssimBucket enum with perceptibility thresholds - ReportConfig for customizable report generation - InterpolationConfig for polynomial fitting parameters ## Gap-Based Polynomial Interpolation - fit_power_law(): Grid search for q_out = a * q_in^b + c - fit_gap_polynomial(): Cross-validate by skipping points - compute_gap_polynomials(): Average adjacent fits for smoothness - GapPolynomial and InterpolationTable structs ## Statistical Helpers (all unit tested) - median, percentile (linear interpolation, R-7 method) - mean, trimmed_mean, std_dev, iqr ## Analysis Functions - analyze_diminishing_returns(): Quality step efficiency - find_codec_equivalence(): Cross-codec DSSIM matching - analyze_dssim_buckets(): Quality for each perceptibility level ## Reporting System - format_diminishing_returns_report() - format_dssim_bucket_table() with ppd+ratio columns - format_codec_equivalence_table() - run_analysis() unified entry point ## Unit Tests - 16 passing tests covering stats, interpolation, buckets, conditions 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Remove dependency on unpublished rgb 0.8.91 git version by adapting
code to work with rgb 0.8.52 (latest stable on crates.io).
Changes:
- Import BGR8/BGRA8 from rgb::alt:: instead of root
- Use Gray::value() instead of Gray::v (not available in 0.8.52)
- Use unsafe pointer casting for GrayA slices (no Pod impl in 0.8.52)
- Access GrayAlpha fields via .v/.a (available via Deref)
To revert when rgb 0.8.91+ is published to crates.io:
1. Search for TODO(rgb-0.8.91) comments
2. Uncomment rgb.git patch in root Cargo.toml
3. Change rgb version to "0.8.91" in imageflow_core/Cargo.toml
4. Revert bitmaps.rs imports to: use rgb::{..., Gray_v09 as Gray, BGR8, BGRA8, ...}
5. Replace unsafe GrayA casts with try_cast_slice/try_cast_slice_mut
6. Optionally simplify Gray access from .value() to .v
No description provided.