fix(imaging): record only what decoding proves and find GPR JPEGs across sequences
- Preview sizes come from probes and unscaled decodes: a size-limited decode picks the smallest preview that reaches its edge (CR3 PRVW 1620x1080), so renders and deep passes record its tier without a size and the output cap keeps the largest preview's. - A read error is not an undecodable file: ImageDecoder.Decode throws the IOException when a provider could not read the file and none produced pixels. Deep passes never flag frames they could not read or that vanished, and frames only an interrupted earlier run found undecodable are decoded again before they are flagged. - Renders resolve stand-ins only for frames the pipeline asks for; frames the read-ahead meets on the way (skipped by speed-ups) are left alone. - A GoPro GPR finds its JPEG in the index when an import or upload kept it in a sequence of its own (same original stem and capture time), for probes, deep analysis, renders, thumbnails, proxies and the editor; GPRs whose JPEG is indexed later are probed again. - Thumbnails judge an embedded preview by its own JPEG header. - PostgreSQL writes tier fields 1000 frames per statement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
19 files changed
+689
-111
No files matched your search
@@ -123,25 +123,43 @@ internal sealed class GateDecoder : IImageDecoderProvider
|
||||
Hold = ProcessingFixture.FileName(index);
|
||||
}
|
||||
|
||||
/// <summary>Tiers <see cref="Probe"/> reports per file name instead of the managed provider's (a host that reads them
|
||||
/// only as previews, or not at all).</summary>
|
||||
/// <summary>Tiers <see cref="Probe(string, ImageFileFormat)"/> reports per file name instead of the managed provider's (a
|
||||
/// host that reads them only as previews, or not at all).</summary>
|
||||
public ConcurrentDictionary<string, FileTier> Tiers { get; } = new();
|
||||
|
||||
/// <summary>Files (by name) whose decodes report the embedded-preview tier from a preview of this oriented size, as
|
||||
/// a size-limited decode that picked a smaller preview would.</summary>
|
||||
public ConcurrentDictionary<string, (int Width, int Height)> PreviewDecodes { get; } = new();
|
||||
|
||||
/// <summary>Files (by name) that cannot be read: their decodes throw <see cref="IOException"/> (a sharing violation).</summary>
|
||||
public ConcurrentDictionary<string, byte> Unreadable { get; } = new();
|
||||
|
||||
/// <summary>File name and decoder of every decode that produced pixels.</summary>
|
||||
public ConcurrentQueue<(string File, string Decoder)> Decoded { get; } = new();
|
||||
|
||||
public DecodeTier? TierFor(ImageFileFormat format) => _managed.TierFor(format);
|
||||
|
||||
public FileTier Probe(string path, ImageFileFormat format) =>
|
||||
Tiers.TryGetValue(Path.GetFileName(path), out var tier) ? tier : _managed.Probe(path, format);
|
||||
public FileTier Probe(string path, ImageFileFormat format) => Probe(path, format, null);
|
||||
|
||||
public FileTier Probe(string path, ImageFileFormat format, string? companion) =>
|
||||
Tiers.TryGetValue(Path.GetFileName(path), out var tier) ? tier : _managed.Probe(path, format, companion);
|
||||
|
||||
public DecodedImage? Decode(DecodeRequest request, CancellationToken cancellationToken = default)
|
||||
{
|
||||
Requests.Enqueue(request);
|
||||
if (Hold is { } hold && Path.GetFileName(request.Path) == hold && (HoldPurpose ?? request.Purpose) == request.Purpose
|
||||
var name = Path.GetFileName(request.Path);
|
||||
if (Hold is { } hold && name == hold && (HoldPurpose ?? request.Purpose) == request.Purpose
|
||||
&& (HoldEdge ?? request.MaxLongEdge) == request.MaxLongEdge)
|
||||
{
|
||||
Holding.TrySetResult();
|
||||
cancellationToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(30));
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
return _managed.Decode(request, cancellationToken);
|
||||
if (Unreadable.ContainsKey(name)) throw new IOException($"The process cannot access the file '{request.Path}' because it is being used by another process.");
|
||||
var decoded = _managed.Decode(request, cancellationToken);
|
||||
if (decoded is null) return null;
|
||||
Decoded.Enqueue((name, decoded.Decoder));
|
||||
if (!PreviewDecodes.TryGetValue(name, out var preview)) return decoded;
|
||||
return new DecodedImage(decoded.Pixels, DecodeTier.EmbeddedPreview, "test-preview", preview.Width, preview.Height);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user