[svn] / trunk / xvidcore / src / dct / idct.c Repository:
ViewVC logotype

Diff of /trunk/xvidcore/src/dct/idct.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 851, Sat Feb 15 15:22:19 2003 UTC revision 1988, Wed May 18 09:10:05 2011 UTC
# Line 1  Line 1 
1  /* idct.c, inverse fast discrete cosine transform                           */  /*****************************************************************************
   
 /* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */  
   
 /*  
  * Disclaimer of Warranty  
2   *   *
3   * These software programs are available to the user without any license fee or   *  XVID MPEG-4 VIDEO CODEC
4   * royalty on an "as is" basis.  The MPEG Software Simulation Group disclaims   *  - Inverse DCT  -
  * any and all warranties, whether express, implied, or statuary, including any  
  * implied warranties or merchantability or of fitness for a particular  
  * purpose.  In no event shall the copyright-holder be liable for any  
  * incidental, punitive, or consequential damages of any kind whatsoever  
  * arising from the use of these programs.  
5   *   *
6   * This disclaimer of warranty extends to the user of these programs and user's   *  Copyright (C) 2006-2011 Xvid Solutions GmbH
  * customers, employees, agents, transferees, successors, and assigns.  
7   *   *
8   * The MPEG Software Simulation Group does not represent or warrant that the   *  This program is free software ; you can redistribute it and/or modify
9   * programs furnished hereunder are free of infringement of any third-party   *  it under the terms of the GNU General Public License as published by
10   * patents.   *  the Free Software Foundation ; either version 2 of the License, or
11     *  (at your option) any later version.
12   *   *
13   * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,   *  This program is distributed in the hope that it will be useful,
14   * are subject to royalty fees to patent holders.  Many of these patents are   *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
15   * general enough such that they are unavoidable regardless of implementation   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   * design.   *  GNU General Public License for more details.
17   *   *
18   * MPEG2AVI   *  You should have received a copy of the GNU General Public License
19   * --------   *  along with this program ; if not, write to the Free Software
20   * v0.16B33 renamed the initialization function to init_idct_int32()   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  * v0.16B32 removed the unused idct_row() and idct_col() functions  
  * v0.16B3  changed var declarations to static, to enforce data align  
  * v0.16B22  idct_FAST() renamed to idct_int32()  
  *        also merged idct_FAST() into a single function, to help VC++  
  *        optimize it.  
21   *   *
22   * v0.14  changed int to long, to avoid confusion when compiling on x86   * $Id$
23   *        platform ( in VC++ "int" -> 32bits )   *
24   */   ****************************************************************************/
   
 /**********************************************************/  
 /* inverse two dimensional DCT, Chen-Wang algorithm       */  
 /* (cf. IEEE ASSP-32, pp. 803-816, Aug. 1984)             */  
 /* 32-bit integer arithmetic (8 bit coefficients)         */  
 /* 11 mults, 29 adds per DCT                              */  
 /*                                      sE, 18.8.91       */  
 /**********************************************************/  
 /* coefficients extended to 12 bit for IEEE1180-1990      */  
 /* compliance                           sE,  2.1.94       */  
 /**********************************************************/  
25    
26  /* this code assumes >> to be a two's-complement arithmetic */  /*
27  /* right shift: (-2)>>1 == -1 , (-3)>>1 == -2               */   *  Authors: Skal
28     *
29     *  Walken IDCT
30     *  Alternative idct implementations for decoding compatibility
31     *
32     *  NOTE: this "C" version is not the original one,
33     *  but is modified to yield the same error profile
34     *  than the MMX version.
35     *
36     ************************************************************************/
37    
 //#include <windows.h>  
