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:
9 files changed
+47
-11
No files matched your search
@@ -97,6 +97,7 @@
|
||||
<data name="Advisor.Reason.Stabilize.Smoothing" xml:space="preserve"><value>Smoothing the camera path over {0} frames removes shake and keeps deliberate pans.</value><comment>{0} smoothing sigma in frames</comment></data>
|
||||
<data name="Advisor.Reason.Strength.Full" xml:space="preserve"><value>Strong flicker ({0} EV): every frame lands on the smooth curve.</value><comment>{0} RMS flicker in EV</comment></data>
|
||||
<data name="Advisor.Reason.Strength.Partial" xml:space="preserve"><value>Mild flicker ({0} EV): reliable frames keep 20% of their own variation.</value><comment>{0} RMS flicker in EV</comment></data>
|
||||
<data name="Advisor.Reason.Timing.Intervalometer" xml:space="preserve"><value>The camera's intervalometer shot this sequence, so its pauses were deliberate (gaps: {0}): adaptive timing keeps them short and the pace even.</value><comment>{0} gap count</comment></data>
|
||||
<data name="Advisor.Reason.Timing.Irregular" xml:space="preserve"><value>Intervals vary by {0} s around {1} s: adaptive timing follows the capture clock so motion stays even.</value><comment>{0} interval jitter in seconds; {1} median interval in seconds</comment></data>
|
||||
<data name="Advisor.Reason.Timing.ManyGaps" xml:space="preserve"><value>{0} gaps in the cadence: adaptive timing keeps the output pace true to capture time.</value><comment>{0} gap count</comment></data>
|
||||
<data name="Advisor.Reason.Timing.Regular" xml:space="preserve"><value>Steady {0} s interval (jitter {1} s): each photo becomes one video frame.</value><comment>{0} median interval in seconds; {1} jitter in seconds</comment></data>
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
<data name="Advisor.Reason.Stabilize.Smoothing" xml:space="preserve"><value>Smussare il percorso della fotocamera su {0} fotogrammi elimina la vibrazione e conserva le panoramiche volute.</value></data>
|
||||
<data name="Advisor.Reason.Strength.Full" xml:space="preserve"><value>Sfarfallio forte ({0} EV): ogni fotogramma viene portato sulla curva regolare.</value></data>
|
||||
<data name="Advisor.Reason.Strength.Partial" xml:space="preserve"><value>Sfarfallio lieve ({0} EV): i fotogrammi affidabili conservano il 20% della propria variazione.</value></data>
|
||||
<data name="Advisor.Reason.Timing.Intervalometer" xml:space="preserve"><value>La sequenza è stata scattata dall'intervallometro della fotocamera, quindi le pause sono volute (pause: {0}): la temporizzazione adattiva le accorcia e mantiene il ritmo.</value></data>
|
||||
<data name="Advisor.Reason.Timing.Irregular" xml:space="preserve"><value>Gli intervalli variano di {0} s attorno a {1} s: la temporizzazione adattiva segue l'orario di scatto e rende il movimento uniforme.</value></data>
|
||||
<data name="Advisor.Reason.Timing.ManyGaps" xml:space="preserve"><value>{0} pause nella cadenza: la temporizzazione adattiva mantiene il ritmo fedele all'orario di scatto.</value></data>
|
||||
<data name="Advisor.Reason.Timing.Regular" xml:space="preserve"><value>Intervallo costante di {0} s (variazione {1} s): ogni foto diventa un fotogramma del video.</value></data>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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]
|
||||
|
||||
Reference in new issue
Block a user