Document smart crop in IMPLEMENTATION.md

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
zyberzeroandClaude Opus 5.5 committed 2026-11-03 19:04:42 +01:00
1 parent 4695b65a1b
commit d910187c53
1 file changed
+8 -2
+8 -2
View File
@@ -105,16 +105,22 @@ Each type lives in `src/FrameProcessor/Domain/`. Tests in `tests/FrameProcessor.
### [x] 3.3 `IImagePipeline` + `ImagePipeline`
- Single method: `byte[] Process(Stream input, Frame frame)`.
- Steps (`SPEC.md` §3.2): decode → resize (cover/center-crop to oriented resolution) → dither against display palette → remap pixels display→device → rotate 90° CW if portrait → encode indexed PNG (`PngColorType.Palette`, smallest bit depth fitting the palette, `PaletteQuantizer(deviceColors)`).
- Steps (`SPEC.md` §3.2): decode → smart crop to oriented aspect (see 3.5) → resize to oriented resolution → dither against display palette → remap pixels display→device → rotate 90° CW if portrait → encode indexed PNG (`PngColorType.Palette`, smallest bit depth fitting the palette, `PaletteQuantizer(deviceColors)`).
- Output dimensions always match the frame's *declared* `width × height` regardless of orientation.
### [x] 3.4 `ImagePipelineTests` golden fixtures
- Check in `tests/FrameProcessor.Tests/Fixtures/inputs/` (landscape.jpg, portrait.jpg, tiny-1x1.png, non-divisible.jpg).
- Check in `tests/FrameProcessor.Tests/Fixtures/inputs/` (landscape.jpg, portrait.jpg, tiny-1x1.png, non-divisible.jpg, asymmetric-edges.jpg).
- Generate expected outputs once, commit under `Fixtures/expected/<algo>/<input>.png`.
- Assert byte-equality of produced PNG vs golden.
- Run for all four dithering algorithms against the canonical Spectra 6 palette.
- **DoD:** `dotnet test` green; deleting a fixture output and rerunning fails loud.
### [x] 3.5 Smart crop (`PLAN.md` "Smart cropping")
- `ISmartCropper` + `SaliencySmartCropper`: Sobel edge density on a 256 px analysis canvas, summed-area table, slide the max-fitting target-aspect window, keep the highest-energy position.
- Same-aspect inputs return full bounds; any exception logs a warning and falls back to the centered max-fitting crop.
- `ImagePipeline` applies the crop, then a pure `Resize` to the oriented resolution.
- **Tests:** `SaliencySmartCropperTests` (bias on both axes, edge-hugging subject, bounds/aspect); `asymmetric-edges.jpg` golden fixture.
---
## Phase 4 — Storage