Browse Source

Renamed data types to standard names

pull/382/head
Ray San 7 years ago
parent
commit
3c3d56bb4a
1 changed files with 23 additions and 23 deletions
  1. +23
    -23
      src/external/rgif.h

+ 23
- 23
src/external/rgif.h View File

@ -150,7 +150,7 @@ typedef struct GifBitStatus {
// The LZW dictionary is a 256-ary tree constructed
// as the file is encoded, this is one node
typedef struct GifLzwNode {
n">uint16_t m_next[256];
kt">unsigned short m_next[256];
} GifLzwNode;
//----------------------------------------------------------------------------------
@ -299,9 +299,9 @@ static void GifGetClosestPaletteColor(GifPalette *pPal, int r, int g, int b, int
if (ind == gifTransparentIndex) return;
// check whether this color is better than the current winner
int r_err = r - ((n">int32_t)pPal->r[ind]);
int g_err = g - ((n">int32_t)pPal->g[ind]);
int b_err = b - ((n">int32_t)pPal->b[ind]);
int r_err = r - ((kt">int)pPal->r[ind]);
int g_err = g - ((kt">int)pPal->g[ind]);
int b_err = b - ((kt">int)pPal->b[ind]);
int diff = GIFABS(r_err)+GIFABS(g_err)+GIFABS(b_err);
if (diff < *bestDiff)
@ -463,7 +463,7 @@ static void GifSplitPalette(unsigned char *image, int numPixels, int firstElt, i
}
// otherwise, take the average of all colors in this subcube
n">uint64_t r=0, g=0, b=0;
kt">unsigned long long r=0, g=0, b=0;
for (int ii=0; ii<numPixels; ++ii)
{
r += image[ii*4+0];
@ -594,12 +594,12 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
// quantPixels initially holds color*256 for all pixels
// The extra 8 bits of precision allow for sub-single-color error values
// to be propagated
n">int32_t *quantPixels = (n">int32_t*)GIF_TEMP_MALLOC(sizeof(n">int32_t)*numPixels*4);
kt">int *quantPixels = (kt">int*)GIF_TEMP_MALLOC(sizeof(kt">int)*numPixels*4);
for (int ii=0; ii<numPixels*4; ++ii)
{
unsigned char pix = nextFrame[ii];
n">int32_t pix16 = (n">int32_t)pix*256;
kt">int pix16 = (kt">int)pix*256;
quantPixels[ii] = pix16;
}
@ -607,13 +607,13 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
{
for (unsigned int xx=0; xx<width; ++xx)
{
n">int32_t *nextPix = quantPixels + 4*(yy*width+xx);
kt">int *nextPix = quantPixels + 4*(yy*width+xx);
const unsigned char *lastPix = lastFrame? lastFrame + 4*(yy*width+xx) : NULL;
// Compute the colors we want (rounding to nearest)
n">int32_t rr = (nextPix[0] + 127) / 256;
n">int32_t gg = (nextPix[1] + 127) / 256;
n">int32_t bb = (nextPix[2] + 127) / 256;
kt">int rr = (nextPix[0] + 127) / 256;
kt">int gg = (nextPix[1] + 127) / 256;
kt">int bb = (nextPix[2] + 127) / 256;
// if it happens that we want the color from last frame, then just write out
// a transparent pixel
@ -629,16 +629,16 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
continue;
}
n">int32_t bestDiff = 1000000;
n">int32_t bestInd = gifTransparentIndex;
kt">int bestDiff = 1000000;
kt">int bestInd = gifTransparentIndex;
// Search the palete
GifGetClosestPaletteColor(pPal, rr, gg, bb, &bestInd, &bestDiff, 1);
// Write the result to the temp buffer
n">int32_t r_err = nextPix[0] - (n">int32_t)(pPal->r[bestInd])*256;
n">int32_t g_err = nextPix[1] - (n">int32_t)(pPal->g[bestInd])*256;
n">int32_t b_err = nextPix[2] - (n">int32_t)(pPal->b[bestInd])*256;
kt">int r_err = nextPix[0] - (kt">int)(pPal->r[bestInd])*256;
kt">int g_err = nextPix[1] - (kt">int)(pPal->g[bestInd])*256;
kt">int b_err = nextPix[2] - (kt">int)(pPal->b[bestInd])*256;
nextPix[0] = pPal->r[bestInd];
nextPix[1] = pPal->g[bestInd];
@ -654,7 +654,7 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
if (quantloc_7 < numPixels)
{
n">int32_t *pix7 = quantPixels+4*quantloc_7;
kt">int *pix7 = quantPixels+4*quantloc_7;
pix7[0] += GIFMAX(-pix7[0], r_err*7 / 16);
pix7[1] += GIFMAX(-pix7[1], g_err*7 / 16);
pix7[2] += GIFMAX(-pix7[2], b_err*7 / 16);
@ -662,7 +662,7 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
if (quantloc_3 < numPixels)
{
n">int32_t *pix3 = quantPixels+4*quantloc_3;
kt">int *pix3 = quantPixels+4*quantloc_3;
pix3[0] += GIFMAX(-pix3[0], r_err*3 / 16);
pix3[1] += GIFMAX(-pix3[1], g_err*3 / 16);
pix3[2] += GIFMAX(-pix3[2], b_err*3 / 16);
@ -670,7 +670,7 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
if (quantloc_5 < numPixels)
{
n">int32_t *pix5 = quantPixels+4*quantloc_5;
kt">int *pix5 = quantPixels+4*quantloc_5;
pix5[0] += GIFMAX(-pix5[0], r_err*5 / 16);
pix5[1] += GIFMAX(-pix5[1], g_err*5 / 16);
pix5[2] += GIFMAX(-pix5[2], b_err*5 / 16);
@ -678,7 +678,7 @@ static void GifDitherImage(const unsigned char *lastFrame, const unsigned char *
if (quantloc_1 < numPixels)
{
n">int32_t *pix1 = quantPixels+4*quantloc_1;
kt">int *pix1 = quantPixels+4*quantloc_1;
pix1[0] += GIFMAX(-pix1[0], r_err / 16);
pix1[1] += GIFMAX(-pix1[1], g_err / 16);
pix1[2] += GIFMAX(-pix1[2], b_err / 16);
@ -716,8 +716,8 @@ static void GifThresholdImage(const unsigned char *lastFrame, const unsigned cha
else
{
// palettize the pixel
n">int32_t bestDiff = 1000000;
n">int32_t bestInd = 1;
kt">int bestDiff = 1000000;
kt">int bestInd = 1;
GifGetClosestPaletteColor(pPal, nextFrame[0], nextFrame[1], nextFrame[2], &bestInd, &bestDiff, 1);
// Write the resulting color to the output buffer
@ -835,7 +835,7 @@ static void GifWriteLzwImage(FILE *f, unsigned char *image, unsigned int left, u
GifLzwNode *codetree = (GifLzwNode *)GIF_TEMP_MALLOC(sizeof(GifLzwNode)*4096);
memset(codetree, 0, sizeof(GifLzwNode)*4096);
n">int32_t curCode = -1;
kt">int curCode = -1;
unsigned int codeSize = minCodeSize + 1;
unsigned int maxCode = clearCode + 1;

Loading…
Cancel
Save