fix(imaging): record decode tiers per frame and keep undecodable frames out of renders
BRIEF §8.2 tiers 2 and 3 had no writer: PreviewOnly and Undecodable were never set, so the advisor could not cap the output at the preview size and one unreadable frame failed a whole render. - ImageDecoder.Probe names a file's tier without decoding it (JPEG, PNG and TIFF without opening the file); the light analysis probes frames whose tier is unknown, and the deep analysis, renders from originals and thumbnail/proxy passes record what decoding actually found (FrameTiers). Sidecar frames gain "tier", "previewW" and "previewH"; the index gains frames.preview_width/height and sequences.preview_only_count (migration 0005, SQLite and PostgreSQL). - SequenceContext takes the preview size from preview-only frames, so the advisor's output cap applies; the light analysis reports format tiers (preview-only frames as information, undecodable ones as a warning under the deep analysis' key, listed once); a sequence that gains undecodable frames warns at once. - Only a file in a format the host decodes natively is flagged undecodable; files beyond the host's decoders keep their tier without the flag, so render nodes and proxies can still supply them. - A frame that stops decoding during a render is replaced by its nearest planned neighbour and logged instead of failing the job; the render fails only when no planned frame decodes. - The Library card shows a preview-only chip with the count (local and server sequences: SequenceDto.PreviewOnlyCount, FrameDto preview size). - GoPro GPR decodes through the JPEG the camera writes beside it when that is larger than the embedded preview (BRIEF §8.1). - Thumbnails use a stored embedded preview only when it reaches 320 px; a smaller one sends the frame through the host's decoders instead (BRIEF §8.5). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
48 files changed
+1132
-87
No files matched your search
@@ -6,6 +6,7 @@ using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Core.Project;
|
||||
using Titano.Core.Render;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Jobs;
|
||||
|
||||
namespace Titano.Data.Processing.Jobs;
|
||||
@@ -14,14 +15,15 @@ namespace Titano.Data.Processing.Jobs;
|
||||
/// <see cref="JobKind.Render"/> on this machine (BRIEF §11.5): target = the sequence; parameters = Protocol
|
||||
/// <c>RenderJobParameters</c> whose preset JSON is the export section of a project (preset, overrides, name template,
|
||||
/// folder, batch). The project is the embedded one or the sequence's own; frames flagged missing, corrupt, excluded or
|
||||
/// undecodable are left out. The preset and every batch preset render after one preparation pass into the sequence's
|
||||
/// <c>exports/</c> (or the export folder, never on a server), named by the template without taking a name another render
|
||||
/// of this process is writing, and each finished output is recorded at once (its row id derives from the job and the
|
||||
/// entry, so every attempt knows what is recorded). Checkpoint: the entries recorded and the output being written, so a
|
||||
/// crashed attempt's leftovers are removed and only unfinished entries render again. A failed entry fails the job after
|
||||
/// the others ran; retrying renders it alone.
|
||||
/// undecodable are left out, and a frame found undecodable while rendering is shown as its nearest neighbour, logged
|
||||
/// and (when the originals were read) flagged so later renders leave it out (BRIEF §8.2). The preset and every batch
|
||||
/// preset render after one preparation pass into the sequence's <c>exports/</c> (or the export folder, never on a
|
||||
/// server), named by the template without taking a name another render of this process is writing, and each finished
|
||||
/// output is recorded at once (its row id derives from the job and the entry, so every attempt knows what is recorded).
|
||||
/// Checkpoint: the entries recorded and the output being written, so a crashed attempt's leftovers are removed and only
|
||||
/// unfinished entries render again. A failed entry fails the job after the others ran; retrying renders it alone.
|
||||
/// </summary>
|
||||
internal sealed class RenderJobHandler(TitanoDatabase db, ProcessingOptions options) : IJobHandler
|
||||
internal sealed class RenderJobHandler(TitanoDatabase db, ProcessingOptions options, FrameTiers tiers) : IJobHandler
|
||||
{
|
||||
public JobKind Kind => JobKind.Render;
|
||||
|
||||
@@ -64,7 +66,7 @@ internal sealed class RenderJobHandler(TitanoDatabase db, ProcessingOptions opti
|
||||
|
||||
var frames = await SequenceFrames.LoadAsync(db, archive, sequence, parameters.UseProxies, cancellation).ConfigureAwait(false);
|
||||
IReadOnlyList<TargetOutcome> outcomes;
|
||||
await using (var render = new SequenceRender(frames, project, SequenceAnalyser.ReadReport(folder, frames.Count), options))
|
||||
await using (var render = new SequenceRender(frames, project, SequenceAnalyser.ReadReport(folder, frames.Count), options, originals: !parameters.UseProxies))
|
||||
{
|
||||
outcomes = await render.RenderAllAsync(
|
||||
targets,
|
||||
@@ -87,6 +89,20 @@ internal sealed class RenderJobHandler(TitanoDatabase db, ProcessingOptions opti
|
||||
},
|
||||
context.ReportAsync,
|
||||
cancellation).ConfigureAwait(false);
|
||||
if (render.StandIns.Count > 0)
|
||||
context.Log(Loc.L("Export.Log.StandIns", string.Join(", ", render.StandIns.Select(i => (i + 1).ToString(Loc.Culture)))));
|
||||
// Recorded without the job's token: what decoding found holds even if the job is cancelled meanwhile, and a
|
||||
// sidecar that cannot be written now only leaves it to the next analysis or render.
|
||||
try
|
||||
{
|
||||
var decoded = render.Decoded.ToDictionary(kv => frames.Frames[kv.Key].Id, kv => kv.Value);
|
||||
await tiers.RecordAsync(archive, sequence, decoded, CancellationToken.None).ConfigureAwait(false);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or LeaseUnavailableException
|
||||
or ArchiveOfflineException)
|
||||
{
|
||||
Core.Diagnostics.Log.Warning("processing", $"The decode tiers of {sequence.DisplayTitle} could not be recorded", ex);
|
||||
}
|
||||
}
|
||||
var failed = outcomes.Where(o => o.Error is not null).ToList();
|
||||
foreach (var outcome in failed) context.Log(Loc.L("Export.Log.Failed", outcome.Target.PresetName, outcome.Error));
|
||||
|
||||
Reference in new issue
Block a user