refactor(codecs): pool luminance rows and gate timing on optimised builds

EncodeRow8/16 reuse one pooled scratch row for RGB-to-gray output
instead of allocating per row; drop unused JPEG marker constants; the
24 MP timing test skips itself when the JIT optimiser is disabled.

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-02 10:12:49 +00:00
1 parent 78dad093ab
commit f2c0709ef2
3 files changed
+28 -31

No files matched your search

@@ -1,4 +1,5 @@
using System.Diagnostics;
using System.Reflection;
using Titano.Core.Codecs.Jpeg;
using Titano.Testing;
@@ -15,6 +16,9 @@ public sealed class JpegPerformanceTests(TestContext context)
[Timeout(60_000)]
public void Decodes24MegapixelOnOneCoreUnderThreeSeconds()
{
// A Debug build disables the JIT optimiser in Titano.Core: timings would measure the build, not the codec.
if (typeof(JpegDecoder).Assembly.GetCustomAttribute<DebuggableAttribute>()?.IsJITOptimizerDisabled == true)
TestContext.Skip("timing gate needs an optimised build (dotnet run -c Release)");
var rgb = Photo();
var sw = Stopwatch.StartNew();
var jpeg = JpegEncoder.Encode(rgb, W, H, 3, new JpegEncodeOptions { Quality = 90, Subsampling = JpegSubsampling.Yuv420 });