[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.3, Tue Sep 10 20:38:24 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 program is an implementation of a part of one or more MPEG-4
10     *  Video tools as specified in ISO/IEC 14496-2 standard.  Those intending
11     *  to use this software module in hardware or software products are
12     *  advised that its use may infringe existing patents or copyrights, and
13     *  any such use would be at such party's own risk.  The original
14     *  developer of this software module and his/her company, and subsequent
15     *  editors and their companies, will have no liability for use of this
16     *  software or modifications or derivatives thereof.
17     *
18     *  This program is free software; you can redistribute it and/or modify
19     *  it under the terms of the GNU General Public License as published by
20     *  the Free Software Foundation; either version 2 of the License, or
21     *  (at your option) any later version.
22     *
23     *  This program is distributed in the hope that it will be useful,
24     *  but WITHOUT ANY WARRANTY; without even the implied warranty of
25     *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
26     *  GNU General Public License for more details.
27     *
28     *  You should have received a copy of the GNU General Public License
29     *  along with this program; if not, write to the Free Software
30     *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
31     *
32     *************************************************************************/
33    
34  /* This routine is a slow-but-accurate integer implementation of the  /* This routine is a slow-but-accurate integer implementation of the
35   * forward DCT (Discrete Cosine Transform). Taken from the IJG software   * forward DCT (Discrete Cosine Transform). Taken from the IJG software
# Line 115  Line 121 
121   * Perform an integer forward DCT on one block of samples.   * Perform an integer forward DCT on one block of samples.
122   */   */
123    
124  void fdct_int32(short * const block)  void
125    fdct_int32(short *const block)
126  {  {
127    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;    int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
128    int tmp10, tmp11, tmp12, tmp13;    int tmp10, tmp11, tmp12, tmp13;
# Line 131  Line 138 
138    
139    dataptr = data;    dataptr = data;
140    blkptr = block;    blkptr = block;
141    for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++) {
   {  
142      tmp0 = blkptr[0] + blkptr[7];      tmp0 = blkptr[0] + blkptr[7];
143      tmp7 = blkptr[0] - blkptr[7];      tmp7 = blkptr[0] - blkptr[7];
144      tmp1 = blkptr[1] + blkptr[6];      tmp1 = blkptr[1] + blkptr[6];
# Line 155  Line 161 
161      dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;      dataptr[4] = (tmp10 - tmp11) << PASS1_BITS;
162    
163      z1 = (tmp12 + tmp13) * FIX_0_541196100;      z1 = (tmp12 + tmp13) * FIX_0_541196100;
164      dataptr[2] = DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);                  dataptr[2] =
165      dataptr[6] = DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);                          DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS - PASS1_BITS);
166                    dataptr[6] =
167                            DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS - PASS1_BITS);
168    
169      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
170       * cK represents cos(K*pi/16).       * cK represents cos(K*pi/16).
# Line 196  Line 204 
204     */     */
205    
206    dataptr = data;    dataptr = data;
207    for (i = 0; i < 8; i++)          for (i = 0; i < 8; i++) {
   {  
208      tmp0 = dataptr[0] + dataptr[56];      tmp0 = dataptr[0] + dataptr[56];
209      tmp7 = dataptr[0] - dataptr[56];      tmp7 = dataptr[0] - dataptr[56];
210      tmp1 = dataptr[8] + dataptr[48];      tmp1 = dataptr[8] + dataptr[48];
# Line 220  Line 227 
227      dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);      dataptr[32] = DESCALE(tmp10 - tmp11, PASS1_BITS);
228    
229      z1 = (tmp12 + tmp13) * FIX_0_541196100;      z1 = (tmp12 + tmp13) * FIX_0_541196100;
230      dataptr[16] = DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);                  dataptr[16] =
231      dataptr[48] = DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);                          DESCALE(z1 + tmp13 * FIX_0_765366865, CONST_BITS + PASS1_BITS);
232                    dataptr[48] =
233                            DESCALE(z1 + tmp12 * (-FIX_1_847759065), CONST_BITS + PASS1_BITS);
234    
235      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).      /* Odd part per figure 8 --- note paper omits factor of sqrt(2).
236       * cK represents cos(K*pi/16).       * cK represents cos(K*pi/16).
# Line 257  Line 266 
266    for (i = 0; i < 64; i++)    for (i = 0; i < 64; i++)
267      block[i] = (short int) DESCALE(data[i], 3);      block[i] = (short int) DESCALE(data[i], 3);
268  }  }
   

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

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