fix: stalled jobs, editor cancellation stops and GoPro DNG decoding

Owner review 1, phase 1 (docs/requests/2026-10-15-owner-review-1.md).

Thumbnail and proxy jobs over several sequences counted sequences while
they checkpointed inside one: the rate decayed until the time left
overflowed TimeSpan, the job failed while publishing progress and again
while saving it, and stayed Running. The throughput is now seeded by the
first window with progress, the time left is bounded (JobEta), saving
progress never throws, image passes count frames, and job speeds use the
right unit (bytes for verify and import).

The debugger stops in WicDecoderProvider.cs when presets changed were
cancelled preview decodes leaving synchronous thread-pool delegates; the
editor's sources, LatestRunner and the render node's proxy task now keep
them in their own tasks, and a cancellation is never an unreadable frame.

GoPro DNGs converted by Adobe software were classified GPR and read only
through their 8-bit preview, and Windows' preview-only DNG decoder was
reported as a native decode. A DNG is GPR only when its raw image is
VC-5, WIC decodes RAW only through the Raw Image Extension and never DNG,
analyses and previews take an adequate embedded preview by choice while
renders develop natively, and frames already indexed as GPR are
reclassified by the next light analysis.

Also records the owner's request (docs/requests), the BRIEF amendments
(§8.1, §8.2, new §24), DECISIONS, CHANGELOG, STATUS and ARCHITECTURE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-16 10:20:26 +02:00
1 parent 19265b36c2
commit 34d03051f5
77 files changed
+785 -94

No files matched your search