38  #include "idct.h"  #include "idct.h"
39    
40  #define W1 2841                                 /* 2048*sqrt(2)*cos(1*pi/16) */  /* function pointer */
41  #define W2 2676                                 /* 2048*sqrt(2)*cos(2*pi/16) */  idctFuncPtr idct;
 #define W3 2408                                 /* 2048*sqrt(2)*cos(3*pi/16) */  
 #define W5 1609                                 /* 2048*sqrt(2)*cos(5*pi/16) */  
 #define W6 1108                                 /* 2048*sqrt(2)*cos(6*pi/16) */  
 #define W7 565                                  /* 2048*sqrt(2)*cos(7*pi/16) */  
   
   
 /* global declarations */  
 //void init_idct_int32 (void);  
 //void idct_int32 (short *block);  
   
 /* private data */  
 static short iclip[1024];               /* clipping table */  
 static short *iclp;  
   
 /* private prototypes */  
 //static void idctrow _ANSI_ARGS_((short *blk));  
 //static void idctcol _ANSI_ARGS_((short *blk));  
42    
43  /* row (horizontal) IDCT  #define XVID_DSP_CLIP_255(x)   ( ((x)&~255) ? ((-(x)) >> (8*sizeof((x))-1))&0xff : (x) )
  *  
  *           7                       pi         1  
  * dst[k] = sum c[l] * src[l] * cos( -- * ( k + - ) * l )  
  *          l=0                      8          2  
  *  
  * where: c[0]    = 128  
  *        c[1..7] = 128*sqrt(2)  
  */  
