Changeset 290 for libmpc/branches/r2d/libmpcdec/huffman.c
- Timestamp:
- 04/23/07 16:47:30 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libmpc/branches/r2d/libmpcdec/huffman.c
r288 r290 38 38 39 39 // sv7 huffman tables 40 const mpc_huffman mpc_table_HuffHdr [10] = {40 static const mpc_huffman mpc_table_HuffHdr [10] = { 41 41 {0x8000, 1, 0}, {0x6000, 3, 1}, {0x5e00, 7, -4}, {0x5d80, 9, 3}, {0x5d00, 9, 4}, {0x5c00, 8, -5}, {0x5800, 6, 2}, {0x5000, 5, -3}, {0x4000, 4, -2}, {0x0, 2, -1} 42 42 }; 43 mpc_lut_data mpc_HuffHdr = {mpc_table_HuffHdr}; 43 44 44 45 const mpc_huffman mpc_table_HuffSCFI [4] = { … … 46 47 }; 47 48 48 const mpc_huffman mpc_table_HuffDSCF [16] = {49 static const mpc_huffman mpc_table_HuffDSCF [16] = { 49 50 {0xf800, 5, 5}, {0xf000, 5, -4}, {0xe000, 4, 3}, {0xd000, 4, -3}, {0xc000, 4, 8}, {0xa000, 3, 1}, {0x9000, 4, 0}, {0x8800, 5, -5}, {0x8400, 6, 7}, {0x8000, 6, -7}, {0x6000, 3, -1}, {0x4000, 3, 2}, {0x3000, 4, 4}, {0x2800, 5, 6}, {0x2000, 5, -6}, {0x0, 3, -2} 50 51 }; 52 mpc_lut_data mpc_HuffDSCF = {mpc_table_HuffDSCF}; 51 53 52 54 static const mpc_huffman mpc_table_HuffQ1 [2] [27] = { … … 106 108 }; 107 109 108 const mpc_huffman* mpc_table_HuffQ [2] [8] = { 109 {0,mpc_table_HuffQ1[0],mpc_table_HuffQ2[0],mpc_table_HuffQ3[0],mpc_table_HuffQ4[0],mpc_table_HuffQ5[0],mpc_table_HuffQ6[0],mpc_table_HuffQ7[0]}, 110 {0,mpc_table_HuffQ1[1],mpc_table_HuffQ2[1],mpc_table_HuffQ3[1],mpc_table_HuffQ4[1],mpc_table_HuffQ5[1],mpc_table_HuffQ6[1],mpc_table_HuffQ7[1]}, 110 mpc_lut_data mpc_HuffQ [7] [2] = { 111 {{mpc_table_HuffQ1[0]}, {mpc_table_HuffQ1[1]}}, 112 {{mpc_table_HuffQ2[0]}, {mpc_table_HuffQ2[1]}}, 113 {{mpc_table_HuffQ3[0]}, {mpc_table_HuffQ3[1]}}, 114 {{mpc_table_HuffQ4[0]}, {mpc_table_HuffQ4[1]}}, 115 {{mpc_table_HuffQ5[0]}, {mpc_table_HuffQ5[1]}}, 116 {{mpc_table_HuffQ6[0]}, {mpc_table_HuffQ6[1]}}, 117 {{mpc_table_HuffQ7[0]}, {mpc_table_HuffQ7[1]}} 111 118 }; 112 119 113 120 114 121 // sv8 huffman tables 115 const mpc_huffman mpc_table_HuffSCFI_1 [4] = {122 static const mpc_huffman mpc_table_HuffSCFI_1 [4] = { 116 123 {0x8000, 1, 2}, {0x4000, 2, 3}, {0x2000, 3, 1}, {0x0000, 3, 0} 117 124 }; 118 119 const mpc_huffman mpc_table_HuffSCFI_2 [16] = { 125 mpc_lut_data mpc_HuffSCFI_1 = {mpc_table_HuffSCFI_1}; 126 127 static const mpc_huffman mpc_table_HuffSCFI_2 [16] = { 120 128 {0xc000, 2, 15}, {0x8000, 2, 10}, {0x6000, 3, 14}, {0x4000, 3, 11}, {0x3800, 5, 13}, {0x3000, 5, 9}, {0x2800, 5, 7}, {0x2000, 5, 6}, {0x1800, 5, 5}, {0x1400, 6, 12}, {0x1000, 6, 8}, {0x0c00, 6, 3}, {0x0800, 6, 2}, {0x0400, 6, 0}, {0x0200, 7, 4}, {0x0000, 7, 1} 121 129 }; 122 123 const mpc_huffman mpc_table_HuffDSCF_1 [64] = { 130 mpc_lut_data mpc_HuffSCFI_2 = {mpc_table_HuffSCFI_2}; 131 132 static const mpc_huffman mpc_table_HuffDSCF_1 [64] = { 124 133 {0xe000, 3, 35}, {0xc000, 3, 34}, {0xa000, 3, 33}, {0x9000, 4, 36}, {0x8000, 4, 32}, {0x7000, 4, 30}, {0x6000, 4, 29}, {0x5000, 4, 27}, {0x4000, 4, 26}, {0x3800, 5, 37}, {0x3000, 5, 28}, {0x2800, 5, 25}, {0x2400, 6, 39}, {0x2000, 6, 38}, {0x1c00, 6, 24}, {0x1800, 6, 23}, {0x1600, 7, 40}, {0x1400, 7, 22}, {0x1200, 7, 21}, {0x1000, 7, 20}, {0x0e00, 7, 19}, {0x0d00, 8, 43}, {0x0c00, 8, 42}, {0x0b00, 8, 41}, {0x0a00, 8, 18}, {0x0900, 8, 17}, {0x0800, 8, 16}, {0x0700, 8, 15}, {0x0680, 9, 46}, {0x0600, 9, 45}, {0x0580, 9, 44}, {0x0500, 9, 14}, {0x0480, 9, 13}, {0x0400, 9, 12}, {0x0380, 9, 11}, {0x0340, 10, 49}, {0x0300, 10, 48}, {0x02c0, 10, 47}, {0x0280, 10, 31}, {0x0240, 10, 10}, {0x0200, 10, 9}, {0x01c0, 10, 8}, {0x0180, 10, 7}, {0x0140, 10, 6}, {0x0120, 11, 52}, {0x0100, 11, 51}, {0x00e0, 11, 50}, {0x00c0, 11, 5}, {0x00a0, 11, 4}, {0x0080, 11, 3}, {0x0070, 12, 54}, {0x0060, 12, 53}, {0x0050, 12, 2}, {0x0040, 12, 1}, {0x0030, 12, 0}, {0x0028, 13, 57}, {0x0020, 13, 56}, {0x0018, 13, 55}, {0x0014, 14, 63}, {0x0010, 14, 62}, {0x000c, 14, 61}, {0x0008, 14, 60}, {0x0004, 14, 59}, {0x0000, 14, 58} 125 134 }; 126 127 const mpc_huffman mpc_table_HuffDSCF_2 [65] = { 135 mpc_lut_data mpc_HuffDSCF_1 = {mpc_table_HuffDSCF_1}; 136 137 static const mpc_huffman mpc_table_HuffDSCF_2 [65] = { 128 138 {0xe000, 3, 33}, {0xc000, 3, 32}, {0xa000, 3, 31}, {0x8000, 3, 30}, {0x6000, 3, 29}, {0x5000, 4, 34}, {0x4000, 4, 28}, {0x3000, 4, 27}, {0x2800, 5, 36}, {0x2000, 5, 35}, {0x1800, 5, 26}, {0x1400, 6, 37}, {0x1000, 6, 25}, {0x0e00, 7, 38}, {0x0c00, 7, 24}, {0x0a00, 7, 23}, {0x0900, 8, 40}, {0x0800, 8, 39}, {0x0700, 8, 22}, {0x0600, 8, 21}, {0x0580, 9, 42}, {0x0500, 9, 41}, {0x0480, 9, 20}, {0x0400, 9, 19}, {0x0380, 9, 18}, {0x0340, 10, 45}, {0x0300, 10, 44}, {0x02c0, 10, 43}, {0x0280, 10, 17}, {0x0240, 10, 16}, {0x0200, 10, 15}, {0x01c0, 10, 14}, {0x01a0, 11, 48}, {0x0180, 11, 47}, {0x0160, 11, 46}, {0x0140, 11, 13}, {0x0120, 11, 12}, {0x0100, 11, 11}, {0x00e0, 11, 10}, {0x00d0, 12, 64}, {0x00c0, 12, 52}, {0x00b0, 12, 51}, {0x00a0, 12, 50}, {0x0090, 12, 49}, {0x0080, 12, 9}, {0x0070, 12, 8}, {0x0060, 12, 7}, {0x0050, 12, 6}, {0x0048, 13, 55}, {0x0040, 13, 54}, {0x0038, 13, 53}, {0x0030, 13, 5}, {0x0028, 13, 4}, {0x0020, 13, 3}, {0x001c, 14, 58}, {0x0018, 14, 57}, {0x0014, 14, 56}, {0x0010, 14, 2}, {0x000c, 14, 1}, {0x000a, 15, 63}, {0x0008, 15, 62}, {0x0006, 15, 61}, {0x0004, 15, 60}, {0x0002, 15, 59}, {0x0000, 15, 0} 129 139 }; 140 mpc_lut_data mpc_HuffDSCF_2 = {mpc_table_HuffDSCF_2}; 130 141 131 142 const mpc_huffman mpc_table_HuffBands [33] = { … … 133 144 }; 134 145 135 const mpc_huffman mpc_table_HuffRes [2] [17] = {146 static const mpc_huffman mpc_table_HuffRes [2] [17] = { 136 147 { 137 148 {0x8000, 1, 0}, {0x4000, 2, 1}, {0x2000, 3, 16}, {0x1000, 4, 2}, {0x0800, 5, 3}, {0x0400, 6, 4}, {0x0200, 7, 5}, {0x0100, 8, 15}, {0x0080, 9, 6}, {0x0040, 10, 7}, {0x0020, 11, 8}, {0x0010, 12, 9}, {0x0008, 13, 10}, {0x0004, 14, 11}, {0x0002, 15, 12}, {0x0001, 16, 14}, {0x0000, 16, 13} … … 140 151 } 141 152 }; 153 mpc_lut_data mpc_HuffRes[2] = {{mpc_table_HuffRes[0]}, {mpc_table_HuffRes[1]}}; 142 154 143 155 static const mpc_huffman mpc_table_HuffQ1_8 [19] = { … … 153 165 }; 154 166 155 const mpc_huffman mpc_table_HuffQ3_8 [49] = {167 static const mpc_huffman mpc_table_HuffQ3_8 [49] = { 156 168 {0xe000, 3, 0}, {0xd000, 4, 17}, {0xc000, 4, 16}, {0xb000, 4, 1}, {0xa000, 4, 15}, {0x9000, 4, -16}, {0x8000, 4, -1}, {0x7800, 5, 32}, {0x7000, 5, 31}, {0x6800, 5, 2}, {0x6000, 5, 14}, {0x5800, 5, -15}, {0x5000, 5, -32}, {0x4c00, 6, 34}, {0x4800, 6, 33}, {0x4400, 6, 47}, {0x4000, 6, 46}, {0x3c00, 6, 18}, {0x3800, 6, 30}, {0x3400, 6, -14}, {0x3000, 6, -2}, {0x2c00, 6, -31}, {0x2800, 6, -17}, {0x2400, 6, -18}, {0x2200, 7, 49}, {0x2000, 7, 48}, {0x1e00, 7, 63}, {0x1c00, 7, 19}, {0x1a00, 7, 29}, {0x1800, 7, 3}, {0x1600, 7, 13}, {0x1400, 7, -13}, {0x1200, 7, -3}, {0x1000, 7, -30}, {0xe00, 7, -47}, {0xc00, 7, -48}, {0xa00, 7, -33}, {0x900, 8, 50}, {0x800, 8, 62}, {0x700, 8, 35}, {0x600, 8, 45}, {0x500, 8, -29}, {0x400, 8, -19}, {0x300, 8, -46}, {0x200, 8, -34}, {0x180, 9, 51}, {0x100, 9, 61}, {0x80, 9, -45}, {0x0, 9, -35} 157 169 }; 158 170 159 const mpc_huffman mpc_table_HuffQ4_8 [91] = {171 static const mpc_huffman mpc_table_HuffQ4_8 [91] = { 160 172 {0xf000, 4, 0}, {0xe800, 5, 32}, {0xe000, 5, 17}, {0xd800, 5, 16}, {0xd000, 5, 31}, {0xc800, 5, 2}, {0xc000, 5, 1}, {0xb800, 5, 15}, {0xb000, 5, 14}, {0xa800, 5, -15}, {0xa000, 5, -16}, {0x9800, 5, -1}, {0x9000, 5, -32}, {0x8c00, 6, 49}, {0x8800, 6, 48}, {0x8400, 6, 34}, {0x8000, 6, 33}, {0x7c00, 6, 47}, {0x7800, 6, 46}, {0x7400, 6, 19}, {0x7000, 6, 18}, {0x6c00, 6, 30}, {0x6800, 6, 29}, {0x6400, 6, 3}, {0x6000, 6, 13}, {0x5c00, 6, -13}, {0x5800, 6, -14}, {0x5400, 6, -2}, {0x5000, 6, -3}, {0x4c00, 6, -30}, {0x4800, 6, -31}, {0x4400, 6, -17}, {0x4000, 6, -18}, {0x3c00, 6, -47}, {0x3800, 6, -48}, {0x3400, 6, -33}, {0x3200, 7, 64}, {0x3000, 7, 50}, {0x2e00, 7, 63}, {0x2c00, 7, 62}, {0x2a00, 7, 35}, {0x2800, 7, 45}, {0x2600, 7, 4}, {0x2400, 7, 12}, {0x2200, 7, -29}, {0x2000, 7, -19}, {0x1e00, 7, -46}, {0x1c00, 7, -34}, {0x1a00, 7, -64}, {0x1800, 7, -49}, {0x1700, 8, 66}, {0x1600, 8, 65}, {0x1500, 8, 79}, {0x1400, 8, 78}, {0x1300, 8, 51}, {0x1200, 8, 61}, {0x1100, 8, 36}, {0x1000, 8, 44}, {0xf00, 8, 20}, {0xe00, 8, 28}, {0xd00, 8, -12}, {0xc00, 8, -4}, {0xb00, 8, -28}, {0xa00, 8, -20}, {0x900, 8, -45}, {0x800, 8, -35}, {0x700, 8, -62}, {0x600, 8, -63}, {0x500, 8, -50}, {0x480, 9, 67}, {0x400, 9, 77}, {0x380, 9, 52}, {0x300, 9, 60}, {0x280, 9, -44}, {0x200, 9, -36}, {0x180, 9, -61}, {0x100, 9, -51}, {0xc0, 10, 68}, {0x80, 10, 76}, {0x40, 10, -60}, {0x0, 10, -52}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0}, {0x0, 0, 0} 161 173 }; … … 193 205 }; 194 206 195 const mpc_huffman mpc_table_HuffQ9up_8 [256] = {207 static const mpc_huffman mpc_table_HuffQ9up_8 [256] = { 196 208 {0xfc00, 6, -128}, {0xf800, 6, 127}, {0xf600, 7, -108}, {0xf400, 7, -110}, {0xf200, 7, -111}, {0xf000, 7, -112}, {0xee00, 7, -113}, {0xec00, 7, -114}, {0xea00, 7, -115}, {0xe800, 7, -116}, {0xe600, 7, -117}, {0xe400, 7, -118}, {0xe200, 7, -119}, {0xe000, 7, -120}, {0xde00, 7, -121}, {0xdc00, 7, -122}, {0xda00, 7, -123}, {0xd800, 7, -124}, {0xd600, 7, -125}, {0xd400, 7, -126}, {0xd200, 7, -127}, {0xd000, 7, 126}, {0xce00, 7, 125}, {0xcc00, 7, 124}, {0xca00, 7, 123}, {0xc800, 7, 122}, {0xc600, 7, 121}, {0xc400, 7, 120}, {0xc200, 7, 119}, {0xc000, 7, 118}, {0xbe00, 7, 117}, {0xbc00, 7, 116}, {0xba00, 7, 115}, {0xb800, 7, 114}, {0xb600, 7, 113}, {0xb400, 7, 112}, {0xb200, 7, 111}, {0xb000, 7, 110}, {0xae00, 7, 109}, {0xac00, 7, 108}, {0xab00, 8, -44}, {0xaa00, 8, -45}, {0xa900, 8, -46}, {0xa800, 8, -47}, {0xa700, 8, -48}, {0xa600, 8, -49}, {0xa500, 8, -50}, {0xa400, 8, -51}, {0xa300, 8, -52}, {0xa200, 8, -53}, {0xa100, 8, -54}, {0xa000, 8, -55}, {0x9f00, 8, -56}, {0x9e00, 8, -57}, {0x9d00, 8, -58}, {0x9c00, 8, -59}, {0x9b00, 8, -60}, {0x9a00, 8, -61}, {0x9900, 8, -62}, {0x9800, 8, -63}, {0x9700, 8, -64}, {0x9600, 8, -65}, {0x9500, 8, -66}, {0x9400, 8, -67}, {0x9300, 8, -68}, {0x9200, 8, -69}, {0x9100, 8, -70}, {0x9000, 8, -71}, {0x8f00, 8, -72}, {0x8e00, 8, -73}, {0x8d00, 8, -74}, {0x8c00, 8, -75}, {0x8b00, 8, -76}, {0x8a00, 8, -77}, {0x8900, 8, -78}, {0x8800, 8, -79}, {0x8700, 8, -80}, {0x8600, 8, -81}, {0x8500, 8, -82}, {0x8400, 8, -83}, {0x8300, 8, -84}, {0x8200, 8, -85}, {0x8100, 8, -86}, {0x8000, 8, -87}, {0x7f00, 8, -88}, {0x7e00, 8, -89}, {0x7d00, 8, -90}, {0x7c00, 8, -91}, {0x7b00, 8, -92}, {0x7a00, 8, -93}, {0x7900, 8, -94}, {0x7800, 8, -95}, {0x7700, 8, -96}, {0x7600, 8, -97}, {0x7500, 8, -98}, {0x7400, 8, -99}, {0x7300, 8, -100}, {0x7200, 8, -101}, {0x7100, 8, -102}, {0x7000, 8, -103}, {0x6f00, 8, -104}, {0x6e00, 8, -105}, {0x6d00, 8, -106}, {0x6c00, 8, -107}, {0x6b00, 8, -109}, {0x6a00, 8, 107}, {0x6900, 8, 106}, {0x6800, 8, 105}, {0x6700, 8, 104}, {0x6600, 8, 103}, {0x6500, 8, 102}, {0x6400, 8, 101}, {0x6300, 8, 100}, {0x6200, 8, 99}, {0x6100, 8, 98}, {0x6000, 8, 97}, {0x5f00, 8, 96}, {0x5e00, 8, 95}, {0x5d00, 8, 94}, {0x5c00, 8, 93}, {0x5b00, 8, 92}, {0x5a00, 8, 91}, {0x5900, 8, 90}, {0x5800, 8, 89}, {0x5700, 8, 88}, {0x5600, 8, 87}, {0x5500, 8, 86}, {0x5400, 8, 85}, {0x5300, 8, 84}, {0x5200, 8, 83}, {0x5100, 8, 82}, {0x5000, 8, 81}, {0x4f00, 8, 80}, {0x4e00, 8, 79}, {0x4d00, 8, 78}, {0x4c00, 8, 77}, {0x4b00, 8, 76}, {0x4a00, 8, 75}, {0x4900, 8, 74}, {0x4800, 8, 73}, {0x4700, 8, 72}, {0x4600, 8, 71}, {0x4500, 8, 70}, {0x4400, 8, 69}, {0x4300, 8, 68}, {0x4200, 8, 67}, {0x4100, 8, 66}, {0x4000, 8, 65}, {0x3f00, 8, 64}, {0x3e00, 8, 63}, {0x3d00, 8, 62}, {0x3c00, 8, 61}, {0x3b00, 8, 60}, {0x3a00, 8, 59}, {0x3900, 8, 58}, {0x3800, 8, 57}, {0x3700, 8, 56}, {0x3600, 8, 55}, {0x3500, 8, 54}, {0x3400, 8, 53}, {0x3300, 8, 52}, {0x3200, 8, 51}, {0x3100, 8, 50}, {0x3000, 8, 49}, {0x2f00, 8, 48}, {0x2e00, 8, 47}, {0x2d00, 8, 46}, {0x2c00, 8, 45}, {0x2b00, 8, 44}, {0x2a00, 8, 43}, {0x2900, 8, 42}, {0x2800, 8, 40}, {0x2700, 8, 20}, {0x2600, 8, 19}, {0x2580, 9, -7}, {0x2500, 9, -8}, {0x2480, 9, -9}, {0x2400, 9, -10}, {0x2380, 9, -11}, {0x2300, 9, -12}, {0x2280, 9, -13}, {0x2200, 9, -14}, {0x2180, 9, -15}, {0x2100, 9, -16}, {0x2080, 9, -17}, {0x2000, 9, -18}, {0x1f80, 9, -19}, {0x1f00, 9, -20}, {0x1e80, 9, -21}, {0x1e00, 9, -22}, {0x1d80, 9, -23}, {0x1d00, 9, -24}, {0x1c80, 9, -25}, {0x1c00, 9, -26}, {0x1b80, 9, -27}, {0x1b00, 9, -28}, {0x1a80, 9, -29}, {0x1a00, 9, -30}, {0x1980, 9, -31}, {0x1900, 9, -32}, {0x1880, 9, -33}, {0x1800, 9, -34}, {0x1780, 9, -35}, {0x1700, 9, -36}, {0x1680, 9, -37}, {0x1600, 9, -38}, {0x1580, 9, -39}, {0x1500, 9, -40}, {0x1480, 9, -41}, {0x1400, 9, -42}, {0x1380, 9, -43}, {0x1300, 9, 41}, {0x1280, 9, 39}, {0x1200, 9, 38}, {0x1180, 9, 37}, {0x1100, 9, 36}, {0x1080, 9, 35}, {0x1000, 9, 34}, {0xf80, 9, 33}, {0xf00, 9, 32}, {0xe80, 9, 31}, {0xe00, 9, 30}, {0xd80, 9, 29}, {0xd00, 9, 28}, {0xc80, 9, 27}, {0xc00, 9, 26}, {0xb80, 9, 25}, {0xb00, 9, 24}, {0xa80, 9, 23}, {0xa00, 9, 22}, {0x980, 9, 21}, {0x900, 9, 18}, {0x880, 9, 17}, {0x800, 9, 16}, {0x780, 9, 15}, {0x700, 9, 14}, {0x680, 9, 13}, {0x600, 9, 12}, {0x580, 9, 11}, {0x500, 9, 10}, {0x480, 9, 9}, {0x400, 9, 8}, {0x380, 9, 7}, {0x300, 9, 6}, {0x280, 9, 5}, {0x240, 10, -3}, {0x200, 10, -4}, {0x1c0, 10, -5}, {0x180, 10, -6}, {0x140, 10, 4}, {0x100, 10, 3}, {0xc0, 10, 2}, {0x80, 10, 1}, {0x40, 10, 0}, {0x20, 11, -1}, {0x0, 11, -2} 197 209 }; 198 199 const mpc_huffman* mpc_table_HuffQ_8 [2] [8] = { 200 {mpc_table_HuffQ1_8,mpc_table_HuffQ2_8[0],mpc_table_HuffQ3_8,mpc_table_HuffQ4_8,mpc_table_HuffQ5_8[0],mpc_table_HuffQ6_8[0],mpc_table_HuffQ7_8[0], mpc_table_HuffQ8_8[0]}, 201 {mpc_table_HuffQ1_8,mpc_table_HuffQ2_8[1],mpc_table_HuffQ3_8,mpc_table_HuffQ4_8,mpc_table_HuffQ5_8[1],mpc_table_HuffQ6_8[1],mpc_table_HuffQ7_8[1], mpc_table_HuffQ8_8[1]} 202 }; 210 mpc_lut_data mpc_HuffQ9up_8 = {mpc_table_HuffQ9up_8}; 211 212 213 // FIXME : some memory is vasted here 214 mpc_lut_data mpc_HuffQ_8 [8] [2] = { 215 {{mpc_table_HuffQ1_8}, {mpc_table_HuffQ1_8}}, 216 {{mpc_table_HuffQ2_8[0]}, {mpc_table_HuffQ2_8[1]}}, 217 {{mpc_table_HuffQ3_8}, {mpc_table_HuffQ3_8}}, 218 {{mpc_table_HuffQ4_8}, {mpc_table_HuffQ4_8}}, 219 {{mpc_table_HuffQ5_8[0]}, {mpc_table_HuffQ5_8[1]}}, 220 {{mpc_table_HuffQ6_8[0]}, {mpc_table_HuffQ6_8[1]}}, 221 {{mpc_table_HuffQ7_8[0]}, {mpc_table_HuffQ7_8[1]}}, 222 {{mpc_table_HuffQ8_8[0]}, {mpc_table_HuffQ8_8[1]}} 223 }; 224 225 static void huff_fill_lut(const mpc_huffman * table, mpc_huff_lut * lut, const int bits) 226 { 227 int i, idx = 0; 228 const int shift = 16 - bits; 229 for (i = (1 << bits) - 1; i >= 0 ; i--) { 230 if ((table[idx].Code >> shift) < i) { 231 lut[i].Length = table[idx].Length; 232 lut[i].Value = table[idx].Value; 233 } else { 234 if (table[idx].Length <= bits) { 235 lut[i].Length = table[idx].Length; 236 lut[i].Value = table[idx].Value; 237 } else { 238 lut[i].Length = 0; 239 lut[i].Value = idx; 240 } 241 if (i != 0) 242 do { 243 idx++; 244 } while ((table[idx].Code >> shift) == i); 245 } 246 } 247 } 248 249 void huff_init_lut(const int bits) 250 { 251 int i, j; 252 253 huff_fill_lut(mpc_HuffDSCF.table, mpc_HuffDSCF.lut, bits); 254 huff_fill_lut(mpc_HuffHdr.table, mpc_HuffHdr.lut, bits); 255 256 huff_fill_lut(mpc_HuffSCFI_1.table, mpc_HuffSCFI_1.lut, bits); 257 huff_fill_lut(mpc_HuffSCFI_2.table, mpc_HuffSCFI_2.lut, bits); 258 huff_fill_lut(mpc_HuffDSCF_1.table, mpc_HuffDSCF_1.lut, bits); 259 huff_fill_lut(mpc_HuffDSCF_2.table, mpc_HuffDSCF_2.lut, bits); 260 huff_fill_lut(mpc_HuffRes[0].table, mpc_HuffRes[0].lut, bits); 261 huff_fill_lut(mpc_HuffRes[1].table, mpc_HuffRes[1].lut, bits); 262 huff_fill_lut(mpc_HuffQ9up_8.table, mpc_HuffQ9up_8.lut, bits); 263 264 265 for( i = 0; i < 8; i++){ 266 for( j = 0; j < 2; j++){ 267 huff_fill_lut(mpc_HuffQ_8[i][j].table, mpc_HuffQ_8[i][j].lut, bits); 268 if (i != 7) huff_fill_lut(mpc_HuffQ[i][j].table, mpc_HuffQ[i][j].lut, bits); 269 } 270 } 271 } 272 273
Note: See TracChangeset
for help on using the changeset viewer.