1 /*===========================================================================*
2  * dct.h								     *
3  *									     *
4  *	DCT procedures							     *
5  *									     *
6  *===========================================================================*/
7 
8 /*
9  * Copyright (c) 1995 The Regents of the University of California.
10  * All rights reserved.
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose, without fee, and without written agreement is
14  * hereby granted, provided that the above copyright notice and the following
15  * two paragraphs appear in all copies of this software.
16  *
17  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
18  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
19  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
20  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21  *
22  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
25  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
26  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
27  */
28 
29 
30 #ifndef DCT_INCLUDED
31 #define DCT_INCLUDED
32 
33 
34 #include "ansi.h"
35 
36 
37 
38 #define DCTSIZE     8   /* you really don't want to change this */
39 #define DCTSIZE_SQ 64   /* you really don't want to change this */
40 
41 #define DCTSIZE2    DCTSIZE*DCTSIZE
42 typedef short DCTELEM;
43 typedef DCTELEM DCTBLOCK[DCTSIZE2];
44 typedef DCTELEM DCTBLOCK_2D[DCTSIZE][DCTSIZE];
45 
46 
47 /*
48  *  from mfwddct.c:
49  */
50 extern void mp_fwd_dct_block2 _ANSI_ARGS_((DCTBLOCK_2D src, DCTBLOCK_2D dest));
51 
52 /* jrevdct.c */
53 extern void init_pre_idct _ANSI_ARGS_((void ));
54 extern void mpeg_jrevdct _ANSI_ARGS_((DCTBLOCK data ));
55 
56 
57 /* We assume that right shift corresponds to signed division by 2 with
58  * rounding towards minus infinity.  This is correct for typical "arithmetic
59  * shift" instructions that shift in copies of the sign bit.  But some
60  * C compilers implement >> with an unsigned shift.  For these machines you
61  * must define RIGHT_SHIFT_IS_UNSIGNED.
62  * RIGHT_SHIFT provides a proper signed right shift of an int32 quantity.
63  * It is only applied with constant shift counts.  SHIFT_TEMPS must be
64  * included in the variables of any routine using RIGHT_SHIFT.
65  */
66 
67 #ifdef RIGHT_SHIFT_IS_UNSIGNED
68 #define SHIFT_TEMPS     int32 shift_temp;
69 #define RIGHT_SHIFT(x,shft)  \
70         ((shift_temp = (x)) < 0 ? \
71          (shift_temp >> (shft)) | ((~((int32) 0)) << (32-(shft))) : \
72          (shift_temp >> (shft)))
73 #else
74 #define SHIFT_TEMPS
75 #define RIGHT_SHIFT(x,shft)     ((x) >> (shft))
76 #endif
77 
78 
79 #endif /* DCT_INCLUDED */
80