44    
45  /*  #define ROW_SHIFT 11
46  static void idctrow(blk)  #define COL_SHIFT 6
47  short *blk;  
48  {  // #define FIX(x)   (int)((x) * (1<<ROW_SHIFT))
49    int X0, X1, X2, X3, X4, X5, X6, X7, X8;  #define Rnd0 65536 // 1<<(COL_SHIFT+ROW_SHIFT-1);
50    #define Rnd1 3597  // FIX (1.75683487303);
51    #define Rnd2 2260  // FIX (1.10355339059);
52    #define Rnd3 1203  // FIX (0.587788325588);
53    #define Rnd4 0
54    #define Rnd5 120   // FIX (0.058658283817);
55    #define Rnd6 512   // FIX (0.25);
56    #define Rnd7 512   // FIX (0.25);
57    #undef FIX
58    
59    static const int Tab04[] = { 22725, 21407, 19266, 16384, 12873,  8867, 4520 };
60    static const int Tab17[] = { 31521, 29692, 26722, 22725, 17855, 12299, 6270 };
61    static const int Tab26[] = { 29692, 27969, 25172, 21407, 16819, 11585, 5906 };
62    static const int Tab35[] = { 26722, 25172, 22654, 19266, 15137, 10426, 5315 };
63    
64    // shortcut  static int Idct_Row(short * In, const int * const Tab, int Rnd)
65    if (!((X1 = blk[4]<<11) | (X2 = blk[6]) | (X3 = blk[2]) |  {
66          (X4 = blk[1]) | (X5 = blk[7]) | (X6 = blk[5]) | (X7 = blk[3])))    const int C1 = Tab[0];
67      const int C2 = Tab[1];
68      const int C3 = Tab[2];
69      const int C4 = Tab[3];
70      const int C5 = Tab[4];
71      const int C6 = Tab[5];
72      const int C7 = Tab[6];
73    
74      const int Right = In[5]|In[6]|In[7];
75      const int Left  = In[1]|In[2]|In[3];
76      if (!(Right | In[4]))
77      {
78        const int K = C4*In[0] + Rnd;
79        if (Left)
80        {
81          const int a0 = K + C2*In[2];
82          const int a1 = K + C6*In[2];
83          const int a2 = K - C6*In[2];
84          const int a3 = K - C2*In[2];
85    
86          const int b0 = C1*In[1] + C3*In[3];
87          const int b1 = C3*In[1] - C7*In[3];
88          const int b2 = C5*In[1] - C1*In[3];
89          const int b3 = C7*In[1] - C5*In[3];
90    
91          In[0] = (a0 + b0) >> ROW_SHIFT;
92          In[1] = (a1 + b1) >> ROW_SHIFT;
93          In[2] = (a2 + b2) >> ROW_SHIFT;
94          In[3] = (a3 + b3) >> ROW_SHIFT;
95          In[4] = (a3 - b3) >> ROW_SHIFT;
96          In[5] = (a2 - b2) >> ROW_SHIFT;
97          In[6] = (a1 - b1) >> ROW_SHIFT;
98          In[7] = (a0 - b0) >> ROW_SHIFT;
99        }
100        else
101    {    {
102      blk[0]=blk[1]=blk[2]=blk[3]=blk[4]=blk[5]=blk[6]=blk[7]=blk[0]<<3;        const int a0 = K >> ROW_SHIFT;
103      return;        if (a0) {
104            In[0] = In[1] = In[2] = In[3] =
105            In[4] = In[5] = In[6] = In[7] = a0;
106    }    }
107          else return 0;
108        }
109      }
110      else if (!(Left|Right))
111      {
112        const int a0 = (Rnd + C4*(In[0]+In[4])) >> ROW_SHIFT;
113        const int a1 = (Rnd + C4*(In[0]-In[4])) >> ROW_SHIFT;
114    
115    X0 = (blk[0]<<11) + 128; // for proper rounding in the fourth stage      In[0] = a0;
116        In[3] = a0;
117        In[4] = a0;
118        In[7] = a0;
119        In[1] = a1;
120        In[2] = a1;
121        In[5] = a1;
122        In[6] = a1;
123      }
124      else
125      {
126        const int K = C4*In[0] + Rnd;
127        const int a0 = K + C2*In[2] + C4*In[4] + C6*In[6];
128        const int a1 = K + C6*In[2] - C4*In[4] - C2*In[6];
129        const int a2 = K - C6*In[2] - C4*In[4] + C2*In[6];
130        const int a3 = K - C2*In[2] + C4*In[4] - C6*In[6];
131    
132        const int b0 = C1*In[1] + C3*In[3] + C5*In[5] + C7*In[7];
133        const int b1 = C3*In[1] - C7*In[3] - C1*In[5] - C5*In[7];
134        const int b2 = C5*In[1] - C1*In[3] + C7*In[5] + C3*In[7];
135        const int b3 = C7*In[1] - C5*In[3] + C3*In[5] - C1*In[7];
136    
137        In[0] = (a0 + b0) >> ROW_SHIFT;
138        In[1] = (a1 + b1) >> ROW_SHIFT;
139        In[2] = (a2 + b2) >> ROW_SHIFT;
140        In[3] = (a3 + b3) >> ROW_SHIFT;
141        In[4] = (a3 - b3) >> ROW_SHIFT;
142        In[5] = (a2 - b2) >> ROW_SHIFT;
143        In[6] = (a1 - b1) >> ROW_SHIFT;
144        In[7] = (a0 - b0) >> ROW_SHIFT;
145      }
146      return 1;
147    }
148    
149    // first stage  #define Tan1  0x32ec
150    X8 = W7*(X4+X5);  #define Tan2  0x6a0a
151    X4 = X8 + (W1-W7)*X4;  #define Tan3  0xab0e
152    X5 = X8 - (W1+W7)*X5;  #define Sqrt2 0x5a82
153    X8 = W3*(X6+X7);  
154    X6 = X8 - (W3-W5)*X6;  #define MULT(c,x, n)  ( ((c) * (x)) >> (n) )
155    X7 = X8 - (W3+W5)*X7;  // 12b version => #define MULT(c,x, n)  ( (((c)>>3) * (x)) >> ((n)-3) )
156    // 12b zero-testing version:
157    // second stage  
158    X8 = X0 + X1;  #define BUTF(a, b, tmp) \
159    X0 -= X1;    (tmp) = (a)+(b);      \
160    X1 = W6*(X3+X2);    (b)   = (a)-(b);      \
161    X2 = X1 - (W2+W6)*X2;    (a)   = (tmp)
162    X3 = X1 + (W2-W6)*X3;  
163    X1 = X4 + X6;  #define LOAD_BUTF(m1, m2, a, b, tmp, S) \
164    X4 -= X6;    (m1) = (S)[(a)] + (S)[(b)];           \
165    X6 = X5 + X7;    (m2) = (S)[(a)] - (S)[(b)]
   X5 -= X7;  
   
   // third stage  
   X7 = X8 + X3;  
   X8 -= X3;  
   X3 = X0 + X2;  
   X0 -= X2;  
   X2 = (181*(X4+X5)+128)>>8;  
   X4 = (181*(X4-X5)+128)>>8;  
   
   // fourth stage  
   blk[0] = (X7+X1)>>8;  
   blk[1] = (X3+X2)>>8;  
   blk[2] = (X0+X4)>>8;  
   blk[3] = (X8+X6)>>8;  
   blk[4] = (X8-X6)>>8;  
   blk[5] = (X0-X4)>>8;  
   blk[6] = (X3-X2)>>8;  
   blk[7] = (X7-X1)>>8;  
 }*/  
