Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Nitro Texture Compressor for compression 4x4 blocks #31

Merged
merged 4 commits into from
Jan 8, 2017

Conversation

MetLob
Copy link
Contributor

@MetLob MetLob commented Apr 12, 2016

Hi, I implemented compression of 4x4 texels. Medium quality, but not long time.

Example of this algorythm on photo-quality image:

  • Original

kodim23

  • Compressed

texel4x4_test_1

Example of this algorythm on NDS (not-compressed Color256 8-bit indexed) image:

  • Original

ht_ds_title_flat tim2_0

  • Compressed

texel4x4_test_0

## Using

Ekona.Images.NitroTextureCompressor.Compress(byte[] bgra, uint width, uint height, bool boundaryApprox, bool onlyInterpolatedPalettes, out byte[] palette)

Where:
bgra - original 32BPP data in ARGB format (first byte - B, G, R, A - last byte)
width, height - size of original image
boundaryApprox - using mask, which ignored inside pixels in 4x4 block, using only boundary pixels
onlyInterpolatedPalettes - generates palettes only in 1 or 3 Nitro-texture-palette formats (see code of TEX0 in plugins)

WARNING
If output palettes length / 4 > 0x3FFF then some pixels has invalid palette index.

@pleonex
Copy link
Owner

pleonex commented May 23, 2016

That's a huge contribution thanks!
Sorry for the delay, I am quite busy these days, I will review the code as soon as possible (really interested to see how it works).

@pleonex
Copy link
Owner

pleonex commented Jun 9, 2016

I have been reviewing it. Awesome job! I have some comments:

  • There are a lot of comments in a non-English language. I would like that new code and comments are only in English. Can you translate them? If it's a lot of work, what about removing the comments for now?
  • The Vector3 class is large (~1000 lines of code). What about if you move the class to a separate file Vector3.cs in the same folder?
  • Method names should have the first char in upper case (e.g.: Saturate instead of saturate). There are a few that don't follow this convention.

@MetLob
Copy link
Contributor Author

MetLob commented Jun 9, 2016

Yes. Ok. I will refactor of the code in a nearest time.
Vector3 from my oldest math-core library and has Russian comments, and the Nvidia code grabbed from C++ source without refactoring.

Can I put the Vector3 class file to Ekona.Helper namespase?
.

@pleonex
Copy link
Owner

pleonex commented Jun 9, 2016

I think that Vector3 class should be in Ekona.Images class so we can reuse it for future 3D model implementations. And don't worry about the Russian comments, I understand, Tinke has still some Spanish comments from old times that I should translate.

@MetLob
Copy link
Contributor Author

MetLob commented Jun 16, 2016

I pushed with refactoring of this.

@pleonex pleonex self-requested a review January 8, 2017 18:31
@pleonex pleonex merged commit 286d9b1 into pleonex:master Jan 8, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants