Commit graph

267 commits

Author SHA1 Message Date
Pavel Krajcevski
1115c2f9e4 Add 2BPP helper functions for our blocks.
Namely, there are two things that we need to do:
1. Figure out the sub-mode based on the mode bit and the structure of the modulation data. The comments in Block.h describe how we do this.
2. For a given texel index, return 2BPP texel modulation bits.
2013-09-12 14:30:08 -04:00
Pavel Krajcevski
08cad3ba86 Add 2BPP tests 2013-09-12 14:04:20 -04:00
Pavel Krajcevski
0172df4e60 Add final opaque to transparent gradient test. 2013-09-10 13:34:13 -04:00
Pavel Krajcevski
dd625fca71 When going from 344(3/4) pixels to 4555, the alpha channel only has a zero appended to it. Hence we must clear that bit for each pixel that was transparent during decoding. 2013-09-10 13:22:53 -04:00
Pavel Krajcevski
f5e0aa4f9f Make sure to clear the MSBs of channels that have zero depth that get converted to higher depth values 2013-09-10 13:21:48 -04:00
Pavel Krajcevski
77bb7488cc Fix typo 2013-09-10 11:58:53 -04:00
Pavel Krajcevski
eb312ccb0a Small refactor 2013-09-09 14:16:45 -04:00
Pavel Krajcevski
5020f81f00 Add a transparent pvr image test 2013-09-09 10:33:04 -05:00
Pavel Krajcevski
6c8eea5520 Add superfluous code from when I was trying to match the decoder to PVR library. 2013-09-09 10:31:53 -05:00
Pavel Krajcevski
09b5680245 Some small code style fixes 2013-09-06 13:37:50 -04:00
Pavel Krajcevski
5ac6872dc7 Add a test to make sure that after a bilerp the pixels that should remain unaffected do in fact remain unaffected. 2013-09-06 02:02:34 -04:00
Pavel Krajcevski
3806efe6fc Add some more hacky includes to be able to output debug images from our tests. 2013-09-06 02:02:02 -04:00
Pavel Krajcevski
91c79cd717 Fix Bilinear upscale
There were a couple of fixes.

