Compositor: reuse column LUT buffer to avoid per-call allocations (Unit 4)
This commit is contained in:
@@ -32,6 +32,7 @@ public sealed class SceneCompositor
|
||||
private static readonly Dictionary<SceneElement, VideoFrame> _elementRasters = new(ReferenceEqualityComparer.Instance);
|
||||
private static readonly object _pasteGate = new();
|
||||
private const int MaxPasteEntries = 256;
|
||||
private static float[] _sxLutCache = Array.Empty<float>();
|
||||
|
||||
/// <summary>
|
||||
/// Composite <paramref name="scene"/> into the tier's output frame. Layer order (back →
|
||||
@@ -547,7 +548,11 @@ public sealed class SceneCompositor
|
||||
|
||||
// Build horizontal LUT for scaled blit to reduce per-pixel divides
|
||||
var lutCount = x1 - x0 + 1;
|
||||
var sxLut = new float[lutCount];
|
||||
if (_sxLutCache.Length < lutCount)
|
||||
{
|
||||
_sxLutCache = new float[Math.Max(lutCount, 4096)];
|
||||
}
|
||||
var sxLut = _sxLutCache;
|
||||
var pxBase = x0 - ex;
|
||||
for (var xi = 0; xi < lutCount; xi++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user