media/libjpeg/jaricom.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libjpeg/jaricom.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,153 @@
     1.4 +/*
     1.5 + * jaricom.c
     1.6 + *
     1.7 + * Developed 1997-2009 by Guido Vollbeding.
     1.8 + * This file is part of the Independent JPEG Group's software.
     1.9 + * For conditions of distribution and use, see the accompanying README file.
    1.10 + *
    1.11 + * This file contains probability estimation tables for common use in
    1.12 + * arithmetic entropy encoding and decoding routines.
    1.13 + *
    1.14 + * This data represents Table D.2 in the JPEG spec (ISO/IEC IS 10918-1
    1.15 + * and CCITT Recommendation ITU-T T.81) and Table 24 in the JBIG spec
    1.16 + * (ISO/IEC IS 11544 and CCITT Recommendation ITU-T T.82).
    1.17 + */
    1.18 +
    1.19 +#define JPEG_INTERNALS
    1.20 +#include "jinclude.h"
    1.21 +#include "jpeglib.h"
    1.22 +
    1.23 +/* The following #define specifies the packing of the four components
    1.24 + * into the compact INT32 representation.
    1.25 + * Note that this formula must match the actual arithmetic encoder
    1.26 + * and decoder implementation.  The implementation has to be changed
    1.27 + * if this formula is changed.
    1.28 + * The current organization is leaned on Markus Kuhn's JBIG
    1.29 + * implementation (jbig_tab.c).
    1.30 + */
    1.31 +
    1.32 +#define V(i,a,b,c,d) (((INT32)a << 16) | ((INT32)c << 8) | ((INT32)d << 7) | b)
    1.33 +
    1.34 +const INT32 jpeg_aritab[113+1] = {
    1.35 +/*
    1.36 + * Index, Qe_Value, Next_Index_LPS, Next_Index_MPS, Switch_MPS
    1.37 + */
    1.38 +  V(   0, 0x5a1d,   1,   1, 1 ),
    1.39 +  V(   1, 0x2586,  14,   2, 0 ),
    1.40 +  V(   2, 0x1114,  16,   3, 0 ),
    1.41 +  V(   3, 0x080b,  18,   4, 0 ),
    1.42 +  V(   4, 0x03d8,  20,   5, 0 ),
    1.43 +  V(   5, 0x01da,  23,   6, 0 ),
    1.44 +  V(   6, 0x00e5,  25,   7, 0 ),
    1.45 +  V(   7, 0x006f,  28,   8, 0 ),
    1.46 +  V(   8, 0x0036,  30,   9, 0 ),
    1.47 +  V(   9, 0x001a,  33,  10, 0 ),
    1.48 +  V(  10, 0x000d,  35,  11, 0 ),
    1.49 +  V(  11, 0x0006,   9,  12, 0 ),
    1.50 +  V(  12, 0x0003,  10,  13, 0 ),
    1.51 +  V(  13, 0x0001,  12,  13, 0 ),
    1.52 +  V(  14, 0x5a7f,  15,  15, 1 ),
    1.53 +  V(  15, 0x3f25,  36,  16, 0 ),
    1.54 +  V(  16, 0x2cf2,  38,  17, 0 ),
    1.55 +  V(  17, 0x207c,  39,  18, 0 ),
    1.56 +  V(  18, 0x17b9,  40,  19, 0 ),
    1.57 +  V(  19, 0x1182,  42,  20, 0 ),
    1.58 +  V(  20, 0x0cef,  43,  21, 0 ),
    1.59 +  V(  21, 0x09a1,  45,  22, 0 ),
    1.60 +  V(  22, 0x072f,  46,  23, 0 ),
    1.61 +  V(  23, 0x055c,  48,  24, 0 ),
    1.62 +  V(  24, 0x0406,  49,  25, 0 ),
    1.63 +  V(  25, 0x0303,  51,  26, 0 ),
    1.64 +  V(  26, 0x0240,  52,  27, 0 ),
    1.65 +  V(  27, 0x01b1,  54,  28, 0 ),
    1.66 +  V(  28, 0x0144,  56,  29, 0 ),
    1.67 +  V(  29, 0x00f5,  57,  30, 0 ),
    1.68 +  V(  30, 0x00b7,  59,  31, 0 ),
    1.69 +  V(  31, 0x008a,  60,  32, 0 ),
    1.70 +  V(  32, 0x0068,  62,  33, 0 ),
    1.71 +  V(  33, 0x004e,  63,  34, 0 ),
    1.72 +  V(  34, 0x003b,  32,  35, 0 ),
    1.73 +  V(  35, 0x002c,  33,   9, 0 ),
    1.74 +  V(  36, 0x5ae1,  37,  37, 1 ),
    1.75 +  V(  37, 0x484c,  64,  38, 0 ),
    1.76 +  V(  38, 0x3a0d,  65,  39, 0 ),
    1.77 +  V(  39, 0x2ef1,  67,  40, 0 ),
    1.78 +  V(  40, 0x261f,  68,  41, 0 ),
    1.79 +  V(  41, 0x1f33,  69,  42, 0 ),
    1.80 +  V(  42, 0x19a8,  70,  43, 0 ),
    1.81 +  V(  43, 0x1518,  72,  44, 0 ),
    1.82 +  V(  44, 0x1177,  73,  45, 0 ),
    1.83 +  V(  45, 0x0e74,  74,  46, 0 ),
    1.84 +  V(  46, 0x0bfb,  75,  47, 0 ),
    1.85 +  V(  47, 0x09f8,  77,  48, 0 ),
    1.86 +  V(  48, 0x0861,  78,  49, 0 ),
    1.87 +  V(  49, 0x0706,  79,  50, 0 ),
    1.88 +  V(  50, 0x05cd,  48,  51, 0 ),
    1.89 +  V(  51, 0x04de,  50,  52, 0 ),
    1.90 +  V(  52, 0x040f,  50,  53, 0 ),
    1.91 +  V(  53, 0x0363,  51,  54, 0 ),
    1.92 +  V(  54, 0x02d4,  52,  55, 0 ),
    1.93 +  V(  55, 0x025c,  53,  56, 0 ),
    1.94 +  V(  56, 0x01f8,  54,  57, 0 ),
    1.95 +  V(  57, 0x01a4,  55,  58, 0 ),
    1.96 +  V(  58, 0x0160,  56,  59, 0 ),
    1.97 +  V(  59, 0x0125,  57,  60, 0 ),
    1.98 +  V(  60, 0x00f6,  58,  61, 0 ),
    1.99 +  V(  61, 0x00cb,  59,  62, 0 ),
   1.100 +  V(  62, 0x00ab,  61,  63, 0 ),
   1.101 +  V(  63, 0x008f,  61,  32, 0 ),
   1.102 +  V(  64, 0x5b12,  65,  65, 1 ),
   1.103 +  V(  65, 0x4d04,  80,  66, 0 ),
   1.104 +  V(  66, 0x412c,  81,  67, 0 ),
   1.105 +  V(  67, 0x37d8,  82,  68, 0 ),
   1.106 +  V(  68, 0x2fe8,  83,  69, 0 ),
   1.107 +  V(  69, 0x293c,  84,  70, 0 ),
   1.108 +  V(  70, 0x2379,  86,  71, 0 ),
   1.109 +  V(  71, 0x1edf,  87,  72, 0 ),
   1.110 +  V(  72, 0x1aa9,  87,  73, 0 ),
   1.111 +  V(  73, 0x174e,  72,  74, 0 ),
   1.112 +  V(  74, 0x1424,  72,  75, 0 ),
   1.113 +  V(  75, 0x119c,  74,  76, 0 ),
   1.114 +  V(  76, 0x0f6b,  74,  77, 0 ),
   1.115 +  V(  77, 0x0d51,  75,  78, 0 ),
   1.116 +  V(  78, 0x0bb6,  77,  79, 0 ),
   1.117 +  V(  79, 0x0a40,  77,  48, 0 ),
   1.118 +  V(  80, 0x5832,  80,  81, 1 ),
   1.119 +  V(  81, 0x4d1c,  88,  82, 0 ),
   1.120 +  V(  82, 0x438e,  89,  83, 0 ),
   1.121 +  V(  83, 0x3bdd,  90,  84, 0 ),
   1.122 +  V(  84, 0x34ee,  91,  85, 0 ),
   1.123 +  V(  85, 0x2eae,  92,  86, 0 ),
   1.124 +  V(  86, 0x299a,  93,  87, 0 ),
   1.125 +  V(  87, 0x2516,  86,  71, 0 ),
   1.126 +  V(  88, 0x5570,  88,  89, 1 ),
   1.127 +  V(  89, 0x4ca9,  95,  90, 0 ),
   1.128 +  V(  90, 0x44d9,  96,  91, 0 ),
   1.129 +  V(  91, 0x3e22,  97,  92, 0 ),
   1.130 +  V(  92, 0x3824,  99,  93, 0 ),
   1.131 +  V(  93, 0x32b4,  99,  94, 0 ),
   1.132 +  V(  94, 0x2e17,  93,  86, 0 ),
   1.133 +  V(  95, 0x56a8,  95,  96, 1 ),
   1.134 +  V(  96, 0x4f46, 101,  97, 0 ),
   1.135 +  V(  97, 0x47e5, 102,  98, 0 ),
   1.136 +  V(  98, 0x41cf, 103,  99, 0 ),
   1.137 +  V(  99, 0x3c3d, 104, 100, 0 ),
   1.138 +  V( 100, 0x375e,  99,  93, 0 ),
   1.139 +  V( 101, 0x5231, 105, 102, 0 ),
   1.140 +  V( 102, 0x4c0f, 106, 103, 0 ),
   1.141 +  V( 103, 0x4639, 107, 104, 0 ),
   1.142 +  V( 104, 0x415e, 103,  99, 0 ),
   1.143 +  V( 105, 0x5627, 105, 106, 1 ),
   1.144 +  V( 106, 0x50e7, 108, 107, 0 ),
   1.145 +  V( 107, 0x4b85, 109, 103, 0 ),
   1.146 +  V( 108, 0x5597, 110, 109, 0 ),
   1.147 +  V( 109, 0x504f, 111, 107, 0 ),
   1.148 +  V( 110, 0x5a10, 110, 111, 1 ),
   1.149 +  V( 111, 0x5522, 112, 109, 0 ),
   1.150 +  V( 112, 0x59eb, 112, 111, 1 ),
   1.151 +/*
   1.152 + * This last entry is used for fixed probability estimate of 0.5
   1.153 + * as recommended in Section 10.3 Table 5 of ITU-T Rec. T.851.
   1.154 + */
   1.155 +  V( 113, 0x5a1d, 113, 113, 0 )
   1.156 +};

mercurial