E4: l'analisi non dice più «Fermo» di ciò che non ha visto

Filmati ripetuti, video tagliati o rovinati, neve e scritte piccole risultavano fermi; una scheda bianca in
dissolvenza in movimento; una scritta sul nero «tutto nero». Istanti a punti diversi, griglia fitta, bianco bruciato
per canale, fotogrammi mancanti e un solo fotogramma chiaro trattati a parte, errori del disco rilanciati.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 18:57:56 +01:00
1 parent 19119064f0
commit 9277e0a18c
6 files changed
+1008 -210

No files matched your search

+26 -4
View File
@@ -1,4 +1,5 @@
using System.Globalization;
using System.Text.RegularExpressions;
namespace Febe.Core.Export;
@@ -6,7 +7,7 @@ namespace Febe.Core.Export;
/// The instants, names and labels of frames (spec §4.10 «Fotogrammi», decisions D12 and D13 of tappa E3): which instants
/// a request asks for, the suffix a frame file gets, and how an instant is shown.
/// </summary>
public static class ExportFrames
public static partial class ExportFrames
{
/// <summary>The shortest step of «Uno ogni k secondi».</summary>
public static readonly TimeSpan MinEvery = TimeSpan.FromMilliseconds(100);
@@ -26,6 +27,16 @@ public static class ExportFrames
/// <summary>The suffix of the single frame of «Salva il fotogramma» (tappa E4).</summary>
public const string SingleSuffix = "_fotogramma";
/// <summary>
/// Whether the file of a frame copy has the name «Salva il fotogramma» gives (<see cref="SingleSuffix"/>, also with
/// « (2)» of a name already taken): the other ways end with <c>_t…</c> or <c>_f…</c>.
/// </summary>
public static bool IsSingleName(string? relativePath) =>
relativePath is not null && SingleName().IsMatch(Path.GetFileNameWithoutExtension(relativePath));
[GeneratedRegex("_fotogramma( \\(\\d+\\))?$", RegexOptions.CultureInvariant)]
private static partial Regex SingleName();
/// <summary>How many frames <paramref name="request"/> asks of a video of <paramref name="duration"/>.</summary>
public static long FrameCount(TimeSpan duration, ExportFramesRequest request)
{
@@ -160,9 +171,20 @@ public static class ExportFrames
/// <summary>An instant rounded up to the whole millisecond (never before the instant computed).</summary>
private static TimeSpan WholeMs(TimeSpan at) => TimeSpan.FromMilliseconds(ActualMs(at));
/// <summary>The identity of a frame's instant: its shown time in milliseconds, rounded up.</summary>
public static long ActualMs(TimeSpan shown) =>
shown <= TimeSpan.Zero ? 0 : (shown.Ticks + TimeSpan.TicksPerMillisecond - 1) / TimeSpan.TicksPerMillisecond;
/// <summary>
/// The identity of a frame's instant: its shown time in milliseconds, rounded up (a hostile time table reaches the
/// end of what a TimeSpan holds: the whole milliseconds of it, then).
/// </summary>
public static long ActualMs(TimeSpan shown)
{
if (shown <= TimeSpan.Zero)
{
return 0;
}
var (ms, rest) = Math.DivRem(shown.Ticks, TimeSpan.TicksPerMillisecond);
return Math.Min(ms + (rest > 0 ? 1 : 0), TimeSpan.MaxValue.Ticks / TimeSpan.TicksPerMillisecond);
}
private static long EveryCount(TimeSpan duration, TimeSpan step)
{