[ { "name": "標本の時刻をフレームの先頭にする", "file": "ProxyForge/Sources/FrameRate.cs", "find": "var ticks = (Int128)(2L * frameIndex + 1L) * Denominator * TimeSpan.TicksPerSecond / (2L * Numerator);", "replace": "var ticks = (Int128)(2L * frameIndex) * Denominator * TimeSpan.TicksPerSecond / (2L * Numerator);" }, { "name": "近似の約分を飛ばす", "file": "ProxyForge/Sources/FrameRate.cs", "find": "if (divisor <= 1)", "replace": "if (divisor >= 1)" }, { "name": "フレーム数の検算を外す", "file": "ProxyForge/Sources/FrameRateResolver.cs", "find": "if (candidate.GetFrameIndex(duration) != frameCount)", "replace": "if (candidate.GetFrameIndex(duration) != frameCount && false)" }, { "name": "区間内の検算を外す", "file": "ProxyForge/Sources/FrameRateResolver.cs", "find": "for (var sample = 1; sample < VerificationSamples; sample++)", "replace": "for (var sample = 1; sample < 1; sample++)" }, { "name": "最も簡単な有理数で切り上げを間違える", "file": "ProxyForge/Sources/FrameRateResolver.cs", "find": "return (floor + 1, 1);", "replace": "return (floor, 1);" }, { "name": "境界の二分探索で等号を落とす", "file": "ProxyForge/Sources/FrameRateResolver.cs", "find": "if (frameIndexOf(new TimeSpan(middle)) >= target)", "replace": "if (frameIndexOf(new TimeSpan(middle)) > target)" }, { "name": "偶数への丸めを外す", "file": "ProxyForge/Encoding/ProxyGeometry.cs", "find": "var aligned = value & ~1;", "replace": "var aligned = value;" }, { "name": "倍率の範囲の制限を外す", "file": "ProxyForge/Encoding/ProxyGeometry.cs", "find": "var clamped = Math.Clamp(scale, MinimumScale, MaximumScale);", "replace": "var clamped = scale;" }, { "name": "ビットレートの上下限を外す", "file": "ProxyForge/Encoding/FFmpegArguments.cs", "find": "return (long)Math.Clamp(bitrate, MinimumBitrate, MaximumBitrate);", "replace": "return (long)bitrate;" }, { "name": "倍率が正でなくてもそのまま掛ける", "file": "ProxyForge/Encoding/FFmpegArguments.cs", "find": "var scale = bitrateScale > 0 ? bitrateScale / 100d : 1d;", "replace": "var scale = bitrateScale / 100d;" }, { "name": "上書きを許可しない", "file": "ProxyForge/Encoding/FFmpegArguments.cs", "find": "arguments.Add(\"-y\");", "replace": "arguments.Add(\"-n\");" }, { "name": "内蔵のベンダーを二重に並べる", "file": "ProxyForge/Encoding/FFmpegEncoderSelector.cs", "find": "if (!discreteVendors.Contains(VendorOf(candidates[i])))", "replace": "if (discreteVendors.Contains(VendorOf(candidates[i])))" }, { "name": "AMDの判定を取り違える", "file": "ProxyForge/Encoding/FFmpegEncoderSelector.cs", "find": "if (encoder.Contains(\"amf\", StringComparison.Ordinal))", "replace": "if (encoder.Contains(\"amd\", StringComparison.Ordinal))" }, { "name": "診断の一行目を切り詰めない", "file": "ProxyForge/Encoding/FFmpegProcessRunner.cs", "find": "return new string(line.Length > maximumLength ? line[..maximumLength] : line);", "replace": "return new string(line);" }, { "name": "診断の容量を守らない", "file": "ProxyForge/Encoding/FFmpegProcessRunner.cs", "find": "if (trimmed.IsEmpty || builder.Length >= capacity)", "replace": "if (trimmed.IsEmpty)" }, { "name": "入力の失敗をすべて包む", "file": "ProxyForge/Encoding/FFmpegProcessRunner.cs", "find": "if (inputFailure is IOException)", "replace": "if (inputFailure is not null)" }, { "name": "縁の余白を無くす", "file": "ProxyForge/Encoding/FrameAlpha.cs", "find": "public const int EdgeMargin = 2;", "replace": "public const int EdgeMargin = 0;" }, { "name": "不透明の判定を反転する", "file": "ProxyForge/Encoding/FrameAlpha.cs", "find": "if (row[x * BytesPerPixel + 3] != Opaque)", "replace": "if (row[x * BytesPerPixel + 3] == Opaque)" }, { "name": "片方の辺だけで半分に縮める", "file": "ProxyForge/Encoding/ProxyFrameRenderer.cs", "find": "while (contentWidth >= 2d * width && contentHeight >= 2d * height)", "replace": "while (contentWidth >= 2d * width || contentHeight >= 2d * height)" }, { "name": "不透明な黒で塗り潰す", "file": "ProxyForge/Encoding/ProxyFrameRenderer.cs", "find": "context.Clear(new Color4(0f, 0f, 0f, 0f));", "replace": "context.Clear(new Color4(0f, 0f, 0f, 1f));" }, { "name": "幅が零でも使えるとみなす", "file": "ProxyForge/Encoding/DisplayBounds.cs", "find": "&& PixelWidth >= 1 && PixelHeight >= 1", "replace": "&& PixelWidth >= 0 && PixelHeight >= 0" }, { "name": "進捗を毎フレーム報告する", "file": "ProxyForge/Encoding/ProxyEncoder.cs", "find": "if (step == reportedStep)", "replace": "if (false)" }, { "name": "透明の検査を外す", "file": "ProxyForge/Encoding/ProxyEncoder.cs", "find": "if (!FrameAlpha.IsOpaque(frame, geometry.Width, geometry.Height))", "replace": "if (false)" }, { "name": "失敗した出力を消さない", "file": "ProxyForge/Encoding/ProxyEncoder.cs", "find": "TryDelete(outputPath);", "replace": "_ = outputPath;" }, { "name": "範囲の先頭を無視して先頭から符号化する", "file": "ProxyForge/Encoding/ProxyEncoder.cs", "find": "source.Update(frameRate.GetSampleTime(firstFrame + index));", "replace": "source.Update(frameRate.GetSampleTime(index));" }, { "name": "範囲の上限を検査しない", "file": "ProxyForge/Encoding/ProxyEncoder.cs", "find": " ArgumentOutOfRangeException.ThrowIfGreaterThan(firstFrame + frameCount, analysis.FrameCount);\r\n", "replace": "" }, { "name": "最終利用を更新しない", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "entry.LastUsedTicks = DateTime.UtcNow.Ticks;\r\n Save();\r\n return entry.Clone();", "replace": "Save();\r\n return entry.Clone();" }, { "name": "新しい方から削る", "file": "ProxyForge/Cache/ProxyCache.cs", "find": ".OrderBy(entry => entry.LastUsedTicks).ToList();", "replace": ".OrderByDescending(entry => entry.LastUsedTicks).ToList();" }, { "name": "上限ちょうどでも削る", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "if (total <= LimitBytes)", "replace": "if (total < LimitBytes)" }, { "name": "追加した項目を保護しない", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "TrimCore(entry);", "replace": "TrimCore(null);" }, { "name": "索引にあるフォルダーも孤児として消す", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "if (!known.Contains(directory))", "replace": "if (true)" }, { "name": "読み込み時に無いチャンクを索引に残す", "file": "ProxyForge/Cache/ProxyCache.cs", "find": " entry.Chunks = present;\r\n", "replace": " entry.Chunks = listed;\r\n" }, { "name": "チャンクの追加で範囲外を受け付ける", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "if (entry is null || chunk < 0 || chunk >= entry.ChunkCount)", "replace": "if (entry is null)" }, { "name": "同じ配置の登録で既存を捨てる", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "if (existing is not null && existing.HasSameLayout(layout) && Directory.Exists(GetDirectoryPath(existing)))", "replace": "if (false)" }, { "name": "チャンクの追加で自身を保護せずに切り詰める", "file": "ProxyForge/Cache/ProxyCache.cs", "find": " TrimCore(entry);\r\n Save();\r\n return entry.Clone();", "replace": " TrimCore(null);\r\n Save();\r\n return entry.Clone();" }, { "name": "除外の判定で元ファイルを見ない", "file": "ProxyForge/Cache/ProxyCache.cs", "find": "return index.Skips.Exists(skip => skip.Matches(source));", "replace": "return index.Skips.Count > 0;" }, { "name": "経路の大文字小文字を区別する", "file": "ProxyForge/Cache/SourceIdentity.cs", "find": "&& string.Equals(Path, path, StringComparison.OrdinalIgnoreCase);", "replace": "&& string.Equals(Path, path, StringComparison.Ordinal);" }, { "name": "長さの違いを見逃す", "file": "ProxyForge/Cache/SourceIdentity.cs", "find": "=> Length == length", "replace": "=> true" }, { "name": "出力の引数が選択肢でも受け付ける", "file": "ProxyForge/Export/ExportDetector.cs", "find": "return !string.IsNullOrWhiteSpace(input) && !input.StartsWith(\"--\", StringComparison.Ordinal);", "replace": "return !string.IsNullOrWhiteSpace(input);" }, { "name": "出力中に設定画面が開いても準備中へ戻す", "file": "ProxyForge/Export/ExportDetector.cs", "find": "Interlocked.CompareExchange(ref phase, (int)ExportPhase.Preparing, (int)ExportPhase.Idle);", "replace": "Interlocked.Exchange(ref phase, (int)ExportPhase.Preparing);" }, { "name": "設定画面が閉じただけで待機へ戻す", "file": "ProxyForge/Export/ExportDetector.cs", "find": "if (role == ExportWindowRole.Progress)", "replace": "if (role != ExportWindowRole.None)" }, { "name": "判定できない時を出力中とみなさない", "file": "ProxyForge/Export/ExportDetector.cs", "find": " default:\r\n return ExportPhase.Exporting;\r\n }\r\n }", "replace": " default:\r\n return ExportPhase.Idle;\r\n }\r\n }" }, { "name": "モーダルダイアログの間を出力中とみなす", "file": "ProxyForge/Export/ExportDetector.cs", "find": " case ExportPhase.Preparing:\r\n return ExportPhase.Preparing;", "replace": " case ExportPhase.Preparing:\r\n return ExportPhase.Exporting;" }, { "name": "取り消された準備を待機へ戻さない", "file": "ProxyForge/Export/ExportDetector.cs", "find": "var previous = (ExportPhase)Interlocked.CompareExchange(ref phase, (int)ExportPhase.Idle, (int)ExportPhase.Preparing);", "replace": "var previous = ExportPhase.Preparing;" }, { "name": "解決の途中で始まった出力を無視する", "file": "ProxyForge/Export/ExportDetector.cs", "find": "return previous == ExportPhase.Preparing ? ExportPhase.Idle : previous;", "replace": "return ExportPhase.Idle;" }, { "name": "コマンドラインの出力を解決で出力中とみなさない", "file": "ProxyForge/Export/ExportDetector.cs", "find": " if (commandLineEncode)\r\n return ExportPhase.Exporting;\r\n\r\n var current = Phase;", "replace": " var current = Phase;" }, { "name": "題名の前方一致で分類する", "file": "ProxyForge/Export/ExportDetector.cs", "find": "if (title.SequenceEqual(progressTitle()))", "replace": "if (title.StartsWith(progressTitle()))" }, { "name": "子ウィンドウも出力ウィンドウとみなす", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " && GetAncestor(window, AncestorParent) == GetDesktopWindow()", "replace": "" }, { "name": "隠れたウィンドウの題名も見る", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": "if (!windows.ContainsKey(window) && IsWindowVisible(window) &&", "replace": "if (!windows.ContainsKey(window) &&" }, { "name": "分類済みのウィンドウの題名を再分類する", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": "if (!windows.ContainsKey(window) && IsWindowVisible(window) &&", "replace": "if (IsWindowVisible(window) &&" }, { "name": "ウィンドウが隠れても出力を終えない", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " case EventObjectHide:\r\n case EventObjectDestroy:", "replace": " case EventObjectDestroy:" }, { "name": "無関係なウィンドウも記録する", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " if (role == ExportWindowRole.None)\r\n return;\r\n\r\n windows[window] = role;", "replace": " windows[window] = role;" }, { "name": "走査で無効なウィンドウを無視する", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " if (!IsWindowEnabled(window))\r\n scanned = ExportPhase.Preparing;", "replace": "" }, { "name": "走査でスレッドのモーダル状態を見ない", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": "scanned = ComponentDispatcher.IsThreadModal ? ExportPhase.Preparing : ExportPhase.Idle;", "replace": "scanned = ExportPhase.Idle;" }, { "name": "走査で隠れたウィンドウも数える", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " if (!IsWindowVisible(window))\r\n return true;\r\n\r\n Span title = stackalloc char[TitleCapacity];\r\n switch", "replace": " Span title = stackalloc char[TitleCapacity];\r\n switch" }, { "name": "走査で設定画面を待機とみなす", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " case ExportWindowRole.Configuration:\r\n scanned = ExportPhase.Preparing;\r\n return true;", "replace": " case ExportWindowRole.Configuration:\r\n return true;" }, { "name": "走査で進捗ウィンドウを見つけても続ける", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " scanned = ExportPhase.Exporting;\r\n return false;", "replace": " scanned = ExportPhase.Exporting;\r\n return true;" }, { "name": "観測する側のスレッドでも待つ", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " if (target.CheckAccess())\r\n return Scan();\r\n", "replace": "" }, { "name": "二度目の取り付けで置き換える", "file": "ProxyForge/Export/ExportWindowWatcher.cs", "find": " if (IsAttached)\r\n return;\r\n\r\n ExportWindowWatcher.detector = detector;", "replace": " ExportWindowWatcher.detector = detector;" }, { "name": "失敗した項目も再び受け付ける", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": "if (pending.ContainsKey(key) || failures.Contains(key))", "replace": "if (pending.ContainsKey(key))" }, { "name": "出力の準備中に生成を始める", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": "while (exportPhase() != ExportPhase.Idle)", "replace": "while (exportPhase() == ExportPhase.Exporting)" }, { "name": "透明以外の失敗を除外として記録する", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": "if (exception.Failure == ProxyEncodeFailure.Transparent)", "replace": "if (exception.Failure != ProxyEncodeFailure.Transparent)" }, { "name": "元ファイルの変更を見逃す", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": "if (SourceIdentity.Of(key.Source.Path) != key.Source)", "replace": "if (false)" }, { "name": "透明と変更以外でも項目を捨てる", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": " if (exception?.Failure is not (ProxyEncodeFailure.Transparent or ProxyEncodeFailure.SourceChanged))\r\n return;\r\n\r\n", "replace": "" }, { "name": "注目位置を無視して先頭から生成する", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": "focus.Get(key.Source)", "replace": "null" }, { "name": "チャンクの間で出力を待たない", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": " await WaitForExportToEndAsync(token).ConfigureAwait(false);\r\n\r\n var firstFrame", "replace": " var firstFrame" }, { "name": "追加に失敗しても続ける", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": " if (updated is null)\r\n throw new OperationCanceledException();\r\n\r\n", "replace": "" }, { "name": "注目より前のチャンクを生成しない", "file": "ProxyForge/Encoding/ProxyChunkPlan.cs", "find": " for (var chunk = 0; chunk < start; chunk++)\r\n {\r\n if (!completed.Contains(chunk))\r\n return chunk;\r\n }\r\n\r\n", "replace": "" }, { "name": "チャンクの長さに秒数を掛けない", "file": "ProxyForge/Encoding/ProxyChunkPlan.cs", "find": "Math.Round(frameRate.Value * seconds, MidpointRounding.AwayFromZero)", "replace": "Math.Round(frameRate.Value, MidpointRounding.AwayFromZero)" }, { "name": "最小サイズちょうどを対象外にする", "file": "ProxyForge/Sources/ProxySourceProvider.cs", "find": "source.Length < current.MinimumFileSizeBytes", "replace": "source.Length <= current.MinimumFileSizeBytes" }, { "name": "自動生成が無効なら生成中でも待たない", "file": "ProxyForge/Sources/ProxySourceProvider.cs", "find": "!current.GeneratesAutomatically && !queue.IsPending(source, scale)", "replace": "!current.GeneratesAutomatically" }, { "name": "完成した項目でも生成を頼む", "file": "ProxyForge/Sources/ProxySourceProvider.cs", "find": "if (current.GeneratesAutomatically && (entry is null || !entry.IsComplete))", "replace": "if (current.GeneratesAutomatically)" }, { "name": "除外した動画も対象にする", "file": "ProxyForge/Sources/ProxySourceProvider.cs", "find": "|| cache.IsSkipped(source))", "replace": "|| false)" }, { "name": "次のチャンクを先読みしない", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": " if (!chunks.ContainsKey(chunk + 1) && entry.HasChunk(chunk + 1))\r\n loader.Request(chunk + 1);\r\n\r\n", "replace": "" }, { "name": "揃っても元動画を解放しない", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": " if (entry.IsComplete)\r\n DisposeOriginal();\r\n", "replace": "" }, { "name": "遠いチャンクを閉じない", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": "if (keep is { } center && Math.Abs(index - center) <= OpenChunkRadius)", "replace": "if (keep is not null)" }, { "name": "元動画が無くても同期で開かない", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": "if (original is null && !originalUnavailable)\r\n {\r\n var opened = loader.Open(devices, chunk);", "replace": "if (false)\r\n {\r\n var opened = loader.Open(devices, chunk);" }, { "name": "チャンクの時刻をずらさない", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": "current.Source.Update(time - frameRate.GetFrameStart(chunk * entry.ChunkLength));", "replace": "current.Source.Update(time);" }, { "name": "丸めた番号でチャンクを選ぶ", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": "var frame = layout is null ? original!.GetFrameIndex(time) : frameRate.GetContainingFrame(time);", "replace": "var frame = layout is null ? original!.GetFrameIndex(time) : frameRate.GetFrameIndex(time);" }, { "name": "注目位置を報告しない", "file": "ProxyForge/Sources/ProxyVideoSource.cs", "find": " focus.Report(identity, frame);\r\n", "replace": "" }, { "name": "開けないチャンクを索引に残す", "file": "ProxyForge/Sources/ProxyChunkLoader.cs", "find": "var forgotten = cache.ForgetChunk(current.Id, chunk);", "replace": "var forgotten = current;" }, { "name": "読み込み中の重複を許す", "file": "ProxyForge/Sources/ProxyChunkLoader.cs", "find": " || loading.Contains(chunk) || loaded.ContainsKey(chunk))", "replace": ")" }, { "name": "別の倍率の完了も受け取る", "file": "ProxyForge/Sources/ProxyChunkLoader.cs", "find": "if (completedScale != scale || completedSource != source)", "replace": "if (completedSource != source)" }, { "name": "破棄後に読み込んだチャンクを保持する", "file": "ProxyForge/Sources/ProxyChunkLoader.cs", "find": " if (disposed || opened is null)\r\n opened?.Dispose();", "replace": " if (opened is null)\r\n opened?.Dispose();" }, { "name": "含むフレームを切り上げる", "file": "ProxyForge/Sources/FrameRate.cs", "find": "var frame = (Int128)time.Ticks * Numerator / ((Int128)Denominator * TimeSpan.TicksPerSecond);", "replace": "var frame = (Int128)time.Ticks * Numerator / ((Int128)Denominator * TimeSpan.TicksPerSecond) + 1;" }, { "name": "空の読み込み順で先頭を読む", "file": "ProxyForge/PluginOrder.cs", "find": "=> order.Count > 0 && string.Equals(order[0], name, StringComparison.Ordinal);", "replace": "=> string.Equals(order[0], name, StringComparison.Ordinal);" }, { "name": "先頭ではなく末尾へ動かす", "file": "ProxyForge/PluginOrder.cs", "find": ".Insert(0, name);", "replace": ".Add(name);" }, { "name": "進捗を百分率にしない", "file": "ProxyForge/ViewModels/GenerationItemViewModel.cs", "find": "public double Percentage => Item.Progress * 100d;", "replace": "public double Percentage => Item.Progress;" }, { "name": "古い順に並べる", "file": "ProxyForge/ViewModels/ProxyForgeSettingsViewModel.cs", "find": "foreach (var entry in entries.OrderByDescending(entry => entry.LastUsedTicks))", "replace": "foreach (var entry in entries.OrderBy(entry => entry.LastUsedTicks))" }, { "name": "閉じられた後も表示する", "file": "ProxyForge/Views/GenerationProgressWindowHost.cs", "find": "=> itemCount > 0 && enabled && !hiddenByUser;", "replace": "=> itemCount > 0 && enabled;" }, { "name": "網羅の描画で範囲外のチャンクも描く", "file": "ProxyForge/Views/ChunkCoverageBar.cs", "find": ".Where(chunk => chunk >= 0 && chunk < coverage.ChunkCount)", "replace": "" }, { "name": "網羅の描画で隣り合うチャンクを繋げない", "file": "ProxyForge/Views/ChunkCoverageBar.cs", "find": "while (index + 1 < chunks.Length && chunks[index + 1] == last + 1)", "replace": "while (false)" }, { "name": "網羅の描画で生成中のチャンクを描かない", "file": "ProxyForge/Views/ChunkCoverageBar.cs", "find": "&& !coverage.Contains(current) && coverage.CurrentProgress > 0d)", "replace": "&& false)" }, { "name": "網羅の描画で進み具合を上限で切らない", "file": "ProxyForge/Views/ChunkCoverageBar.cs", "find": "Math.Min(coverage.CurrentProgress, 1d) / count", "replace": "coverage.CurrentProgress / count" }, { "name": "生成中のチャンクを網羅に載せない", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": " Publish(item, entry, chunk);\r\n", "replace": "" }, { "name": "チャンクの完了を網羅に載せない", "file": "ProxyForge/Encoding/ProxyGenerationQueue.cs", "find": " Publish(item, entry, null);\r\n ChunkCompleted", "replace": " ChunkCompleted" } ]