From 87375f4c149217b4752e269ba9866602c74d788d Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Tue, 28 Aug 2012 19:38:06 -0400 Subject: [PATCH] Change signed to unsigned in order to match the function pointer typedef prototype. Changed the function prototype to match that of the typedef in the rest of the library, and fixed a bug where we would iterate too far with the initial buffer. --- BPTCEncoder/include/BC7Compressor.h | 6 +++--- BPTCEncoder/src/BC7Compressor.cpp | 4 ++-- BPTCEncoder/src/BC7CompressorSIMD.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/BPTCEncoder/include/BC7Compressor.h b/BPTCEncoder/include/BC7Compressor.h index 22eb2ce..b05b574 100755 --- a/BPTCEncoder/include/BC7Compressor.h +++ b/BPTCEncoder/include/BC7Compressor.h @@ -50,12 +50,12 @@ namespace BC7C // Compress the image given as RGBA data to BC7 format. Width and Height are the dimensions of // the image in pixels. - void CompressImageBC7(const unsigned char *inBuf, unsigned char *outBuf, int width, int height); + void CompressImageBC7(const unsigned char *inBuf, unsigned char *outBuf, unsigned int width, unsigned int height); // Compress the image given as RGBA data to BC7 format using an algorithm optimized for SIMD // enabled platforms. Width and Height are the dimensions of the image in pixels. - void CompressImageBC7SIMD(const unsigned char* inBuf, unsigned char* outBuf, int width, int height); + void CompressImageBC7SIMD(const unsigned char* inBuf, unsigned char* outBuf, unsigned int width, unsigned int height); // Decompress the image given as BC7 data to R8G8B8A8 format. Width and Height are the dimensions of the image in pixels. - void DecompressImageBC7SIMD(const unsigned char* inBuf, unsigned char* outBuf, int width, int height); + void DecompressImageBC7SIMD(const unsigned char* inBuf, unsigned char* outBuf, unsigned int width, unsigned int height); } diff --git a/BPTCEncoder/src/BC7Compressor.cpp b/BPTCEncoder/src/BC7Compressor.cpp index cfd7c8b..32ec122 100755 --- a/BPTCEncoder/src/BC7Compressor.cpp +++ b/BPTCEncoder/src/BC7Compressor.cpp @@ -1392,13 +1392,13 @@ namespace BC7C // 4-byte RGBA format. The width and height parameters specify the size of the image in pixels. // The buffer pointed to by outBuf should be large enough to store the compressed image. This // implementation has an 4:1 compression ratio. - void CompressImageBC7(const uint8* inBuf, uint8* outBuf, int width, int height) + void CompressImageBC7(const unsigned char *inBuf, unsigned char *outBuf, unsigned int width, unsigned int height) { uint32 block[16]; BC7CompressionMode::ResetNumUses(); BC7CompressionMode::MaxAnnealingIterations = min(BC7CompressionMode::kMaxAnnealingIterations, GetQualityLevel()); - for(int j = 0; j < height; j += 4, inBuf += width * 4 * 4) + for(int j = 0; j < height; j += 4) { for(int i = 0; i < width; i += 4) { diff --git a/BPTCEncoder/src/BC7CompressorSIMD.cpp b/BPTCEncoder/src/BC7CompressorSIMD.cpp index f357900..c84784c 100755 --- a/BPTCEncoder/src/BC7CompressorSIMD.cpp +++ b/BPTCEncoder/src/BC7CompressorSIMD.cpp @@ -978,7 +978,7 @@ namespace BC7C // 4-byte RGBA format. The width and height parameters specify the size of the image in pixels. // The buffer pointed to by outBuf should be large enough to store the compressed image. This // implementation has an 4:1 compression ratio. - void CompressImageBC7SIMD(const uint8* inBuf, uint8* outBuf, int width, int height) + void CompressImageBC7SIMD(const unsigned char *inBuf, unsigned char *outBuf, unsigned int width, unsigned int height) { ALIGN_SSE uint32 block[16]; @@ -987,7 +987,7 @@ namespace BC7C BC7CompressionModeSIMD::MaxAnnealingIterations = GetQualityLevel(); - for(int j = 0; j < height; j += 4, inBuf += width * 4 * 4) + for(int j = 0; j < height; j += 4) { for(int i = 0; i < width; i += 4) {