Skip to content

Conversation

@Trimatix
Copy link
Owner

@Trimatix Trimatix commented Apr 2, 2025

Notes for reviewer:

  • add new notOnPlatforms parameter to supportsFormats
  • add new getCompressedImageLength method on ImageCodecAdaptor

@github-actions
Copy link

github-actions bot commented Apr 2, 2025

Tests Skipped Failures Errors Time
53 6 💤 5 ❌ 0 🔥 0.461s ⏱️

@Mewlkor
Copy link

Mewlkor commented Apr 5, 2025

After looking over it: The segfault happens after all tests are done and the interpreter is garbage collecting during shutting down.
I am not entirely sure what could cause this but i read something about circular dependencies which cause this behavior during shutdown.

actual = CODEC.decompress(compressed, CompressionFormat.ETC1, expected.width, expected.height, None) \
.convert(expected.mode)
for coords in zip(range(expected.width), range(expected.height)):
assert expected.getpixel(coords) == actual.getpixel(coords) # type: ignore[reportUnknownMemberType]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we swap the bytes at decompression. this is not accounted for in this test.
I assume the pixel order in the compressed is wrong since the swapping to BGR is not actually mandated by the ETC standart. It seems to be just an implementation flavor of etcpak. I think this fails since AEI_Editor also doesn't swap the color channels which suggests that .aei actually stores ETC1 in RGB instead of BGR. But i am not entirely sure.

Suggested change
assert expected.getpixel(coords) == actual.getpixel(coords) # type: ignore[reportUnknownMemberType]
pixel = actual.getpixel(coords)
assert expected.getpixel(coords) == (pixel[2],pixel[1],pixel[0]) # type: ignore[reportUnknownMemberType]

def test_decompress_ETC1_succeeds_onLinux():
with smileyRoundtripImage(CompressionFormat.ETC1) as expected:
compressed = SMILEY_COMPRESSED_RAW[CompressionFormat.ETC1]
actual = CODEC.decompress(compressed, CompressionFormat.ETC1, expected.width, expected.height, None) \
Copy link

@Mewlkor Mewlkor Apr 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The size is to large. the data size is width * height but etcpak expects width * height // 2

Suggested change
actual = CODEC.decompress(compressed, CompressionFormat.ETC1, expected.width, expected.height, None) \
actual = CODEC.decompress(compressed[:expected.width * expected.height //2], CompressionFormat.ETC1, expected.width, expected.height, None)

@sonarqubecloud
Copy link

sonarqubecloud bot commented Apr 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants