| 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 * Copyright (C) 2009-2011, D. R. Commander. | 5 * Copyright (C) 2009-2011, D. R. Commander. |
| 6 * This file is part of the Independent JPEG Group's software. | 6 * This file is part of the Independent JPEG Group's software. |
| 7 * For conditions of distribution and use, see the accompanying README file. | 7 * For conditions of distribution and use, see the accompanying README file. |
| 8 * | 8 * |
| 9 * This file contains Huffman entropy decoding routines. | 9 * This file contains Huffman entropy decoding routines. |
| 10 * | 10 * |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 int usefast = 1; | 751 int usefast = 1; |
| 752 | 752 |
| 753 /* Process restart marker if needed; may have to suspend */ | 753 /* Process restart marker if needed; may have to suspend */ |
| 754 if (cinfo->restart_interval) { | 754 if (cinfo->restart_interval) { |
| 755 if (entropy->restarts_to_go == 0) | 755 if (entropy->restarts_to_go == 0) |
| 756 if (! process_restart(cinfo)) | 756 if (! process_restart(cinfo)) |
| 757 return FALSE; | 757 return FALSE; |
| 758 usefast = 0; | 758 usefast = 0; |
| 759 } | 759 } |
| 760 | 760 |
| 761 if (cinfo->src->bytes_in_buffer < BUFSIZE * cinfo->blocks_in_MCU | 761 if (cinfo->src->bytes_in_buffer < BUFSIZE * (size_t)cinfo->blocks_in_MCU |
| 762 || cinfo->unread_marker != 0) | 762 || cinfo->unread_marker != 0) |
| 763 usefast = 0; | 763 usefast = 0; |
| 764 | 764 |
| 765 /* If we've run out of data, just leave the MCU set to zeroes. | 765 /* If we've run out of data, just leave the MCU set to zeroes. |
| 766 * This way, we return uniform gray for the remainder of the segment. | 766 * This way, we return uniform gray for the remainder of the segment. |
| 767 */ | 767 */ |
| 768 if (! entropy->pub.insufficient_data) { | 768 if (! entropy->pub.insufficient_data) { |
| 769 | 769 |
| 770 if (usefast) { | 770 if (usefast) { |
| 771 if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow; | 771 if (!decode_mcu_fast(cinfo, MCU_data)) goto use_slow; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 799 SIZEOF(huff_entropy_decoder)); | 799 SIZEOF(huff_entropy_decoder)); |
| 800 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; | 800 cinfo->entropy = (struct jpeg_entropy_decoder *) entropy; |
| 801 entropy->pub.start_pass = start_pass_huff_decoder; | 801 entropy->pub.start_pass = start_pass_huff_decoder; |
| 802 entropy->pub.decode_mcu = decode_mcu; | 802 entropy->pub.decode_mcu = decode_mcu; |
| 803 | 803 |
| 804 /* Mark tables unallocated */ | 804 /* Mark tables unallocated */ |
| 805 for (i = 0; i < NUM_HUFF_TBLS; i++) { | 805 for (i = 0; i < NUM_HUFF_TBLS; i++) { |
| 806 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; | 806 entropy->dc_derived_tbls[i] = entropy->ac_derived_tbls[i] = NULL; |
| 807 } | 807 } |
| 808 } | 808 } |
| OLD | NEW |