Skip to content
Myr

Merge branch 'stb_image_write_optimization' of https://github.com/jarnoh/stb into working

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sean Barrett · committed by Sean Barrett · parents 619cdb6, 60a5755 · Browse files · 1 file+12 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+12 added−0 removed

  • other:+12 added−0 removed

1 file+12 added−0 removed

modified:stb_image_write.h+12 added
971 unmodified lines
972}973974static unsigned int stbiw__crc32(unsigned char *buffer, int len)975{976#ifdef STBIW_CRC32977 return STBIW_CRC32(buffer, len);978#else979 static unsigned int crc_table[256] =980 {981 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,982 0x0eDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
33 unmodified lines
1016 int i;1017 for (i=0; i < len; ++i)1018 crc = (crc >> 8) ^ crc_table[buffer[i] ^ (crc & 0xff)];1019 return ~crc;1020#endif1021}10221023#define stbiw__wpng4(o,a,b,c,d) ((o)[0]=STBIW_UCHAR(a),(o)[1]=STBIW_UCHAR(b),(o)[2]=STBIW_UCHAR(c),(o)[3]=STBIW_UCHAR(d),(o)+=4)1024#define stbiw__wp32(data,v) stbiw__wpng4(data, (v)>>24,(v)>>16,(v)>>8,(v));
22 unmodified lines
1047 int i;1048 int type = mymap[filter_type];1049 unsigned char *z = pixels + stride_bytes * (stbi__flip_vertically_on_write ? height-1-y : y);1050 int signed_stride = stbi__flip_vertically_on_write ? -stride_bytes : stride_bytes;1051 1052 // sorry for not optimizing the other paths1053 if(type==0)1054 {1055 memcpy(line_buffer, z, width*n);1056 return;1057 }1058 1059 for (i = 0; i < n; ++i) {1060 switch (type) {1061 case 0: line_buffer[i] = z[i]; break;1062 case 1: line_buffer[i] = z[i]; break;
566 unmodified lines