[cvs] / xvidcore / src / dct / fdct.c Repository:
ViewVC logotype

Diff of /xvidcore/src/dct/fdct.c

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

revision 1.1, Fri Mar 8 02:44:39 2002 UTC revision 1.7, Mon Mar 22 22:36:23 2004 UTC
# Line 1  Line 1 
1    /*****************************************************************************
2     *
3     *  XVID MPEG-4 VIDEO CODEC
4     *  - Forward DCT  -
5     *
6     *  These routines are from Independent JPEG Group's free JPEG software
7     *  Copyright (C) 1991-1998, Thomas G. Lane (see the file README.IJG)
8     *
9     *  This program is free software ; you can redistribute it and/or modify
10     *  it under the terms of the GNU General Public License as published by
11     *  the Free Software Foundation ; either version 2 of the License, or
12     *  (at your option) any later version.
13     *
14     *  This program is distributed in the hope that it will be useful,
15     *  but WITHOUT ANY WARRANTY ; without even the implied warranty of
16     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17     *  GNU General Public License for more details.
18     *
19     *  You should have received a copy of the GNU General Public License
20     *  along with this program ; if not, write to the Free Software
21     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
22     *
23     * $Id$
24     *
25     ****************************************************************************/
26    
27  /* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */  /* Copyright (C) 1996, MPEG Software Simulation Group. All Rights Reserved. */
28    
29  /*  /*
# Line 108  Line 134 
134  #define FIX_2_562915447  ((int) 20995)  /* FIX(2.562915447) */  #define FIX_2_562915447  ((int) 20995)  /* FIX(2.562915447) */
135  #define FIX_3_072711026  ((int) 25172)  /* FIX(3.072711026) */  #define FIX_3_072711026  ((int) 25172)  /* FIX(3.072711026) */
136    
137  // function pointer  /* function pointer */
138  fdctFuncPtr fdct;  fdctFuncPtr fdct;
139    
140  /*  /*
141   * Perform an integer forward DCT on one block of samples.   * Perform an integer forward DCT on one block of samples.
142   */   */
143    
144  void fdct_int32(short * const block)  void
145    fdct_int32(short *const block)
146  {  {
147    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
148    int tmp10, tmp11, tmp12, tmp13;    int tmp10, tmp11, tmp12, tmp13;
# Line 131  Line 158 
158    
159    dataptr = data;    dataptr = data;
160    blkptr = block;    blkptr = block;
161    for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++) {
   {  
162      tmp0 = blkptr[0] + blkptr[7];      tmp0 = blkptr[0] + blkptr[7];
163      tmp7 = blkptr[0] - blkptr[7];      tmp7 = blkptr[0] - blkptr[7];
164      tmp1 = blkptr[1] + blkptr[6];      tmp1 = blkptr[1] + blkptr[6];
# Line 155  Line 181 
181      dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;      dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;
182    
183      z1 = (tmp12 + tmp13) * FIX_0_541196100;      z1 = (tmp12 + tmp13) * FIX_0_541196100;
184      dataptr[2] = DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);                  dataptr[2] =
185      dataptr[6] = DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);                          DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);
186                    dataptr[6] =
187                            DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);
188    
189      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
190       * cK represents cos(K*pi/16).       * cK represents cos(K*pi/16).
# Line 196  Line 224 
224     */     */
225    
226    dataptr = data;    dataptr = data;
227    for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++) {
   {  
228      tmp0 = dataptr[0] + dataptr[56];      tmp0 = dataptr[0] + dataptr[56];
229      tmp7 = dataptr[0] - dataptr[56];      tmp7 = dataptr[0] - dataptr[56];
230      tmp1 = dataptr[8] + dataptr[48];      tmp1 = dataptr[8] + dataptr[48];
# Line 220  Line 247 
247      dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);      dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);
248    
249      z1 = (tmp12 + tmp13) * FIX_0_541196100;      z1 = (tmp12 + tmp13) * FIX_0_541196100;
250      dataptr[16] = DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);                  dataptr[16] =
251      dataptr[48] = DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);                          DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);
252                    dataptr[48] =
253                            DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);
254    
255      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
256       * cK represents cos(K*pi/16).       * cK represents cos(K*pi/16).
# Line 257  Line 286 
286    for (i = 0; i < 64; i++)    for (i = 0; i < 64; i++)
287      block[i] = (short int) DESCALE(data[i], 3);      block[i] = (short int) DESCALE(data[i], 3);
288  }  }
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.7

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