feat(advice): time intervalometer sequences adaptively and list unreadable frames once

The MakerNote interval-shooting hint (Panasonic TimerRecording) is kept as
FrameFlags.Intervalometer from indexing on, so it reaches the sidecar, the
index, sync and the protocol. When most frames carry it, gaps in the
cadence are the intervalometer's deliberate pauses and the advisor picks
adaptive timing (Advisor.Reason.Timing.Intervalometer, BRIEF §10.3).

Frames both analyses find undecodable are now one finding over the union
of both lists at the higher severity: the deep pass also lists missing,
corrupt and beyond-this-host frames, which the light analysis never flags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 11:17:38 +00:00
1 parent 4d321a84b0
commit 366dd9f303
9 files changed
+47 -11

No files matched your search

+20 -5
View File
@@ -16,17 +16,32 @@ public static class Advisor
{
/// <summary>
/// Recommendations for every parameter the rules cover (see <see cref="AdvisorRules"/>), in section order, plus
/// every finding of both analyses; a finding both report (frames that cannot be decoded: the light analysis reads
/// the flags the deep pass recorded) is listed once, as the light analysis has it. Without a deep report,
/// pixel-based parameters get missing-data recommendations.
/// every finding of both analyses. Frames that cannot be decoded are reported by both (the light analysis reads the
/// undecodable flags, the deep pass also counts missing and corrupt files and those beyond this host's decoders):
/// they are listed once, over the union of both lists, at the higher severity. Without a deep report, pixel-based
/// parameters get missing-data recommendations.
/// </summary>
public static AdvisorResult Recommend(LightAnalysisReport light, DeepAnalysisReport? deep, SequenceContext context)
{
ArgumentNullException.ThrowIfNull(light);
ArgumentNullException.ThrowIfNull(context);
var findings = new List<Finding>(light.Findings);
var lightKeys = light.Findings.Select(f => f.Key).ToHashSet(StringComparer.Ordinal);
if (deep is not null) findings.AddRange(deep.Findings.Select(f => f.ToFinding()).Where(f => !lightKeys.Contains(f.Key)));
foreach (var finding in deep?.Findings.Select(f => f.ToFinding()) ?? [])
{
var shared = finding.Key == DeepFindingKeys.UnreadableFrames ? findings.FindIndex(f => f.Key == finding.Key) : -1;
if (shared < 0)
{
findings.Add(finding);
continue;
}
var unreadable = light.UndecodableFrames.Union(deep!.Issues.Undecodable).Order().ToList();
findings[shared] = findings[shared] with
{
Severity = (FindingSeverity)int.Max((int)findings[shared].Severity, (int)finding.Severity),
Arguments = [unreadable.Count],
Frames = [.. unreadable.Take(Finding.MaxFrames)],
};
}
return new AdvisorResult(new AdvisorRules(light, deep, context).Run(), findings);
}
+1
View File
@@ -19,6 +19,7 @@ public static class AdvisorKeys
public static string TimingSessions { get; } = LocKey("Advisor.Reason.Timing.Sessions");
public static string TimingIrregular { get; } = LocKey("Advisor.Reason.Timing.Irregular");
public static string TimingIntervalometer { get; } = LocKey("Advisor.Reason.Timing.Intervalometer");
public static string TimingSparseGapsSmooth { get; } = LocKey("Advisor.Reason.Timing.SparseGapsSmooth");
public static string TimingSparseGaps { get; } = LocKey("Advisor.Reason.Timing.SparseGaps");
public static string TimingManyGaps { get; } = LocKey("Advisor.Reason.Timing.ManyGaps");
+12 -5
View File
@@ -185,11 +185,13 @@ internal sealed class AdvisorRules
/// <summary>
/// Timing mode, in order: several capture sessions (pauses ≥ the session gap) → Adaptive; jitter above 10 % of the
/// median interval → Adaptive; gaps that are sparse (≤ 2 % of intervals, each ≤ 10 × median) with smooth measured
/// motion (95th percentile ≤ 1 % of the long edge per frame) → Interpolated, or Constant when motion is unknown or
/// fast; denser gaps → Adaptive; otherwise Constant. Frame rate, in order: "fit to N s" target → the standard rate
/// nearest frames/N; under 240 frames → 24 (clip ≥ 10 s); over 10 min at 30 fps → 60; several sessions → 30; fast
/// motion (≥ 1 % of the long edge per frame) → 24; measured moderate motion (≥ 0.2 %) → 24; otherwise 30.
/// median interval → Adaptive; gaps in a sequence the camera's own intervalometer shot (most frames carry its
/// MakerNote hint), so its pauses were deliberate → Adaptive; gaps that are sparse (≤ 2 % of intervals, each ≤ 10 ×
/// median) with smooth measured motion (95th percentile ≤ 1 % of the long edge per frame) → Interpolated, or Constant
/// when motion is unknown or fast; denser gaps → Adaptive; otherwise Constant. Frame rate, in order: "fit to N s"
/// target → the standard rate nearest frames/N; under 240 frames → 24 (clip ≥ 10 s); over 10 min at 30 fps → 60;
/// several sessions → 30; fast motion (≥ 1 % of the long edge per frame) → 24; measured moderate motion (≥ 0.2 %) →
/// 24; otherwise 30.
/// </summary>
private void Timing()
{
@@ -222,6 +224,11 @@ internal sealed class AdvisorRules
_timing = TimingMode.Adaptive;
Add(section, parameter, _timing, 0.7, AdvisorKeys.TimingIrregular, R(jitter, 2), R(median, 2));
}
else if (gaps.Count > 0 && 2 * _light.IntervalometerFrames > _light.FrameCount)
{
_timing = TimingMode.Adaptive;
Add(section, parameter, _timing, 0.8, AdvisorKeys.TimingIntervalometer, gaps.Count);
}
else if (gaps.Count > 0)
{
var sparse = gaps.Count <= double.Max(1, 0.02 * _light.Intervals.Count) && gaps.All(g => g.Seconds <= 10 * median);
@@ -137,5 +137,8 @@ public sealed record LightAnalysisReport
/// <summary>Frames that nothing decodes (format tier 3): renders skip them.</summary>
public IReadOnlyList<int> UndecodableFrames { get; init; } = [];
/// <summary>Frames the camera's own interval-shooting mode took (MakerNote hint, <see cref="Model.FrameFlags.Intervalometer"/>).</summary>
public int IntervalometerFrames { get; init; }
public IReadOnlyList<Finding> Findings { get; init; } = [];
}
@@ -61,6 +61,7 @@ public static class LightAnalyzer
DayPhases = phases,
PreviewOnlyFrames = previewOnly,
UndecodableFrames = undecodable,
IntervalometerFrames = frames.Count(f => (f.Flags & FrameFlags.Intervalometer) != 0),
Findings = findings,
};
}
+2 -1
View File
@@ -14,7 +14,7 @@ public static class SequenceFrames
return byTime != 0 ? byTime : string.CompareOrdinal(a.File, b.File);
});
/// <summary>A frame record from light metadata.</summary>
/// <summary>A frame record from light metadata (with <see cref="FrameFlags.Intervalometer"/> when the MakerNote says so).</summary>
/// <param name="file">Path relative to the sequence folder.</param>
/// <param name="fallbackCapture">Used when the file records no capture time of its own (only a file-system date).</param>
public static SidecarFrame FromMetadata(Guid id, string file, string? original, long size, string? sha256, FrameMetadata metadata,
@@ -45,6 +45,7 @@ public static class SequenceFrames
PreviewLength = metadata.LargestPreview?.Length,
PreviewW = Positive(metadata.LargestPreview?.Width),
PreviewH = Positive(metadata.LargestPreview?.Height),
Flags = metadata.IntervalShooting == true ? FrameFlags.Intervalometer : FrameFlags.None,
};
}
+6
View File
@@ -24,6 +24,12 @@ public enum FrameFlags
Undecodable = 32,
Black = 64,
White = 128,
/// <summary>
/// The camera's own interval-shooting or time-lapse mode took the frame (MakerNote hint, BRIEF §9): a capture fact,
/// not a problem; its pauses were deliberate (§10.3 adaptive timing).
/// </summary>
Intervalometer = 256,
}
[Flags]