Mercurial > projects > dwt-linux
comparison dwt/internal/image/JPEGDecoder.d @ 240:ce446666f5a2
Update to SWT 3.4M7
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 12 May 2008 19:13:01 +0200 |
parents | 380bad9f6852 |
children | c0d810de7093 |
comparison
equal
deleted
inserted
replaced
239:06a1f6829310 | 240:ce446666f5a2 |
---|---|
977 } | 977 } |
978 } | 978 } |
979 r = s >> 4; | 979 r = s >> 4; |
980 s &= 15; | 980 s &= 15; |
981 if (s !is 0) { | 981 if (s !is 0) { |
982 if (s !is 1) { /* size of new coef should always be 1 */ | 982 if (s !is 1) { /* size of new coef should always be 1 */ |
983 // WARNMS(cinfo, JWRN_HUFF_BAD_CODE); | 983 // WARNMS(cinfo, JWRN_HUFF_BAD_CODE); |
984 } | 984 } |
985 // CHECK_BIT_BUFFER(br_state, 1, goto undoit); | 985 // CHECK_BIT_BUFFER(br_state, 1, goto undoit); |
986 { | 986 { |
987 if (bits_left < (1)) { | 987 if (bits_left < (1)) { |
1240 } else { | 1240 } else { |
1241 if (r is 15) { /* ZRL */ | 1241 if (r is 15) { /* ZRL */ |
1242 k += 15; /* skip 15 zeroes in band */ | 1242 k += 15; /* skip 15 zeroes in band */ |
1243 } else { /* EOBr, run length is 2^r + appended bits */ | 1243 } else { /* EOBr, run length is 2^r + appended bits */ |
1244 EOBRUN = 1 << r; | 1244 EOBRUN = 1 << r; |
1245 if (r !is 0) { /* EOBr, r > 0 */ | 1245 if (r !is 0) { /* EOBr, r > 0 */ |
1246 // CHECK_BIT_BUFFER(br_state, r, return FALSE); | 1246 // CHECK_BIT_BUFFER(br_state, r, return FALSE); |
1247 { | 1247 { |
1248 if (bits_left < (r)) { | 1248 if (bits_left < (r)) { |
1249 if (! jpeg_fill_bit_buffer(br_state,get_buffer,bits_left,r)) { | 1249 if (! jpeg_fill_bit_buffer(br_state,get_buffer,bits_left,r)) { |
1250 return false; | 1250 return false; |
1278 entropy.restarts_to_go--; | 1278 entropy.restarts_to_go--; |
1279 | 1279 |
1280 return true; | 1280 return true; |
1281 } | 1281 } |
1282 | 1282 |
1283 bool decode_mcu_DC_first (jpeg_decompress_struct cinfo, short[][] MCU_data) { | 1283 bool decode_mcu_DC_first (jpeg_decompress_struct cinfo, short[][] MCU_data) { |
1284 phuff_entropy_decoder entropy = this; | 1284 phuff_entropy_decoder entropy = this; |
1285 int Al = cinfo.Al; | 1285 int Al = cinfo.Al; |
1286 int s = 0, r; | 1286 int s = 0, r; |
1287 int blkn, ci; | 1287 int blkn, ci; |
1288 short[] block; | 1288 short[] block; |
1642 int row_index; /* cur row's vertical index in dither matrix */ | 1642 int row_index; /* cur row's vertical index in dither matrix */ |
1643 // ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */ | 1643 // ODITHER_MATRIX_PTR odither[MAX_Q_COMPS]; /* one dither array per component */ |
1644 | 1644 |
1645 /* Variables for Floyd-Steinberg dithering */ | 1645 /* Variables for Floyd-Steinberg dithering */ |
1646 // FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ | 1646 // FSERRPTR fserrors[MAX_Q_COMPS]; /* accumulated errors */ |
1647 bool on_odd_row; | 1647 bool on_odd_row; |
1648 | 1648 |
1649 void start_pass (jpeg_decompress_struct cinfo, bool is_pre_scan) { | 1649 void start_pass (jpeg_decompress_struct cinfo, bool is_pre_scan) { |
1650 error(); | 1650 error(); |
1651 } | 1651 } |
1652 } | 1652 } |
4446 huffval[i] = cinfo.buffer[cinfo.bytes_offset++]; | 4446 huffval[i] = cinfo.buffer[cinfo.bytes_offset++]; |
4447 } | 4447 } |
4448 | 4448 |
4449 length -= count; | 4449 length -= count; |
4450 | 4450 |
4451 if ((index & 0x10) !is 0) { /* AC table definition */ | 4451 if ((index & 0x10) !is 0) { /* AC table definition */ |
4452 index -= 0x10; | 4452 index -= 0x10; |
4453 htblptr = cinfo.ac_huff_tbl_ptrs[index] = new JHUFF_TBL(); | 4453 htblptr = cinfo.ac_huff_tbl_ptrs[index] = new JHUFF_TBL(); |
4454 } else { /* DC table definition */ | 4454 } else { /* DC table definition */ |
4455 htblptr = cinfo.dc_huff_tbl_ptrs[index] = new JHUFF_TBL(); | 4455 htblptr = cinfo.dc_huff_tbl_ptrs[index] = new JHUFF_TBL(); |
4456 } | 4456 } |
5235 if (((data[12] & 0xFF) | (data[13]) & 0xFF) !is 0) { | 5235 if (((data[12] & 0xFF) | (data[13]) & 0xFF) !is 0) { |
5236 // TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, | 5236 // TRACEMS2(cinfo, 1, JTRC_JFIF_THUMBNAIL, |
5237 // GETJOCTET(data[12]), GETJOCTET(data[13])); | 5237 // GETJOCTET(data[12]), GETJOCTET(data[13])); |
5238 } | 5238 } |
5239 totallen -= APP0_DATA_LEN; | 5239 totallen -= APP0_DATA_LEN; |
5240 if (totallen !is ((data[12] & 0xFF) * (data[13] & 0xFF) * 3)) { | 5240 if (totallen !is ((data[12] & 0xFF) * (data[13] & 0xFF) * 3)) { |
5241 // TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, cast(int) totallen); | 5241 // TRACEMS1(cinfo, 1, JTRC_JFIF_BADTHUMBNAILSIZE, cast(int) totallen); |
5242 } | 5242 } |
5243 } else if (datalen >= 6 && | 5243 } else if (datalen >= 6 && |
5244 (data[0] & 0xFF) is 0x4A && | 5244 (data[0] & 0xFF) is 0x4A && |
5245 (data[1] & 0xFF) is 0x46 && | 5245 (data[1] & 0xFF) is 0x46 && |