Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
jidctflt.c
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 #define JPEG_INTERNALS
00040 #include "jinclude.h"
00041 #include "jpeglib.h"
00042 #include "jdct.h"               
00043 
00044 #ifdef DCT_FLOAT_SUPPORTED
00045 
00046 
00047 
00048 
00049 
00050 
00051 #if DCTSIZE != 8
00052   Sorry, this code only copes with 8x8 DCTs. 
00053 #endif
00054 
00055 
00056 
00057 
00058 
00059 
00060 #define DEQUANTIZE(coef,quantval)  (((FAST_FLOAT) (coef)) * (quantval))
00061 
00062 
00063 
00064 
00065 
00066 
00067 GLOBAL(void)
00068 jpeg_idct_float (j_decompress_ptr cinfo, jpeg_component_info * compptr,
00069                  JCOEFPTR coef_block,
00070                  JSAMPARRAY output_buf, JDIMENSION output_col)
00071 {
00072   FAST_FLOAT tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
00073   FAST_FLOAT tmp10, tmp11, tmp12, tmp13;
00074   FAST_FLOAT z5, z10, z11, z12, z13;
00075   JCOEFPTR inptr;
00076   FLOAT_MULT_TYPE * quantptr;
00077   FAST_FLOAT * wsptr;
00078   JSAMPROW outptr;
00079   JSAMPLE *range_limit = IDCT_range_limit(cinfo);
00080   int ctr;
00081   FAST_FLOAT workspace[DCTSIZE2]; 
00082   SHIFT_TEMPS
00083 
00084   
00085 
00086   inptr = coef_block;
00087   quantptr = (FLOAT_MULT_TYPE *) compptr->dct_table;
00088   wsptr = workspace;
00089   for (ctr = DCTSIZE; ctr > 0; ctr--) {
00090     
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098     
00099     if (inptr[DCTSIZE*1] == 0 && inptr[DCTSIZE*2] == 0 &&
00100         inptr[DCTSIZE*3] == 0 && inptr[DCTSIZE*4] == 0 &&
00101         inptr[DCTSIZE*5] == 0 && inptr[DCTSIZE*6] == 0 &&
00102         inptr[DCTSIZE*7] == 0) {
00103       
00104       FAST_FLOAT dcval = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
00105       
00106       wsptr[DCTSIZE*0] = dcval;
00107       wsptr[DCTSIZE*1] = dcval;
00108       wsptr[DCTSIZE*2] = dcval;
00109       wsptr[DCTSIZE*3] = dcval;
00110       wsptr[DCTSIZE*4] = dcval;
00111       wsptr[DCTSIZE*5] = dcval;
00112       wsptr[DCTSIZE*6] = dcval;
00113       wsptr[DCTSIZE*7] = dcval;
00114       
00115       inptr++;                  
00116       quantptr++;
00117       wsptr++;
00118       continue;
00119     }
00120     
00121     
00122 
00123     tmp0 = DEQUANTIZE(inptr[DCTSIZE*0], quantptr[DCTSIZE*0]);
00124     tmp1 = DEQUANTIZE(inptr[DCTSIZE*2], quantptr[DCTSIZE*2]);
00125     tmp2 = DEQUANTIZE(inptr[DCTSIZE*4], quantptr[DCTSIZE*4]);
00126     tmp3 = DEQUANTIZE(inptr[DCTSIZE*6], quantptr[DCTSIZE*6]);
00127 
00128     tmp10 = tmp0 + tmp2;        
00129     tmp11 = tmp0 - tmp2;
00130 
00131     tmp13 = tmp1 + tmp3;        
00132     tmp12 = (tmp1 - tmp3) * ((FAST_FLOAT) 1.414213562) - tmp13; 
00133 
00134     tmp0 = tmp10 + tmp13;       
00135     tmp3 = tmp10 - tmp13;
00136     tmp1 = tmp11 + tmp12;
00137     tmp2 = tmp11 - tmp12;
00138     
00139     
00140 
00141     tmp4 = DEQUANTIZE(inptr[DCTSIZE*1], quantptr[DCTSIZE*1]);
00142     tmp5 = DEQUANTIZE(inptr[DCTSIZE*3], quantptr[DCTSIZE*3]);
00143     tmp6 = DEQUANTIZE(inptr[DCTSIZE*5], quantptr[DCTSIZE*5]);
00144     tmp7 = DEQUANTIZE(inptr[DCTSIZE*7], quantptr[DCTSIZE*7]);
00145 
00146     z13 = tmp6 + tmp5;          
00147     z10 = tmp6 - tmp5;
00148     z11 = tmp4 + tmp7;
00149     z12 = tmp4 - tmp7;
00150 
00151     tmp7 = z11 + z13;           
00152     tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562); 
00153 
00154     z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); 
00155     tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; 
00156     tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; 
00157 
00158     tmp6 = tmp12 - tmp7;        
00159     tmp5 = tmp11 - tmp6;
00160     tmp4 = tmp10 + tmp5;
00161 
00162     wsptr[DCTSIZE*0] = tmp0 + tmp7;
00163     wsptr[DCTSIZE*7] = tmp0 - tmp7;
00164     wsptr[DCTSIZE*1] = tmp1 + tmp6;
00165     wsptr[DCTSIZE*6] = tmp1 - tmp6;
00166     wsptr[DCTSIZE*2] = tmp2 + tmp5;
00167     wsptr[DCTSIZE*5] = tmp2 - tmp5;
00168     wsptr[DCTSIZE*4] = tmp3 + tmp4;
00169     wsptr[DCTSIZE*3] = tmp3 - tmp4;
00170 
00171     inptr++;                    
00172     quantptr++;
00173     wsptr++;
00174   }
00175   
00176   
00177   
00178 
00179   wsptr = workspace;
00180   for (ctr = 0; ctr < DCTSIZE; ctr++) {
00181     outptr = output_buf[ctr] + output_col;
00182     
00183 
00184 
00185 
00186 
00187     
00188     
00189 
00190     tmp10 = wsptr[0] + wsptr[4];
00191     tmp11 = wsptr[0] - wsptr[4];
00192 
00193     tmp13 = wsptr[2] + wsptr[6];
00194     tmp12 = (wsptr[2] - wsptr[6]) * ((FAST_FLOAT) 1.414213562) - tmp13;
00195 
00196     tmp0 = tmp10 + tmp13;
00197     tmp3 = tmp10 - tmp13;
00198     tmp1 = tmp11 + tmp12;
00199     tmp2 = tmp11 - tmp12;
00200 
00201     
00202 
00203     z13 = wsptr[5] + wsptr[3];
00204     z10 = wsptr[5] - wsptr[3];
00205     z11 = wsptr[1] + wsptr[7];
00206     z12 = wsptr[1] - wsptr[7];
00207 
00208     tmp7 = z11 + z13;
00209     tmp11 = (z11 - z13) * ((FAST_FLOAT) 1.414213562);
00210 
00211     z5 = (z10 + z12) * ((FAST_FLOAT) 1.847759065); 
00212     tmp10 = ((FAST_FLOAT) 1.082392200) * z12 - z5; 
00213     tmp12 = ((FAST_FLOAT) -2.613125930) * z10 + z5; 
00214 
00215     tmp6 = tmp12 - tmp7;
00216     tmp5 = tmp11 - tmp6;
00217     tmp4 = tmp10 + tmp5;
00218 
00219     
00220 
00221     outptr[0] = range_limit[(int) DESCALE((INT32) (tmp0 + tmp7), 3)
00222                             & RANGE_MASK];
00223     outptr[7] = range_limit[(int) DESCALE((INT32) (tmp0 - tmp7), 3)
00224                             & RANGE_MASK];
00225     outptr[1] = range_limit[(int) DESCALE((INT32) (tmp1 + tmp6), 3)
00226                             & RANGE_MASK];
00227     outptr[6] = range_limit[(int) DESCALE((INT32) (tmp1 - tmp6), 3)
00228                             & RANGE_MASK];
00229     outptr[2] = range_limit[(int) DESCALE((INT32) (tmp2 + tmp5), 3)
00230                             & RANGE_MASK];
00231     outptr[5] = range_limit[(int) DESCALE((INT32) (tmp2 - tmp5), 3)
00232                             & RANGE_MASK];
00233     outptr[4] = range_limit[(int) DESCALE((INT32) (tmp3 + tmp4), 3)
00234                             & RANGE_MASK];
00235     outptr[3] = range_limit[(int) DESCALE((INT32) (tmp3 - tmp4), 3)
00236                             & RANGE_MASK];
00237     
00238     wsptr += DCTSIZE;           
00239   }
00240 }
00241 
00242 #endif