[svn] / branches / release-1_0-branch / xvidcore / src / dct / idct.c Repository:
ViewVC logotype

Diff of /branches/release-1_0-branch/xvidcore/src/dct/idct.c

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

revision 3, Fri Mar 8 02:46:11 2002 UTC revision 649, Sat Nov 16 23:51:58 2002 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 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.  
  *  
  * MPEG2AVI  
  * --------  
  * v0.16B33 renamed the initialization function to init_idct_int32()  
  * 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.  
5   *   *
6   * v0.14  changed int to long, to avoid confusion when compiling on x86   *  These routines are from Independent JPEG Group's free JPEG software
7   *        platform ( in VC++ "int" -> 32bits )   *  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: idct.c,v 1.4 2002-11-16 23:51:58 edgomez Exp $
55     *
56     *************************************************************************/
57    
58  /**********************************************************/  /**********************************************************/
59  /* inverse two dimensional DCT, Chen-Wang algorithm       */  /* inverse two dimensional DCT, Chen-Wang algorithm       */
# Line 52  Line 69 
69  /* this code assumes >> to be a two's-complement arithmetic */  /* this code assumes >> to be a two's-complement arithmetic */
70  /* right shift: (-2)>>1 == -1 , (-3)>>1 == -2               */  /* right shift: (-2)>>1 == -1 , (-3)>>1 == -2               */
71    
 //#include <windows.h>  
72  #include "idct.h"  #include "idct.h"
73    
74  #define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */  #define W1 2841 /* 2048*sqrt(2)*cos(1*pi/16) */
# Line 209  Line 225 
225  /* two dimensional inverse discrete cosine transform */  /* two dimensional inverse discrete cosine transform */
226  //void j_rev_dct(block)  //void j_rev_dct(block)
227  //short *block;  //short *block;
228  void idct_int32(short * const block)  void
229    idct_int32(short *const block)
230  {  {
231    
232    // idct_int32_init() must be called before the first call to this function!    // idct_int32_init() must be called before the first call to this function!
# Line 231  Line 248 
248    for (i=0; i<8; i++)   // idct rows    for (i=0; i<8; i++)   // idct rows
249    {    {
250          blk = block+(i<<3);          blk = block+(i<<3);
251          if (!((X1 = blk[4]<<11) | (X2 = blk[6]) | (X3 = blk[2]) |                  if (!
252          (X4 = blk[1]) | (X5 = blk[7]) | (X6 = blk[5]) | (X7 = blk[3])))                          ((X1 = blk[4] << 11) | (X2 = blk[6]) | (X3 = blk[2]) | (X4 =
253          {                                                                                                                                          blk[1]) |
254                  blk[0]=blk[1]=blk[2]=blk[3]=blk[4]=blk[5]=blk[6]=blk[7]=blk[0]<<3;                           (X5 = blk[7]) | (X6 = blk[5]) | (X7 = blk[3]))) {
255                            blk[0] = blk[1] = blk[2] = blk[3] = blk[4] = blk[5] = blk[6] =
256                                    blk[7] = blk[0] << 3;
257                  continue;                  continue;
258          }          }
259    
# Line 286  Line 305 
305    {    {
306          blk = block + i;          blk = block + i;
307      // shortcut      // shortcut
308          if (!((X1 = (blk[8*4]<<8)) | (X2 = blk[8*6]) | (X3 = blk[8*2]) |                  if (!
309          (X4 = blk[8*1]) | (X5 = blk[8*7]) | (X6 = blk[8*5]) | (X7 = blk[8*3])))                          ((X1 = (blk[8 * 4] << 8)) | (X2 = blk[8 * 6]) | (X3 =
310          {                                                                                                                           blk[8 *
311                                                                                                                                     2]) | (X4 =
312                                                                                                                                                    blk[8 *
313                                                                                                                                                            1])
314                             | (X5 = blk[8 * 7]) | (X6 = blk[8 * 5]) | (X7 = blk[8 * 3]))) {
315                  blk[8*0]=blk[8*1]=blk[8*2]=blk[8*3]=blk[8*4]=                  blk[8*0]=blk[8*1]=blk[8*2]=blk[8*3]=blk[8*4]=
316                          blk[8*5]=blk[8*6]=blk[8*7]=iclp[(blk[8*0]+32)>>6];                                  blk[8 * 5] = blk[8 * 6] = blk[8 * 7] =
317                                    iclp[(blk[8 * 0] + 32) >> 6];
318                  continue;                  continue;
319          }          }
320    
# Line 339  Line 363 
363    
364  //void  //void
365  //idct_int32_init()  //idct_int32_init()
366  void idct_int32_init()  void
367    idct_int32_init()
368  {  {
369    int i;    int i;
370    

Legend:
Removed from v.3  
changed lines
  Added in v.649

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