CPUの画素の8ビットとの変換を別の型へ分ける

このコミットが含まれているのは:
routersys committed 2026-10-08 09:22:42 +09:00
1 親 61a23e6ada
コミット f9d34ba224
6ファイル変更
+139 -130

検索条件に一致するファイルはありません

+11 -11
ファイルの表示
@@ -63,10 +63,10 @@ public sealed class CpuTileConvolverTests
for (var index = 0; index < output.Length; index += 4)
{
Assert.Equal(CpuTileConvolver.ToUnorm(convolved[index + 2] * 2.5f), output[index]);
Assert.Equal(CpuTileConvolver.ToUnorm(convolved[index + 1] * 2.5f), output[index + 1]);
Assert.Equal(CpuTileConvolver.ToUnorm(convolved[index] * 2.5f), output[index + 2]);
Assert.Equal(CpuTileConvolver.ToUnorm(convolved[index + 3] * 2.5f), output[index + 3]);
Assert.Equal(CpuPixels.ToUnorm(convolved[index + 2] * 2.5f), output[index]);
Assert.Equal(CpuPixels.ToUnorm(convolved[index + 1] * 2.5f), output[index + 1]);
Assert.Equal(CpuPixels.ToUnorm(convolved[index] * 2.5f), output[index + 2]);
Assert.Equal(CpuPixels.ToUnorm(convolved[index + 3] * 2.5f), output[index + 3]);
}
}
@@ -136,8 +136,8 @@ public sealed class CpuTileConvolverTests
Assert.Equal(single, several);
for (var pixel = 0; pixel < pixels; pixel++)
{
Assert.Equal(CpuTileConvolver.ToUnorm(stored[pixel * 4 + 2] * 1.3f), single[pixel * 4]);
Assert.Equal(CpuTileConvolver.ToUnorm(stored[pixel * 4] * 1.3f), single[pixel * 4 + 2]);
Assert.Equal(CpuPixels.ToUnorm(stored[pixel * 4 + 2] * 1.3f), single[pixel * 4]);
Assert.Equal(CpuPixels.ToUnorm(stored[pixel * 4] * 1.3f), single[pixel * 4 + 2]);
}
}
@@ -178,7 +178,7 @@ public sealed class CpuTileConvolverTests
[InlineData(float.PositiveInfinity, 255)]
public void ConversionFollowsTheDirect3DRule(float value, byte expected)
{
Assert.Equal(expected, CpuTileConvolver.ToUnorm(value));
Assert.Equal(expected, CpuPixels.ToUnorm(value));
}
[Fact]
@@ -455,10 +455,10 @@ public sealed class CpuTileConvolverTests
for (var pixel = 0; pixel < pixels; pixel++)
{
Assert.Equal(CpuTileConvolver.ToUnorm(stored[pixel * 4 + 2] * gain), output[pixel * 4]);
Assert.Equal(CpuTileConvolver.ToUnorm(stored[pixel * 4 + 1] * gain), output[pixel * 4 + 1]);
Assert.Equal(CpuTileConvolver.ToUnorm(stored[pixel * 4] * gain), output[pixel * 4 + 2]);
Assert.Equal(CpuTileConvolver.ToUnorm(stored[pixel * 4 + 3] * gain), output[pixel * 4 + 3]);
Assert.Equal(CpuPixels.ToUnorm(stored[pixel * 4 + 2] * gain), output[pixel * 4]);
Assert.Equal(CpuPixels.ToUnorm(stored[pixel * 4 + 1] * gain), output[pixel * 4 + 1]);
Assert.Equal(CpuPixels.ToUnorm(stored[pixel * 4] * gain), output[pixel * 4 + 2]);
Assert.Equal(CpuPixels.ToUnorm(stored[pixel * 4 + 3] * gain), output[pixel * 4 + 3]);
}
}
+4 -4
ファイルの表示
@@ -139,10 +139,10 @@ public sealed class GpuTileConvolverTests
for (var index = 0; index < run.Output.Length; index += 4)
{
Assert.InRange(run.Output[index] - CpuTileConvolver.ToUnorm(run.Store[index + 2] * 2.5f), -1, 1);
Assert.InRange(run.Output[index + 1] - CpuTileConvolver.ToUnorm(run.Store[index + 1] * 2.5f), -1, 1);
Assert.InRange(run.Output[index + 2] - CpuTileConvolver.ToUnorm(run.Store[index] * 2.5f), -1, 1);
Assert.InRange(run.Output[index + 3] - CpuTileConvolver.ToUnorm(run.Store[index + 3] * 2.5f), -1, 1);
Assert.InRange(run.Output[index] - CpuPixels.ToUnorm(run.Store[index + 2] * 2.5f), -1, 1);
Assert.InRange(run.Output[index + 1] - CpuPixels.ToUnorm(run.Store[index + 1] * 2.5f), -1, 1);
Assert.InRange(run.Output[index + 2] - CpuPixels.ToUnorm(run.Store[index] * 2.5f), -1, 1);
Assert.InRange(run.Output[index + 3] - CpuPixels.ToUnorm(run.Store[index + 3] * 2.5f), -1, 1);
}
}
+1 -1
ファイルの表示
@@ -229,7 +229,7 @@ public sealed class LightTransformTests
{
var (blue, green, red, alpha) = LightTransform.ToBytes(value, value, value, value, 1.5f, default, 3, 4);
var expected = CpuTileConvolver.ToUnorm(value * 1.5f);
var expected = CpuPixels.ToUnorm(value * 1.5f);
Assert.Equal(expected, red);
Assert.Equal(expected, green);
Assert.Equal(expected, blue);