166    
167  /* column (vertical) IDCT  static void Idct_Col_8(short * const In)
  *  
  *             7                         pi         1  
  * dst[8*k] = sum c[l] * src[8*l] * cos( -- * ( k + - ) * l )  
  *            l=0                        8          2  
  *  
  * where: c[0]    = 1/1024  
  *        c[1..7] = (1/1024)*sqrt(2)  
  */  
 /*  
 static void idctcol(blk)  
 short *blk;  
168  {  {
169    int X0, X1, X2, X3, X4, X5, X6, X7, X8;    int mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7, Spill;
170    
171    // shortcut      // odd
   if (!((X1 = (blk[8*4]<<8)) | (X2 = blk[8*6]) | (X3 = blk[8*2]) |  
         (X4 = blk[8*1]) | (X5 = blk[8*7]) | (X6 = blk[8*5]) | (X7 = blk[8*3])))  
   {  
     blk[8*0]=blk[8*1]=blk[8*2]=blk[8*3]=blk[8*4]=blk[8*5]=blk[8*6]=blk[8*7]=  
       iclp[(blk[8*0]+32)>>6];  
     return;  
   }  
   
   X0 = (blk[8*0]<<8) + 8192;  
   
   // first stage  
   X8 = W7*(X4+X5) + 4;  
   X4 = (X8+(W1-W7)*X4)>>3;  
   X5 = (X8-(W1+W7)*X5)>>3;  
   X8 = W3*(X6+X7) + 4;  
   X6 = (X8-(W3-W5)*X6)>>3;  
   X7 = (X8-(W3+W5)*X7)>>3;  
   
   // second stage  
   X8 = X0 + X1;  
   X0 -= X1;  
   X1 = W6*(X3+X2) + 4;  
   X2 = (X1-(W2+W6)*X2)>>3;  
   X3 = (X1+(W2-W6)*X3)>>3;  
   X1 = X4 + X6;  
   X4 -= X6;  
   X6 = X5 + X7;  
   X5 -= X7;  
   
   // third stage  
   X7 = X8 + X3;  
   X8 -= X3;  
   X3 = X0 + X2;  
   X0 -= X2;  
   X2 = (181*(X4+X5)+128)>>8;  
   X4 = (181*(X4-X5)+128)>>8;  
   
   // fourth stage  
   blk[8*0] = iclp[(X7+X1)>>14];  
   blk[8*1] = iclp[(X3+X2)>>14];  
   blk[8*2] = iclp[(X0+X4)>>14];  
   blk[8*3] = iclp[(X8+X6)>>14];  
   blk[8*4] = iclp[(X8-X6)>>14];  
   blk[8*5] = iclp[(X0-X4)>>14];  
   blk[8*6] = iclp[(X3-X2)>>14];  
   blk[8*7] = iclp[(X7-X1)>>14];  
 }*/  
