#include <string.h>
#include <stdint.h>
#include <getopt.h>
+#include <algorithm>
#include "libtxc_dxtn.h"
#include "s2tc_common.h"
}
pic = LoadTGA_BGRA(picdata, piclen);
+ for(int x = 0; x < image_width*image_height; ++x)
+ std::swap(pic[4*x], pic[4*x+2]);
+
int mipcount = 0;
while(image_width >= (1 << mipcount) || image_height >= (1 << mipcount))
++mipcount;
for (i = 0; i < width; i += 4) {
if (width > i + 3) numxpixels = 4;
else numxpixels = width - i;
- encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, -1);
+ encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, nrandom);
srcaddr += 4 * numxpixels;
blkaddr += 8;
}
for (i = 0; i < width; i += 4) {
if (width > i + 3) numxpixels = 4;
else numxpixels = width - i;
- encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, -1);
+ encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, nrandom);
srcaddr += 4 * numxpixels;
blkaddr += 16;
}
for (i = 0; i < width; i += 4) {
if (width > i + 3) numxpixels = 4;
else numxpixels = width - i;
- encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, -1);
+ encode_block(blkaddr, srcaddr, width, numxpixels, numypixels, nrandom);
srcaddr += 4 * numxpixels;
blkaddr += 16;
}