1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #ifndef idct_h
19 #define idct_h
20 
21 /*----------------------------------------------------------------------------
22 ; INCLUDES
23 ----------------------------------------------------------------------------*/
24 #include "mp4dec_lib.h"
25 
26 /*----------------------------------------------------------------------------
27 ; MACROS
28 ; Define module specific macros here
29 ----------------------------------------------------------------------------*/
30 
31 /*----------------------------------------------------------------------------
32 ; DEFINES
33 ; Include all pre-processor statements here.
34 ----------------------------------------------------------------------------*/
35 #define INTEGER_IDCT
36 
37 #ifdef FAST_IDCT
38 #ifndef INTEGER_IDCT
39 #define INTEGER_IDCT
40 #endif
41 #endif
42 
43 #ifdef FAST_IDCT
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #endif
48     void idctrow0(int16 *blk, uint8 *pred, uint8 *dst, int width);
49     void idctrow1(int16 *blk, uint8 *pred, uint8 *dst, int width);
50     void idctrow2(int16 *blk, uint8 *pred, uint8 *dst, int width);
51     void idctrow3(int16 *blk, uint8 *pred, uint8 *dst, int width);
52     void idctrow4(int16 *blk, uint8 *pred, uint8 *dst, int width);
53     void idctcol0(int16 *blk);
54     void idctcol1(int16 *blk);
55     void idctcol2(int16 *blk);
56     void idctcol3(int16 *blk);
57     void idctcol4(int16 *blk);
58 
59     void idctrow0_intra(int16 *blk, PIXEL *comp, int width);
60     void idctrow1_intra(int16 *blk, PIXEL *comp, int width);
61     void idctrow2_intra(int16 *blk, PIXEL *comp, int width);
62     void idctrow3_intra(int16 *blk, PIXEL *comp, int width);
63     void idctrow4_intra(int16 *blk, PIXEL *comp, int width);
64 #ifdef __cplusplus
65 }
66 #endif
67 #endif
68 
69 /* this code assumes ">>" to be a two's-complement arithmetic */
70 /* right shift: (-2)>>1 == -1 , (-3)>>1 == -2                 */
71 
72 /* a positive real constant is converted to an integer scaled by 2048 */
73 /* or equivalent to left shift by 11 */
74 
75 #define W1 2841                 /* 2048*sqrt(2)*cos(1*pi/16) */
76 #define W2 2676                 /* 2048*sqrt(2)*cos(2*pi/16) */
77 #define W3 2408                 /* 2048*sqrt(2)*cos(3*pi/16) */
78 #define W5 1609                 /* 2048*sqrt(2)*cos(5*pi/16) */
79 #define W6 1108                 /* 2048*sqrt(2)*cos(6*pi/16) */
80 #define W7 565                  /* 2048*sqrt(2)*cos(7*pi/16) */
81 #define W1mW7 2276
82 #define W1pW7 3406
83 #define W5mW3 (-799)
84 #define mW3mW5 (-4017)
85 #define mW2mW6 (-3784)
86 #define W2mW6 1568
87 
88 /* left shift by 11 is to maintain the accuracy of the decimal point */
89 /* for the transform coefficients (W1,...W7) */
90 
91 /*----------------------------------------------------------------------------
92 ; EXTERNAL VARIABLES REFERENCES
93 ; Declare variables used in this module but defined elsewhere
94 ----------------------------------------------------------------------------*/
95 
96 /*----------------------------------------------------------------------------
97 ; SIMPLE TYPEDEF'S
98 ----------------------------------------------------------------------------*/
99 
100 /*----------------------------------------------------------------------------
101 ; ENUMERATED TYPEDEF'S
102 ----------------------------------------------------------------------------*/
103 
104 /*----------------------------------------------------------------------------
105 ; STRUCTURES TYPEDEF'S
106 ----------------------------------------------------------------------------*/
107 
108 /*----------------------------------------------------------------------------
109 ; GLOBAL FUNCTION DEFINITIONS
110 ; Function Prototype declaration
111 ----------------------------------------------------------------------------*/
112 
113 /*----------------------------------------------------------------------------
114 ; END
115 ----------------------------------------------------------------------------*/
116 #endif
117 
118 
119