172    
173  // function pointer    mm4 = (int)In[7*8];
174  idctFuncPtr idct;    mm5 = (int)In[5*8];
175      mm6 = (int)In[3*8];
176      mm7 = (int)In[1*8];
177    
178      mm0 = MULT(Tan1, mm4, 16) + mm7;
179      mm1 = MULT(Tan1, mm7, 16) - mm4;
180      mm2 = MULT(Tan3, mm5, 16) + mm6;
181      mm3 = MULT(Tan3, mm6, 16) - mm5;
182    
183      mm7 = mm0 + mm2;
184      mm4 = mm1 - mm3;
185      mm0 = mm0 - mm2;
186      mm1 = mm1 + mm3;
187      mm6 = mm0 + mm1;
188      mm5 = mm0 - mm1;
189      mm5 = 2*MULT(Sqrt2, mm5, 16);  // 2*sqrt2
190      mm6 = 2*MULT(Sqrt2, mm6, 16);  // Watch out: precision loss but done to match
191                                     // the pmulhw used in mmx/sse versions
192    
193        // even
194    
195      mm1 = (int)In[2*8];
196      mm2 = (int)In[6*8];
197      mm3 = MULT(Tan2,mm2, 16) + mm1;
198      mm2 = MULT(Tan2,mm1, 16) - mm2;
199    
200      LOAD_BUTF(mm0, mm1, 0*8, 4*8, Spill, In);
201    
202      BUTF(mm0, mm3, Spill);
203      BUTF(mm0, mm7, Spill);
204      In[8*0] = (int16_t) (mm0 >> COL_SHIFT);
205      In[8*7] = (int16_t) (mm7 >> COL_SHIFT);
206      BUTF(mm3, mm4, mm0);
207      In[8*3] = (int16_t) (mm3 >> COL_SHIFT);
208      In[8*4] = (int16_t) (mm4 >> COL_SHIFT);
209    
210      BUTF(mm1, mm2, mm0);
211      BUTF(mm1, mm6, mm0);
212      In[8*1] = (int16_t) (mm1 >> COL_SHIFT);
213      In[8*6] = (int16_t) (mm6 >> COL_SHIFT);
214      BUTF(mm2, mm5, mm0);
215      In[8*2] = (int16_t) (mm2 >> COL_SHIFT);
216      In[8*5] = (int16_t) (mm5 >> COL_SHIFT);
217    }
218    
219  /* two dimensional inverse discrete cosine transform */  static void Idct_Col_4(short * const In)
 //void j_rev_dct(block)  
 //short *block;  
 void  
 idct_int32(short *const block)  