1. Add another set of pixels to an image that represent the fractional bits that get populated as a result of doing a bilerp.
2. Do not consider individual axes when doing the bilerp. Instead, assign a weight to each of the different texels that we will use for the bilerp. Then, combine them and save the fractional bits.
2013-09-06 01:58:53 -04:00
Pavel Krajcevski
92827c23fc Add a debug function to our intermediate PVRTC images 2013-09-06 01:57:06 -04:00
Pavel Krajcevski
0d0c65f536 Actually index into our pixels properly... 2013-09-06 01:55:25 -04:00
Pavel Krajcevski
2263080faa Fix the interleaving by doing it when we're actually reading in the blocks 2013-09-06 01:55:06 -04:00
Pavel Krajcevski
db914018f1 Two enhancements:
1. Make sure to use the same lerping code for both modulation modes when decompressing.
2. Accept a flag during decompression that outputs the debug images that were computed during decompression.
2013-09-06 01:53:10 -04:00
Pavel Krajcevski
7403e77d4d Add some hacky includes and libraries to support writing out debug images 2013-09-06 01:50:46 -04:00
Pavel Krajcevski
0f659269e7 Add error message when we can't load a file. 2013-09-06 01:39:23 -04:00
Pavel Krajcevski
c367d11e9d Formatting 2013-09-06 01:39:11 -04:00
Pavel Krajcevski
9b7bb2cbc7 Add hooks to support outputing images whose pixels are not in block-stream order 2013-09-06 01:38:52 -04:00
Pavel Krajcevski
a6e6138084 Change the lerp function to be more explicit. 2013-09-05 14:49:56 -04:00
Pavel Krajcevski
b8e155e11c Switch red and blue channels in our decompressor test. 2013-09-05 14:49:08 -04:00
Pavel Krajcevski
7b72a84d87 Add a working directory for PVR lib tests
Unfortunately, the WORKING_DIRECTORY directive for ADD_TEST seems to be broken as of CMake 2.8.10, fortunately there was a mail thread about this issue in 2.6 so I was able to implement the workaround.
2013-09-04 20:43:49 -04:00
Pavel Krajcevski
6149c0af3a Add PVR tests
If cmake was able to find Imagination's PVR library, then it'd be nice to make sure that our decompressor matches theirs. We incur a bit of overhead by adding .pvr files into git, but hopefully this cost will be beneficial to actually figuring out how things are working...
2013-09-04 20:21:56 -04:00
Pavel Krajcevski
052157ea49 Rename our tests to start with the prefix 'Test' 2013-09-04 20:21:28 -04:00
Pavel Krajcevski
abd4ba8b54 Abstract away some utilities that we can use across all of our tests, and add a test for a gray image. The test currently seems to be failing, which is likely due to a bug in our bit depth manipulation code. 2013-09-04 20:20:37 -04:00
Pavel Krajcevski
669b2c0934 Reverse the order for modulating our bits... I'm not convinced that this is right 2013-09-04 20:18:43 -04:00
Pavel Krajcevski
34ab853a62 Make sure to take into account the interleaved nature of the blocks when decompressing 2013-09-04 20:18:03 -04:00
Pavel Krajcevski
bb525ae9dc If all of the PVR blocks are the same then we don't need so much code. 2013-09-04 15:28:51 -04:00
Pavel Krajcevski
9273625eeb Add initial decompressor test 2013-09-02 19:14:50 -04:00
Pavel Krajcevski
4bbd80aab2 Make sure to preserve bit depth when bilinearly upscaling 2013-09-02 19:14:31 -04:00
Pavel Krajcevski
3f4ffa61b5 Reverse byte order (and interpret the data as a 64 bit word) for PVRTC blocks 2013-09-02 19:13:53 -04:00
Pavel Krajcevski
df81c73456 Default wrap mode to clamp 2013-09-02 19:12:43 -04:00
Pavel Krajcevski
4913435119 Add paths to look for PVR library in cmake 2013-09-02 16:04:47 -04:00
Pavel Krajcevski
6642b64c78 Make sure that on MSVC platforms we force shared CRT to be consistent with other CMake defaults. 2013-09-01 10:19:03 -04:00
Pavel Krajcevski
5cde88d3b7 Add Image tests 2013-08-31 18:31:38 -04:00
Pavel Krajcevski
1d25e31d2a Bilinear upscale bug fixes. 2013-08-31 18:30:47 -04:00
Pavel Krajcevski
40b479487c Add accessors for image dimensions 2013-08-31 17:05:26 -04:00
Pavel Krajcevski
36641c2268 Don't set all of the memory to zero when we specify an image without any pixels 2013-08-31 16:43:32 -04:00
Pavel Krajcevski
992c72e4b5 Fix asserts 2013-08-31 16:40:49 -04:00
Pavel Krajcevski
fa37aba768 Add comparison operator for pixels 2013-08-31 16:37:58 -04:00
Pavel Krajcevski
8bf682f04e Add comment for RGBA packing 2013-08-31 16:37:40 -04:00
Pavel Krajcevski
b3a07e21f7 Add assignment operator 2013-08-31 16:37:07 -04:00
Pavel Krajcevski
26005bfd27 Disambiguate the Image.h from PVRTCEncoder and Core 2013-08-31 16:36:10 -04:00
Pavel Krajcevski
21199bc264 Add Pixel tests 2013-08-31 16:06:00 -04:00
Pavel Krajcevski
8c2127c08a When packing ARGB pixels make sure to convert them to 8-bit depth first 2013-08-31 16:05:50 -04:00
Pavel Krajcevski
1ffbdea2b8 Make sure to handle 0 bit depth a bit more gracefully 2013-08-31 16:05:28 -04:00
Pavel Krajcevski
9a0fbebac3 Fix bug when going from smaller to higher bit depth 2013-08-31 16:04:58 -04:00
Pavel Krajcevski
ad17404bf7 Begin counting the bits from the beginning of the byte stream. The way I was doing it before was silly... 2013-08-31 14:33:44 -04:00