| OLD | NEW |
| 1 /* | 1 /* |
| 2 * jddctmgr.c | 2 * jddctmgr.c |
| 3 * | 3 * |
| 4 * Copyright (C) 1994-1996, Thomas G. Lane. | 4 * Copyright (C) 1994-1996, Thomas G. Lane. |
| 5 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB | 5 * Copyright 2009 Pierre Ossman <ossman@cendio.se> for Cendio AB |
| 6 * Copyright (C) 2010, D. R. Commander. |
| 6 * This file is part of the Independent JPEG Group's software. | 7 * This file is part of the Independent JPEG Group's software. |
| 7 * For conditions of distribution and use, see the accompanying README file. | 8 * For conditions of distribution and use, see the accompanying README file. |
| 8 * | 9 * |
| 9 * This file contains the inverse-DCT management logic. | 10 * This file contains the inverse-DCT management logic. |
| 10 * This code selects a particular IDCT implementation to be used, | 11 * This code selects a particular IDCT implementation to be used, |
| 11 * and it performs related housekeeping chores. No code in this file | 12 * and it performs related housekeeping chores. No code in this file |
| 12 * is executed per IDCT step, only during output pass setup. | 13 * is executed per IDCT step, only during output pass setup. |
| 13 * | 14 * |
| 14 * Note that the IDCT routines are responsible for performing coefficient | 15 * Note that the IDCT routines are responsible for performing coefficient |
| 15 * dequantization as well as the IDCT proper. This module sets up the | 16 * dequantization as well as the IDCT proper. This module sets up the |
| 16 * dequantization multiplier table needed by the IDCT routine. | 17 * dequantization multiplier table needed by the IDCT routine. |
| 17 */ | 18 */ |
| 18 | 19 |
| 19 #define JPEG_INTERNALS | 20 #define JPEG_INTERNALS |
| 20 #include "jinclude.h" | 21 #include "jinclude.h" |
| 21 #include "jpeglib.h" | 22 #include "jpeglib.h" |
| 22 #include "jdct.h" /* Private declarations for DCT subsystem */ | 23 #include "jdct.h" /* Private declarations for DCT subsystem */ |
| 23 #include "jsimddct.h" | 24 #include "jsimddct.h" |
| 25 #include "jpegcomp.h" |
| 24 | 26 |
| 25 | 27 |
| 26 /* | 28 /* |
| 27 * The decompressor input side (jdinput.c) saves away the appropriate | 29 * The decompressor input side (jdinput.c) saves away the appropriate |
| 28 * quantization table for each component at the start of the first scan | 30 * quantization table for each component at the start of the first scan |
| 29 * involving that component. (This is necessary in order to correctly | 31 * involving that component. (This is necessary in order to correctly |
| 30 * decode files that reuse Q-table slots.) | 32 * decode files that reuse Q-table slots.) |
| 31 * When we are ready to make an output pass, the saved Q-table is converted | 33 * When we are ready to make an output pass, the saved Q-table is converted |
| 32 * to a multiplier table that will actually be used by the IDCT routine. | 34 * to a multiplier table that will actually be used by the IDCT routine. |
| 33 * The multiplier table contents are IDCT-method-dependent. To support | 35 * The multiplier table contents are IDCT-method-dependent. To support |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 my_idct_ptr idct = (my_idct_ptr) cinfo->idct; | 95 my_idct_ptr idct = (my_idct_ptr) cinfo->idct; |
| 94 int ci, i; | 96 int ci, i; |
| 95 jpeg_component_info *compptr; | 97 jpeg_component_info *compptr; |
| 96 int method = 0; | 98 int method = 0; |
| 97 inverse_DCT_method_ptr method_ptr = NULL; | 99 inverse_DCT_method_ptr method_ptr = NULL; |
| 98 JQUANT_TBL * qtbl; | 100 JQUANT_TBL * qtbl; |
| 99 | 101 |
| 100 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; | 102 for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; |
| 101 ci++, compptr++) { | 103 ci++, compptr++) { |
| 102 /* Select the proper IDCT routine for this component's scaling */ | 104 /* Select the proper IDCT routine for this component's scaling */ |
| 103 switch (compptr->DCT_scaled_size) { | 105 switch (compptr->_DCT_scaled_size) { |
| 104 #ifdef IDCT_SCALING_SUPPORTED | 106 #ifdef IDCT_SCALING_SUPPORTED |
| 105 case 1: | 107 case 1: |
| 106 method_ptr = jpeg_idct_1x1; | 108 method_ptr = jpeg_idct_1x1; |
| 107 method = JDCT_ISLOW; /* jidctred uses islow-style table */ | 109 method = JDCT_ISLOW; /* jidctred uses islow-style table */ |
| 108 break; | 110 break; |
| 109 case 2: | 111 case 2: |
| 110 if (jsimd_can_idct_2x2()) | 112 if (jsimd_can_idct_2x2()) |
| 111 method_ptr = jsimd_idct_2x2; | 113 method_ptr = jsimd_idct_2x2; |
| 112 else | 114 else |
| 113 method_ptr = jpeg_idct_2x2; | 115 method_ptr = jpeg_idct_2x2; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 method_ptr = jpeg_idct_float; | 151 method_ptr = jpeg_idct_float; |
| 150 method = JDCT_FLOAT; | 152 method = JDCT_FLOAT; |
| 151 break; | 153 break; |
| 152 #endif | 154 #endif |
| 153 default: | 155 default: |
| 154 ERREXIT(cinfo, JERR_NOT_COMPILED); | 156 ERREXIT(cinfo, JERR_NOT_COMPILED); |
| 155 break; | 157 break; |
| 156 } | 158 } |
| 157 break; | 159 break; |
| 158 default: | 160 default: |
| 159 ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->DCT_scaled_size); | 161 ERREXIT1(cinfo, JERR_BAD_DCTSIZE, compptr->_DCT_scaled_size); |
| 160 break; | 162 break; |
| 161 } | 163 } |
| 162 idct->pub.inverse_DCT[ci] = method_ptr; | 164 idct->pub.inverse_DCT[ci] = method_ptr; |
| 163 /* Create multiplier table from quant table. | 165 /* Create multiplier table from quant table. |
| 164 * However, we can skip this if the component is uninteresting | 166 * However, we can skip this if the component is uninteresting |
| 165 * or if we already built the table. Also, if no quant table | 167 * or if we already built the table. Also, if no quant table |
| 166 * has yet been saved for the component, we leave the | 168 * has yet been saved for the component, we leave the |
| 167 * multiplier table all-zero; we'll be reading zeroes from the | 169 * multiplier table all-zero; we'll be reading zeroes from the |
| 168 * coefficient controller's buffer anyway. | 170 * coefficient controller's buffer anyway. |
| 169 */ | 171 */ |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 ci++, compptr++) { | 279 ci++, compptr++) { |
| 278 /* Allocate and pre-zero a multiplier table for each component */ | 280 /* Allocate and pre-zero a multiplier table for each component */ |
| 279 compptr->dct_table = | 281 compptr->dct_table = |
| 280 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, | 282 (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, |
| 281 SIZEOF(multiplier_table)); | 283 SIZEOF(multiplier_table)); |
| 282 MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); | 284 MEMZERO(compptr->dct_table, SIZEOF(multiplier_table)); |
| 283 /* Mark multiplier table not yet set up for any method */ | 285 /* Mark multiplier table not yet set up for any method */ |
| 284 idct->cur_method[ci] = -1; | 286 idct->cur_method[ci] = -1; |
| 285 } | 287 } |
| 286 } | 288 } |
| OLD | NEW |