feat(imaging): managed decoder provider, decoder chains and format tiers
ManagedDecoderProvider decodes JPEG/PNG/TIFF natively, DNG and the supported RAWs through RawDecoder, and falls back to the largest suitable embedded JPEG (oriented like the main image) for other RAWs, CR3, HEIF and unsupported bodies. Requests use JPEG DCT scaling, CFA binning when MaxLongEdge allows, bilinear demosaic for thumbnails and analysis, and ForcePreview. DecoderFactory builds the client (WIC then managed) and server chains and the per-format tier table; Probe gives the per-file tier without decoding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
9 files changed
+493
-8
No files matched your search
@@ -21,9 +21,10 @@ public sealed record RawDecodeOptions
|
||||
|
||||
public DemosaicQuality Quality { get; init; } = DemosaicQuality.Best;
|
||||
|
||||
/// <summary>Bin CFA blocks into RGB pixels instead of demosaicing: half size for Bayer, one third for X-Trans.
|
||||
/// Ignored for linear (already demosaiced) data and for patterns that cannot be binned.</summary>
|
||||
public bool Binning { get; init; }
|
||||
/// <summary>Target long edge (0 = full size). When the CFA can be binned (half size for Bayer, one third for X-Trans)
|
||||
/// and the binned image keeps at least this long edge, blocks are binned into RGB pixels instead of demosaiced. The
|
||||
/// result is not resized further; linear (already demosaiced) data is always developed at full size.</summary>
|
||||
public int MaxLongEdge { get; init; }
|
||||
|
||||
/// <summary>Rotate/flip according to the file's orientation.</summary>
|
||||
public bool ApplyOrientation { get; init; } = true;
|
||||
|
||||
@@ -87,7 +87,8 @@ internal static class RawDeveloper
|
||||
if (stage.Cfa is { } cfa)
|
||||
{
|
||||
ScaleMosaic(stage.Pixels, cfa, wb, dop, cancellationToken);
|
||||
var bin = options.Binning ? cfa.BinSize : 0;
|
||||
var bin = cfa.BinSize;
|
||||
if (options.MaxLongEdge <= 0 || int.Max(stage.Width, stage.Height) / int.Max(bin, 1) < options.MaxLongEdge) bin = 0;
|
||||
if (bin > 0)
|
||||
{
|
||||
rgb = Demosaic.Bin(stage.Pixels, cfa, bin, dop, cancellationToken);
|
||||
|
||||
Reference in new issue
Block a user