Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | diff -up8 jchuff.c jchuff.c |
michael@0 | 2 | --- jchuff.c 2012-12-30 21:42:18 -0500 |
michael@0 | 3 | +++ jchuff.c 2013-02-16 19:37:01 -0500 |
michael@0 | 4 | @@ -17,18 +17,20 @@ |
michael@0 | 5 | */ |
michael@0 | 6 | |
michael@0 | 7 | #define JPEG_INTERNALS |
michael@0 | 8 | #include "jinclude.h" |
michael@0 | 9 | #include "jpeglib.h" |
michael@0 | 10 | #include "jchuff.h" /* Declarations shared with jcphuff.c */ |
michael@0 | 11 | #include <limits.h> |
michael@0 | 12 | |
michael@0 | 13 | -static unsigned char jpeg_nbits_table[65536]; |
michael@0 | 14 | -static int jpeg_nbits_table_init = 0; |
michael@0 | 15 | +static const unsigned char jpeg_nbits_table[65536] = { |
michael@0 | 16 | +/* Number i needs jpeg_nbits_table[i] bits to be represented. */ |
michael@0 | 17 | +#include "jpeg_nbits_table.h" |
michael@0 | 18 | +}; |
michael@0 | 19 | |
michael@0 | 20 | #ifndef min |
michael@0 | 21 | #define min(a,b) ((a)<(b)?(a):(b)) |
michael@0 | 22 | #endif |
michael@0 | 23 | |
michael@0 | 24 | |
michael@0 | 25 | /* Expanded entropy encoder object for Huffman encoding. |
michael@0 | 26 | * |
michael@0 | 27 | @@ -266,25 +268,16 @@ jpeg_make_c_derived_tbl (j_compress_ptr |
michael@0 | 28 | |
michael@0 | 29 | for (p = 0; p < lastp; p++) { |
michael@0 | 30 | i = htbl->huffval[p]; |
michael@0 | 31 | if (i < 0 || i > maxsymbol || dtbl->ehufsi[i]) |
michael@0 | 32 | ERREXIT(cinfo, JERR_BAD_HUFF_TABLE); |
michael@0 | 33 | dtbl->ehufco[i] = huffcode[p]; |
michael@0 | 34 | dtbl->ehufsi[i] = huffsize[p]; |
michael@0 | 35 | } |
michael@0 | 36 | - |
michael@0 | 37 | - if(!jpeg_nbits_table_init) { |
michael@0 | 38 | - for(i = 0; i < 65536; i++) { |
michael@0 | 39 | - int nbits = 0, temp = i; |
michael@0 | 40 | - while (temp) {temp >>= 1; nbits++;} |
michael@0 | 41 | - jpeg_nbits_table[i] = nbits; |
michael@0 | 42 | - } |
michael@0 | 43 | - jpeg_nbits_table_init = 1; |
michael@0 | 44 | - } |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | |
michael@0 | 48 | /* Outputting bytes to the file */ |
michael@0 | 49 | |
michael@0 | 50 | /* Emit a byte, taking 'action' if must suspend. */ |
michael@0 | 51 | #define emit_byte(state,val,action) \ |
michael@0 | 52 | { *(state)->next_output_byte++ = (JOCTET) (val); \ |
michael@0 | 53 | diff -up8 jmorecfg.h jmorecfg.h |
michael@0 | 54 | --- jmorecfg.h 2013-01-06 12:59:42 -0500 |
michael@0 | 55 | +++ jmorecfg.h 2013-02-16 19:37:01 -0500 |
michael@0 | 56 | @@ -7,16 +7,17 @@ |
michael@0 | 57 | * Copyright (C) 2009, 2011, D. R. Commander. |
michael@0 | 58 | * For conditions of distribution and use, see the accompanying README file. |
michael@0 | 59 | * |
michael@0 | 60 | * This file contains additional configuration options that customize the |
michael@0 | 61 | * JPEG software for special applications or support machine-dependent |
michael@0 | 62 | * optimizations. Most users will not need to touch this file. |
michael@0 | 63 | */ |
michael@0 | 64 | |
michael@0 | 65 | +#include <stdint.h> |
michael@0 | 66 | |
michael@0 | 67 | /* |
michael@0 | 68 | * Define BITS_IN_JSAMPLE as either |
michael@0 | 69 | * 8 for 8-bit sample values (the usual setting) |
michael@0 | 70 | * 12 for 12-bit sample values |
michael@0 | 71 | * Only 8 and 12 are legal data precisions for lossy JPEG according to the |
michael@0 | 72 | * JPEG standard, and the IJG code does not support anything else! |
michael@0 | 73 | * We do not support run-time selection of data precision, sorry. |
michael@0 | 74 | @@ -128,45 +129,29 @@ typedef char JOCTET; |
michael@0 | 75 | * They must be at least as wide as specified; but making them too big |
michael@0 | 76 | * won't cost a huge amount of memory, so we don't provide special |
michael@0 | 77 | * extraction code like we did for JSAMPLE. (In other words, these |
michael@0 | 78 | * typedefs live at a different point on the speed/space tradeoff curve.) |
michael@0 | 79 | */ |
michael@0 | 80 | |
michael@0 | 81 | /* UINT8 must hold at least the values 0..255. */ |
michael@0 | 82 | |
michael@0 | 83 | -#ifdef HAVE_UNSIGNED_CHAR |
michael@0 | 84 | -typedef unsigned char UINT8; |
michael@0 | 85 | -#else /* not HAVE_UNSIGNED_CHAR */ |
michael@0 | 86 | -#ifdef __CHAR_UNSIGNED__ |
michael@0 | 87 | -typedef char UINT8; |
michael@0 | 88 | -#else /* not __CHAR_UNSIGNED__ */ |
michael@0 | 89 | -typedef short UINT8; |
michael@0 | 90 | -#endif /* __CHAR_UNSIGNED__ */ |
michael@0 | 91 | -#endif /* HAVE_UNSIGNED_CHAR */ |
michael@0 | 92 | +typedef uint8_t UINT8; |
michael@0 | 93 | |
michael@0 | 94 | /* UINT16 must hold at least the values 0..65535. */ |
michael@0 | 95 | |
michael@0 | 96 | -#ifdef HAVE_UNSIGNED_SHORT |
michael@0 | 97 | -typedef unsigned short UINT16; |
michael@0 | 98 | -#else /* not HAVE_UNSIGNED_SHORT */ |
michael@0 | 99 | -typedef unsigned int UINT16; |
michael@0 | 100 | -#endif /* HAVE_UNSIGNED_SHORT */ |
michael@0 | 101 | +typedef uint16_t UINT16; |
michael@0 | 102 | |
michael@0 | 103 | /* INT16 must hold at least the values -32768..32767. */ |
michael@0 | 104 | |
michael@0 | 105 | -#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */ |
michael@0 | 106 | -typedef short INT16; |
michael@0 | 107 | -#endif |
michael@0 | 108 | +typedef int16_t INT16; |
michael@0 | 109 | |
michael@0 | 110 | /* INT32 must hold at least signed 32-bit values. */ |
michael@0 | 111 | |
michael@0 | 112 | -#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */ |
michael@0 | 113 | -typedef long INT32; |
michael@0 | 114 | -#endif |
michael@0 | 115 | +typedef int32_t INT32; |
michael@0 | 116 | |
michael@0 | 117 | /* Datatype used for image dimensions. The JPEG standard only supports |
michael@0 | 118 | * images up to 64K*64K due to 16-bit fields in SOF markers. Therefore |
michael@0 | 119 | * "unsigned int" is sufficient on all machines. However, if you need to |
michael@0 | 120 | * handle larger images and you don't mind deviating from the spec, you |
michael@0 | 121 | * can change this datatype. |
michael@0 | 122 | */ |
michael@0 | 123 |