[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.5, Tue Nov 26 23:44:10 2002 UTC
# Line 1  Line 1 
1  /* 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   *  - fast disrete cosine transformation - integer C version
  * 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.  
  *  
  * This disclaimer of warranty extends to the user of these programs and user's  
  * customers, employees, agents, transferees, successors, and assigns.  
  *  
  * The MPEG Software Simulation Group does not represent or warrant that the  
  * programs furnished hereunder are free of infringement of any third-party  
  * patents.  
  *  
  * Commercial implementations of MPEG-1 and MPEG-2 video, including shareware,  
  * are subject to royalty fees to patent holders.  Many of these patents are  
  * general enough such that they are unavoidable regardless of implementation  
  * design.  
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 file is part of XviD, a free MPEG-4 video encoder/decoder
10     *
11     *  XviD is free software; you can redistribute it and/or modify it
12     *  under the terms of the GNU General Public License as published by
13     *  the Free Software Foundation; either version 2 of the License, or
14     *  (at your option) any later version.
15     *
16     *  This program is distributed in the hope that it will be useful,
17     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
18     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19     *  GNU General Public License for more details.
20     *
21     *  You should have received a copy of the GNU General Public License
22     *  along with this program; if not, write to the Free Software
23     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
24     *
25     *  Under section 8 of the GNU General Public License, the copyright
26     *  holders of XVID explicitly forbid distribution in the following
27     *  countries:
28     *
29     *    - Japan
30     *    - United States of America
31     *
32     *  Linking XviD statically or dynamically with other modules is making a
33     *  combined work based on XviD.  Thus, the terms and conditions of the
34     *  GNU General Public License cover the whole combination.
35     *
36     *  As a special exception, the copyright holders of XviD give you
37     *  permission to link XviD with independent modules that communicate with
38     *  XviD solely through the VFW1.1 and DShow interfaces, regardless of the
39     *  license terms of these independent modules, and to copy and distribute
40     *  the resulting combined work under terms of your choice, provided that
41     *  every copy of the combined work is accompanied by a complete copy of
42     *  the source code of XviD (the version of XviD used to produce the
43     *  combined work), being distributed under the terms of the GNU General
44     *  Public License plus this exception.  An independent module is a module
45     *  which is not derived from or based on XviD.
46     *
47     *  Note that people who make modified versions of XviD are not obligated
48     *  to grant this special exception for their modified versions; it is
49     *  their choice whether to do so.  The GNU General Public License gives
50     *  permission to release a modified version without this exception; this
51     *  exception also makes it possible to release a modified version which
52     *  carries forward this exception.
53     *
54     * $Id$
55     *
56     *************************************************************************/
57    
58  /* This routine is a slow-but-accurate integer implementation of the  /* This routine is a slow-but-accurate integer implementation of the
59   * forward DCT (Discrete Cosine Transform). Taken from the IJG software   * forward DCT (Discrete Cosine Transform). Taken from the IJG software
# Line 108  Line 138 
138  #define FIX_2_562915447  ((int) 20995)  /* FIX(2.562915447) */  #define FIX_2_562915447  ((int) 20995)  /* FIX(2.562915447) */
139  #define FIX_3_072711026  ((int) 25172)  /* FIX(3.072711026) */  #define FIX_3_072711026  ((int) 25172)  /* FIX(3.072711026) */
140    
141  // function pointer  /* function pointer */
142  fdctFuncPtr fdct;  fdctFuncPtr fdct;
143    
144  /*  /*
145   * Perform an integer forward DCT on one block of samples.   * Perform an integer forward DCT on one block of samples.
146   */   */
147    
148  void fdct_int32(short * const block)  void
149    fdct_int32(short *const block)
150  {  {
151    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
152    int tmp10, tmp11, tmp12, tmp13;    int tmp10, tmp11, tmp12, tmp13;
# Line 131  Line 162 
162    
163    dataptr = data;    dataptr = data;
164    blkptr = block;    blkptr = block;
165    for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++) {
   {  
166      tmp0 = blkptr[0] + blkptr[7];      tmp0 = blkptr[0] + blkptr[7];
167      tmp7 = blkptr[0] - blkptr[7];      tmp7 = blkptr[0] - blkptr[7];
168      tmp1 = blkptr[1] + blkptr[6];      tmp1 = blkptr[1] + blkptr[6];
# Line 155  Line 185 
185      dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;      dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;
186    
187      z1 = (tmp12 + tmp13) * FIX_0_541196100;      z1 = (tmp12 + tmp13) * FIX_0_541196100;
188      dataptr[2] = DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);                  dataptr[2] =
189      dataptr[6] = DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);                          DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);
190                    dataptr[6] =
191                            DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);
192    
193      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
194       * cK represents cos(K*pi/16).       * cK represents cos(K*pi/16).
# Line 196  Line 228 
228     */     */
229    
230    dataptr = data;    dataptr = data;
231    for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++) {
   {  
232      tmp0 = dataptr[0] + dataptr[56];      tmp0 = dataptr[0] + dataptr[56];
233      tmp7 = dataptr[0] - dataptr[56];      tmp7 = dataptr[0] - dataptr[56];
234      tmp1 = dataptr[8] + dataptr[48];      tmp1 = dataptr[8] + dataptr[48];
# Line 220  Line 251 
251      dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);      dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);
252    
253      z1 = (tmp12 + tmp13) * FIX_0_541196100;      z1 = (tmp12 + tmp13) * FIX_0_541196100;
254      dataptr[16] = DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);                  dataptr[16] =
255      dataptr[48] = DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);                          DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);
256                    dataptr[48] =
257                            DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);
258    
259      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
260       * cK represents cos(K*pi/16).       * cK represents cos(K*pi/16).
# Line 257  Line 290 
290    for (i = 0; i < 64; i++)    for (i = 0; i < 64; i++)
291      block[i] = (short int) DESCALE(data[i], 3);      block[i] = (short int) DESCALE(data[i], 3);
292  }  }
   

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

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