Skip to content

Commit

Permalink
Integrate a slightly modified version of Mozilla's patch for precompu…
Browse files Browse the repository at this point in the history
…ting the bit-counting LUT. This is useful if the table needs to be shared among multiple processes, although the primary reason for doing that is reduced footprint on mobile devices, which are probably already covered by the clz intrinsic code.

git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/trunk@1221 632fc199-4ca6-4c93-a231-07263d6284db
  • Loading branch information
dcommander committed Mar 28, 2014
1 parent 0cfc4c1 commit ef9a4e0
Show file tree
Hide file tree
Showing 2 changed files with 4,099 additions and 13 deletions.
14 changes: 1 addition & 13 deletions jchuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@
#define JPEG_NBITS_NONZERO(x) (32 - __builtin_clz(x))
#define JPEG_NBITS(x) (x ? JPEG_NBITS_NONZERO(x) : 0)
#else
static unsigned char jpeg_nbits_table[65536];
static int jpeg_nbits_table_init = 0;
#include "jpeg_nbits_table.h"
#define JPEG_NBITS(x) (jpeg_nbits_table[x])
#define JPEG_NBITS_NONZERO(x) JPEG_NBITS(x)
#endif
Expand Down Expand Up @@ -299,17 +298,6 @@ jpeg_make_c_derived_tbl (j_compress_ptr cinfo, boolean isDC, int tblno,
dtbl->ehufco[i] = huffcode[p];
dtbl->ehufsi[i] = huffsize[p];
}

#ifndef USE_CLZ_INTRINSIC
if(!jpeg_nbits_table_init) {
for(i = 0; i < 65536; i++) {
int nbits = 0, temp = i;
while (temp) {temp >>= 1; nbits++;}
jpeg_nbits_table[i] = nbits;
}
jpeg_nbits_table_init = 1;
}
#endif
}


Expand Down
Loading

0 comments on commit ef9a4e0

Please sign in to comment.