@@ -59,8 +59,11 @@ public static class SequenceFrames
/// tier is kept and <see cref="FrameFlags.Undecodable"/> is left as it was.</param>
/// <param name="proxied">Whether the host takes the frame's pixels from its proxy (an original it cannot decode, whose
/// proxy is there): see <see cref="WithProxy"/>.</param>
/// <remarks>A probe reads the file's signature again: the format it found replaces a stored one that is out of date
/// (GoPro DNGs converted by Adobe software were stored as GPR before owner review 1).</remarks>
public static SidecarFrame WithTier(SidecarFrame frame, FileTier tier, bool damaged = true, bool proxied = false)
{
if (tier.Format != ImageFileFormat.Unknown && tier.Format != frame.Format) frame = frame with { Format = tier.Format };
var flags = frame.Flags & ~(FrameFlags.PreviewOnly | FrameFlags.Undecodable);
if (tier.Tier == DecodeTier.EmbeddedPreview) flags |= proxied ? FrameFlags.None : FrameFlags.PreviewOnly;
else if (tier.Tier == DecodeTier.Unavailable) flags |= damaged ? FrameFlags.Undecodable : frame.Flags & FrameFlags.Undecodable;
+13
View File
@@ -97,6 +97,19 @@ internal static class DngReader
if (total * 8 < samples) throw new InvalidDataException("DNG: image data too short for the raster");
}
/// <summary>
/// True when the full-resolution raw image of the DNG <paramref name="r"/> reads is VC-5 compressed (Compression 9,
/// GoPro's GPR), which no managed decoder handles; false for every other DNG, a GoPro one converted by Adobe software
/// (lossless JPEG or lossy LinearRaw) included, and when no raw image is found.
/// </summary>
internal static bool IsVc5(TiffReader r)
{
var chain = r.ReadChain();
return chain.Count > 0 && FindRawIfd(r, chain) is { } raw && r.GetUInt(raw, TiffTags.Compression) == Vc5Compression;
}
private const uint Vc5Compression = 9;
/// <summary>First IFD with NewSubfileType 0 and a CFA/LinearRaw photometric: IFD0, its SubIFDs (two levels), the chain.</summary>
private static Ifd? FindRawIfd(TiffReader r, IReadOnlyList<Ifd> chain)
{
@@ -166,6 +166,9 @@ public sealed class ManagedDecoderProvider : IImageDecoderProvider
private static DecodedImage? Raw(Stream stream, ImageFileFormat format, DecodeRequest request, CancellationToken cancellationToken)
{
if (request.PreferPreview && !request.ForcePreview && request.MaxLongEdge > 0 && RawDecoder.Formats.Contains(format)
&& Preview(stream, request, adequateOnly: true, cancellationToken) is { } quick)
return quick.AsChoice();
if (!request.ForcePreview && RawDecoder.Formats.Contains(format))
{
try
+17 -2
View File
@@ -32,6 +32,10 @@ public enum DecodePurpose
/// <param name="ForcePreview">Use the embedded preview even when native decode is possible (fast paths).</param>
/// <param name="Companion">The JPEG a GoPro wrote with this GPR when it is kept elsewhere than beside it (an import puts
/// it in a sequence of its own); null looks beside the file. Other formats ignore it.</param>
/// <param name="PreferPreview">For a RAW file: use an embedded preview whose long edge reaches <paramref name="MaxLongEdge"/>
/// when there is one, and decode natively otherwise. Analyses, thumbnails, proxies and the editor's preview ask for it
/// (fast); renders never do. The result is marked <see cref="DecodedImage.ByChoice"/>, so it never makes the frame
/// preview-only (R4, owner review 1).</param>
public sealed record DecodeRequest(
string Path,
int MaxLongEdge = 0,
@@ -39,14 +43,22 @@ public sealed record DecodeRequest(
bool ApplyOrientation = true,
bool AllowPreview = true,
bool ForcePreview = false,
string? Companion = null);
string? Companion = null,
bool PreferPreview = false);
/// <summary>Decoded pixels plus how they were produced. Dispose to return the buffer to the pool.</summary>
public sealed class DecodedImage(ImageBuffer pixels, DecodeTier tier, string decoder, int sourceWidth, int sourceHeight) : IDisposable
public sealed class DecodedImage(ImageBuffer pixels, DecodeTier tier, string decoder, int sourceWidth, int sourceHeight, bool byChoice = false) : IDisposable
{
public ImageBuffer Pixels { get; } = pixels;
public DecodeTier Tier { get; } = tier;
/// <summary>
/// The pixels come from an embedded preview the request preferred (<see cref="DecodeRequest.PreferPreview"/>) although
/// the file may decode natively: <see cref="Tier"/> says how these pixels were made, not what the frame can give, so it
/// is not recorded as the frame's tier.
/// </summary>
public bool ByChoice { get; } = byChoice;
/// <summary>Short provider/decoder name for logs ("wic", "managed-jpeg", "managed-dng").</summary>
public string Decoder { get; } = decoder;
@@ -56,6 +68,9 @@ public sealed class DecodedImage(ImageBuffer pixels, DecodeTier tier, string dec
public int SourceHeight { get; } = sourceHeight;
public void Dispose() => Pixels.Dispose();
/// <summary>The same pixels marked <see cref="ByChoice"/> (the returned image owns them; do not dispose this one).</summary>
internal DecodedImage AsChoice() => new(Pixels, Tier, Decoder, SourceWidth, SourceHeight, byChoice: true);
}
/// <summary>Tier a provider would use for one specific file, with the reason when it is not native.</summary>
+3 -1
View File
@@ -119,8 +119,10 @@ public static class ImageSignature
var reader = TiffReader.Open(stream);
var ifd0 = reader?.ReadIfd(reader.FirstIfdOffset);
var make = reader is not null && ifd0 is not null ? IfdValue.String(reader, ifd0, TiffTags.Make) : null;
// A GoPro DNG is GPR only when its raw image is VC-5: one converted by Adobe software (Lightroom, DNG Converter) is
// an ordinary DNG the managed DNG decoder develops (R4, owner review 1).
if (ifd0?.Has(TiffTags.DngVersion) == true)
return extension == ImageFileFormat.Gpr || make?.StartsWith("GoPro", StringComparison.OrdinalIgnoreCase) == true ? ImageFileFormat.Gpr : ImageFileFormat.Dng;
return extension == ImageFileFormat.Gpr || Codecs.Dng.DngReader.IsVc5(reader!) ? ImageFileFormat.Gpr : ImageFileFormat.Dng;
if (extension == ImageFileFormat.Tiff) return ImageFileFormat.Tiff;
var byMake = ByMake(make, extension);
if (byMake != ImageFileFormat.Unknown) return byMake;