| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jdhuff.c | 2 * jdhuff.c |
| 3 * | 3 * |
| 4 * Copyright (C) 1991-1997, Thomas G. Lane. | 4 * Copyright (C) 1991-1997, Thomas G. Lane. |
| 5 * This file is part of the Independent JPEG Group's software. | 5 * This file is part of the Independent JPEG Group's software. |
| 6 * For conditions of distribution and use, see the accompanying README file. | 6 * For conditions of distribution and use, see the accompanying README file. |
| 7 * | 7 * |
| 8 * This file contains Huffman entropy decoding routines. | 8 * This file contains Huffman entropy decoding routines. |
| 9 * | 9 * |
| 10 * Much of the complexity here has to do with supporting input suspension. | 10 * Much of the complexity here has to do with supporting input suspension. |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 size = symbol >> 8; \ | 651 size = symbol >> 8; \ |
| 652 bits_left -= size; \ | 652 bits_left -= size; \ |
| 653 symbol = symbol & ((1 << HUFF_LOOKAHEAD) - 1); \ | 653 symbol = symbol & ((1 << HUFF_LOOKAHEAD) - 1); \ |
| 654 if (size == HUFF_LOOKAHEAD + 1) { \ | 654 if (size == HUFF_LOOKAHEAD + 1) { \ |
| 655 symbol = (get_buffer >> bits_left) & ((1 << (size)) - 1); \ | 655 symbol = (get_buffer >> bits_left) & ((1 << (size)) - 1); \ |
| 656 while (symbol > htbl->maxcode[size]) { \ | 656 while (symbol > htbl->maxcode[size]) { \ |
| 657 symbol <<= 1; \ | 657 symbol <<= 1; \ |
| 658 symbol |= GET_BITS(1); \ | 658 symbol |= GET_BITS(1); \ |
| 659 size++; \ | 659 size++; \ |
| 660 } \ | 660 } \ |
| 661 symbol = htbl->pub->huffval[ (int) (symbol + htbl->valoffset[size]) ]; \ | 661 symbol = htbl->pub->huffval[ (int) (symbol + htbl->valoffset[size]) & 0xFF ]
; \ |
| 662 } \ | 662 } \ |
| 663 } | 663 } |
| 664 | 664 |
| 665 /***************************************************************/ | 665 /***************************************************************/ |
| 666 | 666 |
| 667 LOCAL(boolean) | 667 LOCAL(boolean) |
| 668 decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | 668 decode_mcu_fast (j_decompress_ptr cinfo, JBLOCKROW *MCU_data) |
| 669 { | 669 { |
| 670 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; | 670 huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy; |
| 671 BITREAD_STATE_VARS; | 671 BITREAD_STATE_VARS; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 SIZEOF(huff_entropy_decoder)); | 815 SIZEOF(huff_entropy_decoder)); |
| 816 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; | 816 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; |
| 817 entropy->pub.start_pass = start_pass_huff_decoder; | 817 entropy->pub.start_pass = start_pass_huff_decoder; |
| 818 entropy->pub.decode_mcu = decode_mcu; | 818 entropy->pub.decode_mcu = decode_mcu; |
| 819 | 819 |
| 820 /* Mark tables unallocated */ | 820 /* Mark tables unallocated */ |
| 821 for (i = 0; i < NUM_HUFF_TBLS; i++) { | 821 for (i = 0; i < NUM_HUFF_TBLS; i++) { |
| 822 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; | 822 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; |
| 823 } | 823 } |
| 824 } | 824 } |
| OLD | NEW |