Compare commits

..
Author SHA1 Message Date
ds5678 13b4f6ee49 Bump version to 2.6.3 in Directory.Build.props
Updated VersionPrefix from 2.6.2 to 2.6.3 to release a new project version.
2026-08-23 13:50:59 -07:00
ds5678 2cdd532c31 Update NuGet packages and remove coverlet.collector
Upgraded Microsoft.NET.Test.Sdk, NUnit, NUnit3TestAdapter, and NUnit.Analyzers in AssetRipper.TextureDecoder.Tests.csproj. Removed coverlet.collector package reference. Updated Microsoft.SourceLink.GitHub from 10.0.103 to 10.0.400 in AssetRipper.TextureDecoder.csproj.
2026-08-23 13:46:51 -07:00
dependabot[bot] d772c2790d Bump actions/checkout from 6 to 7 (#114)
Bumps [actions/checkout](https://github.com/actions/checkout) from 6 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-16 18:28:04 -07:00
dependabot[bot] 0201123b0a Bump actions/setup-dotnet from 5.3.0 to 6.0.0 (#113)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 5.3.0 to 6.0.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](https://github.com/actions/setup-dotnet/compare/v5.3.0...v6.0.0)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: 6.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-16 18:27:51 -07:00
Jeremy Pritts 02531ab941 Ensure documentation file is named correctly 2026-08-15 21:15:42 -07:00
dependabot[bot] 2f8d0b4a8b Bump actions/setup-dotnet from 5.1.0 to 5.3.0 (#111)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 5.1.0 to 5.3.0.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](https://github.com/actions/setup-dotnet/compare/v5.1.0...v5.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-version: 5.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-08-13 19:44:41 -07:00
砕形怨憎 0fb5e24d81 Fix chlist attribute size and scan line offset table (#112)
OpenEXRFileLayout defines a chlist attribute value as "A sequence of channels
followed by a null byte (0x00)", and the attribute size as "the size (in bytes)
of the attribute value". Size left out the terminating null byte, so a reader
that trusts the declared size lands on that byte and reads it as an empty
attribute name, which terminates the header after the first attribute.

The same document defines a regular scan line block as "y coordinate | pixel
data size | pixel data", and an offset table entry as "the distance, in bytes,
between the start of the file and the start of the chunk". The table advanced
by one int plus the pixel data, leaving out the y coordinate, so every entry
after the first pointed four bytes past the start of its chunk.

https://openexr.com/en/latest/OpenEXRFileLayout.html
2026-08-13 19:44:06 -07:00
ds5678 ec91662b4a Fix DecodeASTC method not using size of TOutputColor 2026-08-10 16:50:31 -07:00
ds5678 03713d8d57 Update version to 2.6.2 in Directory.Build.props
Bump the VersionPrefix property from 2.6.1 to 2.6.2 to prepare for the next release.
2026-06-02 14:44:26 -07:00
ds5678 3cf2170242 Ensure that blocks with all bits set do not throw 2026-06-02 14:32:22 -07:00
ds5678 0a8bae09cf Refactor: use Span.Fill for block color assignment
Replaced manual for loop with Span.Fill to efficiently assign a color value to the output span in ASTC block decoding. This improves code readability and performance.
2026-05-21 21:50:21 -07:00
8 changed files with 19 additions and 20 deletions

No files matched your search

+2 -2
View File
@@ -12,9 +12,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/checkout@v7
- name: Setup .NET
uses: actions/setup-dotnet@v5.1.0
uses: actions/setup-dotnet@v6.0.0
with:
dotnet-version: 9.0.x
- name: Restore dependencies
@@ -5,17 +5,13 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="NUnit" Version="4.6.0" />
<PackageReference Include="NUnit3TestAdapter" Version="6.1.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.11.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.9.0" />
<PackageReference Include="NUnit" Version="4.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="6.2.0" />
<PackageReference Include="NUnit.Analyzers" Version="4.14.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
@@ -77,6 +77,8 @@ public sealed class AstcTests
}
[TestCase(new byte[16] { 83, 1, 147, 104, 198, 173, 55, 116, 182, 66, 105, 11, 102, 43, 148, 125 }, 8, 8, TestName = "GetBits Should not throw in DecodeIntseq")]
[TestCase(new byte[16] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, 8, 8, TestName = "Zero blocks should not throw", Description = "Blocks of all zeros are valid")]
[TestCase(new byte[16] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, 8, 8, TestName = "0xFF blocks should not throw", Description = "Blocks with all bits set are invalid, but should be handled gracefully")]
public void DecodesBlockWithoutThrowing(byte[] block, int blockWidth, int blockHeight)
{
Assert.DoesNotThrow(() => AstcDecoder.DecodeASTC<ColorBGRA<byte>, byte>(block, blockWidth, blockHeight, blockWidth, blockHeight, out _));
@@ -15,12 +15,11 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>bin\TextureDecoder.xml</DocumentationFile>
<NoWarn>1591</NoWarn>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.103">
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.400">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
@@ -18,7 +18,7 @@ namespace AssetRipper.TextureDecoder.Astc
where TOutputChannelValue : unmanaged
where TOutputColor : unmanaged, IColor<TOutputChannelValue>
{
output = new byte[width * height * 4];
output = new byte[width * height * Unsafe.SizeOf<TOutputColor>()];
return DecodeASTC<TOutputColor, TOutputChannelValue>(input, width, height, blockWidth, blockHeight, output);
}
@@ -66,10 +66,7 @@ namespace AssetRipper.TextureDecoder.Astc
if (input[0] == 0xfc && (input[1] & 1) == 1)
{
ColorRGBA<byte> c = new(input[9], input[11], input[13], input[15]);
for (int i = 0; i < blockWidth * blockHeight; i++)
{
output[i] = c;
}
output[..(blockWidth * blockHeight)].Fill(c);
}
else
{
@@ -886,6 +883,11 @@ namespace AssetRipper.TextureDecoder.Astc
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
private static int GetBits(ReadOnlySpan<byte> input, int bit, int len)
{
if (bit < 0 || input.Length * 8 < bit + len)
{
// Invalid input, but we should return something instead of throwing an exception
return default;
}
ReadOnlySpan<byte> slice = input[(bit / 8)..];
int bitBuffer;
if (slice.Length >= sizeof(int))
@@ -4,7 +4,7 @@ public readonly record struct ExrChannelList(ExrChannel[] Channels) : IExrDataTy
{
public static ReadOnlySpan<byte> TypeName => "chlist"u8;
public int Size => Channels.Sum(c => c.Size);
public int Size => Channels.Sum(c => c.Size) + sizeof(byte);
public void Write(BinaryWriter writer)
{
+1 -1
View File
@@ -75,7 +75,7 @@ public static class ExrWriter
for (int i = 0; i < height; i++)
{
writer.Write(offset);
offset += sizeof(int) + ChannelCount * ChannelSize * width;
offset += sizeof(int) + sizeof(int) + ChannelCount * ChannelSize * width;
}
//Scan lines
+1 -1
View File
@@ -6,7 +6,7 @@
<IsAotCompatible>true</IsAotCompatible>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<VersionPrefix>2.6.1</VersionPrefix>
<VersionPrefix>2.6.3</VersionPrefix>
<Copyright>Copyright © ds5678</Copyright>
<Authors>ds5678</Authors>
<Company>AssetRipper</Company>