220  {  {
221      int mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7, Spill;
222    
223          // idct_int32_init() must be called before the first call to this function!      // odd
224    
225      mm0 = (int)In[1*8];
226      mm2 = (int)In[3*8];
227    
228          /*int i;    mm1 = MULT(Tan1, mm0, 16);
229             long i;    mm3 = MULT(Tan3, mm2, 16);
230    
231      mm7 = mm0 + mm2;
232      mm4 = mm1 - mm3;
233      mm0 = mm0 - mm2;
234      mm1 = mm1 + mm3;
235      mm6 = mm0 + mm1;
236      mm5 = mm0 - mm1;
237      mm6 = 2*MULT(Sqrt2, mm6, 16);  // 2*sqrt2
238      mm5 = 2*MULT(Sqrt2, mm5, 16);
239    
240        // even
241    
242      mm0 = mm1 = (int)In[0*8];
243      mm3 = (int)In[2*8];
244      mm2 = MULT(Tan2,mm3, 16);
245    
246      BUTF(mm0, mm3, Spill);
247      BUTF(mm0, mm7, Spill);
248      In[8*0] = (int16_t) (mm0 >> COL_SHIFT);
249      In[8*7] = (int16_t) (mm7 >> COL_SHIFT);
250      BUTF(mm3, mm4, mm0);
251      In[8*3] = (int16_t) (mm3 >> COL_SHIFT);
252      In[8*4] = (int16_t) (mm4 >> COL_SHIFT);
253    
254      BUTF(mm1, mm2, mm0);
255      BUTF(mm1, mm6, mm0);
256      In[8*1] = (int16_t) (mm1 >> COL_SHIFT);
257      In[8*6] = (int16_t) (mm6 >> COL_SHIFT);
258      BUTF(mm2, mm5, mm0);
259      In[8*2] = (int16_t) (mm2 >> COL_SHIFT);
260      In[8*5] = (int16_t) (mm5 >> COL_SHIFT);
261    }
262    
263             for (i=0; i<8; i++)  static void Idct_Col_3(short * const In)
264             idctrow(block+8*i);  {
265      int mm0, mm1, mm2, mm3, mm4, mm5, mm6, mm7, Spill;
266    
267             for (i=0; i<8; i++)      // odd
            idctcol(block+i); */  
         static short *blk;  
         static long i;  
         static long X0, X1, X2, X3, X4, X5, X6, X7, X8;  
268    
269      mm7 = (int)In[1*8];
270      mm4 = MULT(Tan1, mm7, 16);
271    
272          for (i = 0; i < 8; i++)         // idct rows    mm6 = mm7 + mm4;
273          {    mm5 = mm7 - mm4;
274                  blk = block + (i << 3);    mm6 = 2*MULT(Sqrt2, mm6, 16);  // 2*sqrt2
275                  if (!    mm5 = 2*MULT(Sqrt2, mm5, 16);
276                          ((X1 = blk[4] << 11) | (X2 = blk[6]) | (X3 = blk[2]) | (X4 =  
277                                                                                                                                          blk[1]) |      // even
278                           (X5 = blk[7]) | (X6 = blk[5]) | (X7 = blk[3]))) {  
279                          blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] =    mm0 = mm1 = (int)In[0*8];
280                                  blk[7] = blk[0] << 3;    mm3 = (int)In[2*8];
281                          continue;    mm2 = MULT(Tan2,mm3, 16);
282                  }  
283      BUTF(mm0, mm3, Spill);
284                  X0 = (blk[0] << 11) + 128;      // for proper rounding in the fourth stage    BUTF(mm0, mm7, Spill);
285      In[8*0] = (int16_t) (mm0 >> COL_SHIFT);
286                  // first stage    In[8*7] = (int16_t) (mm7 >> COL_SHIFT);
287                  X8 = W7 * (X4 + X5);    BUTF(mm3, mm4, mm0);
288                  X4 = X8 + (W1 - W7) * X4;    In[8*3] = (int16_t) (mm3 >> COL_SHIFT);
289                  X5 = X8 - (W1 + W7) * X5;    In[8*4] = (int16_t) (mm4 >> COL_SHIFT);
290                  X8 = W3 * (X6 + X7);  
291                  X6 = X8 - (W3 - W5) * X6;    BUTF(mm1, mm2, mm0);
292                  X7 = X8 - (W3 + W5) * X7;    BUTF(mm1, mm6, mm0);
293      In[8*1] = (int16_t) (mm1 >> COL_SHIFT);
294                  // second stage    In[8*6] = (int16_t) (mm6 >> COL_SHIFT);
295                  X8 = X0 + X1;    BUTF(mm2, mm5, mm0);
296                  X0 -= X1;    In[8*2] = (int16_t) (mm2 >> COL_SHIFT);
297                  X1 = W6 * (X3 + X2);    In[8*5] = (int16_t) (mm5 >> COL_SHIFT);
298                  X2 = X1 - (W2 + W6) * X2;  }
                 X3 = X1 + (W2 - W6) * X3;  
                 X1 = X4 + X6;  
                 X4 -= X6;  
                 X6 = X5 + X7;  
                 X5 -= X7;  
   
                 // third stage  
                 X7 = X8 + X3;  
                 X8 -= X3;  
                 X3 = X0 + X2;  
                 X0 -= X2;  
                 X2 = (181 * (X4 + X5) + 128) >> 8;  
                 X4 = (181 * (X4 - X5) + 128) >> 8;  
   
                 // fourth stage  
   
                 blk[0] = (short) ((X7 + X1) >> 8);  
                 blk[1] = (short) ((X3 + X2) >> 8);  
                 blk[2] = (short) ((X0 + X4) >> 8);  
                 blk[3] = (short) ((X8 + X6) >> 8);  
                 blk[4] = (short) ((X8 - X6) >> 8);  
                 blk[5] = (short) ((X0 - X4) >> 8);  
                 blk[6] = (short) ((X3 - X2) >> 8);  
                 blk[7] = (short) ((X7 - X1) >> 8);  
299    
300          }                                                       // end for ( i = 0; i < 8; ++i ) IDCT-rows  #undef Tan1
301    #undef Tan2
302    #undef Tan3
303    #undef Sqrt2
304    
305    #undef ROW_SHIFT
306    #undef COL_SHIFT
307    
308    //////////////////////////////////////////////////////////
309    
310          for (i = 0; i < 8; i++)         // idct columns  void idct_int32(short *const In)
311          {          {
312                  blk = block + i;    int i, Rows = 0x07;
313                  // shortcut  
314                  if (!    Idct_Row(In + 0*8, Tab04, Rnd0);
315                          ((X1 = (blk[8 * 4] << 8)) | (X2 = blk[8 * 6]) | (X3 =    Idct_Row(In + 1*8, Tab17, Rnd1);
316                                                                                                                           blk[8 *    Idct_Row(In + 2*8, Tab26, Rnd2);
317                                                                                                                                   2]) | (X4 =    if (Idct_Row(In + 3*8, Tab35, Rnd3)) Rows |= 0x08;
318                                                                                                                                                  blk[8 *    if (Idct_Row(In + 4*8, Tab04, Rnd4)) Rows |= 0x10;
319                                                                                                                                                          1])    if (Idct_Row(In + 5*8, Tab35, Rnd5)) Rows |= 0x20;
320                           | (X5 = blk[8 * 7]) | (X6 = blk[8 * 5]) | (X7 = blk[8 * 3]))) {    if (Idct_Row(In + 6*8, Tab26, Rnd6)) Rows |= 0x40;
321                          blk[8 * 0] = blk[8 * 1] = blk[8 * 2] = blk[8 * 3] = blk[8 * 4] =    if (Idct_Row(In + 7*8, Tab17, Rnd7)) Rows |= 0x80;
                                 blk[8 * 5] = blk[8 * 6] = blk[8 * 7] =  
                                 iclp[(blk[8 * 0] + 32) >> 6];  
                         continue;  
                 }  
   
                 X0 = (blk[8 * 0] << 8) + 8192;  
   
                 // first stage  
                 X8 = W7 * (X4 + X5) + 4;  
                 X4 = (X8 + (W1 - W7) * X4) >> 3;  
                 X5 = (X8 - (W1 + W7) * X5) >> 3;  
                 X8 = W3 * (X6 + X7) + 4;  
                 X6 = (X8 - (W3 - W5) * X6) >> 3;  
                 X7 = (X8 - (W3 + W5) * X7) >> 3;  
   
                 // second stage  
                 X8 = X0 + X1;  
                 X0 -= X1;  
                 X1 = W6 * (X3 + X2) + 4;  
                 X2 = (X1 - (W2 + W6) * X2) >> 3;  
                 X3 = (X1 + (W2 - W6) * X3) >> 3;  
                 X1 = X4 + X6;  
                 X4 -= X6;  
                 X6 = X5 + X7;  
                 X5 -= X7;  
   
                 // third stage  
                 X7 = X8 + X3;  
                 X8 -= X3;  
                 X3 = X0 + X2;  
                 X0 -= X2;  
                 X2 = (181 * (X4 + X5) + 128) >> 8;  
                 X4 = (181 * (X4 - X5) + 128) >> 8;  
   
                 // fourth stage  
                 blk[8 * 0] = iclp[(X7 + X1) >> 14];  
                 blk[8 * 1] = iclp[(X3 + X2) >> 14];  
                 blk[8 * 2] = iclp[(X0 + X4) >> 14];  
                 blk[8 * 3] = iclp[(X8 + X6) >> 14];  
                 blk[8 * 4] = iclp[(X8 - X6) >> 14];  
                 blk[8 * 5] = iclp[(X0 - X4) >> 14];  
                 blk[8 * 6] = iclp[(X3 - X2) >> 14];  
                 blk[8 * 7] = iclp[(X7 - X1) >> 14];  
         }  
   
 }                                                               // end function idct_int32(block)  
   
   
 //void  
 //idct_int32_init()  
 void  
 idct_int32_init()  
 {  
         int i;  
322    
323          iclp = iclip + 512;    if (Rows&0xf0) {
324          for (i = -512; i < 512; i++)      for(i=0; i<8; i++)
325                  iclp[i] = (i < -256) ? -256 : ((i > 255) ? 255 : i);        Idct_Col_8(In + i);
326      }
327      else if (Rows&0x08) {
328        for(i=0; i<8; i++)
329          Idct_Col_4(In + i);
330      }
331      else {
332        for(i=0; i<8; i++)
333          Idct_Col_3(In + i);
334      }
335  }  }

Legend:
Removed from v.851  
changed lines
  Added in v.1988

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4