• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 _DCT_H_
19 #define _DCT_H_
20 
21 const static Int ColThInter[32] = {0, 0x1C, 0x4C, 0x6C, 0x9C, 0xBC, 0xEC, 0x10C,
22                                    0x13C, 0x15C, 0x18C, 0x1AC, 0x1DC, 0x1FC, 0x22C, 0x24C,
23                                    0x27C, 0x29C, 0x2CC, 0x2EC, 0x31C, 0x33C, 0x36C, 0x38C,
24                                    0x3BC, 0x3DC, 0x40C, 0x42C, 0x45C, 0x47C, 0x4AC, 0x4CC
25                                   };
26 
27 const static Int ColThIntra[32] = {0, 0x1C, 0x3C, 0x5C, 0x7C, 0x9C, 0xBC, 0xDC,
28                                    0xFC, 0x11C, 0x13C, 0x15C, 0x17C, 0x19C, 0x1BC, 0x1DC,
29                                    0x1FC, 0x21C, 0x23C, 0x25C, 0x27C, 0x29C, 0x2BC, 0x2DC,
30                                    0x2FC, 0x31C, 0x33C, 0x35C, 0x37C, 0x39C, 0x3BC, 0x3DC
31                                   };
32 
33 /******************************************************/
34 /********** IDCT part **************************/
35 const static unsigned char imask[8] = {128, 64, 32, 16, 8, 4, 2, 1};
36 const static unsigned char mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe};
37 
38 #define W1 2841                 /* 2048*sqrt(2)*cos(1*pi/16) */
39 #define W2 2676                 /* 2048*sqrt(2)*cos(2*pi/16) */
40 #define W3 2408                 /* 2048*sqrt(2)*cos(3*pi/16) */
41 #define W5 1609                 /* 2048*sqrt(2)*cos(5*pi/16) */
42 #define W6 1108                 /* 2048*sqrt(2)*cos(6*pi/16) */
43 #define W7 565                  /* 2048*sqrt(2)*cos(7*pi/16) */
44 
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #endif
49 
50     /* Reduced input IDCT */
51     void idct_col0(Short *blk);
52     void idct_col1(Short *blk);
53     void idct_col2(Short *blk);
54     void idct_col3(Short *blk);
55     void idct_col4(Short *blk);
56     void idct_col0x40(Short *blk);
57     void idct_col0x20(Short *blk);
58     void idct_col0x10(Short *blk);
59 
60     void idct_rowInter(Short *srce, UChar *rec, Int lx);
61     void idct_row0Inter(Short *blk, UChar *rec, Int lx);
62     void idct_row1Inter(Short *blk, UChar *rec, Int lx);
63     void idct_row2Inter(Short *blk, UChar *rec, Int lx);
64     void idct_row3Inter(Short *blk, UChar *rec, Int lx);
65     void idct_row4Inter(Short *blk, UChar *rec, Int lx);
66     void idct_row0x40Inter(Short *blk, UChar *rec, Int lx);
67     void idct_row0x20Inter(Short *blk, UChar *rec, Int lx);
68     void idct_row0x10Inter(Short *blk, UChar *rec, Int lx);
69     void idct_row0xCCInter(Short *blk, UChar *rec, Int lx);
70     void idct_rowIntra(Short *srce, UChar *rec, Int lx);
71     void idct_row0Intra(Short *blk, UChar *rec, Int lx);
72     void idct_row1Intra(Short *blk, UChar *rec, Int lx);
73     void idct_row2Intra(Short *blk, UChar *rec, Int lx);
74     void idct_row3Intra(Short *blk, UChar *rec, Int lx);
75     void idct_row4Intra(Short *blk, UChar *rec, Int lx);
76     void idct_row0x40Intra(Short *blk, UChar *rec, Int lx);
77     void idct_row0x20Intra(Short *blk, UChar *rec, Int lx);
78     void idct_row0x10Intra(Short *blk, UChar *rec, Int lx);
79     void idct_row0xCCIntra(Short *blk, UChar *rec, Int lx);
80     void idct_rowzmv(Short *srce, UChar *rec, UChar *prev, Int lx);
81     void idct_row0zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
82     void idct_row1zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
83     void idct_row2zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
84     void idct_row3zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
85     void idct_row4zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
86     void idct_row0x40zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
87     void idct_row0x20zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
88     void idct_row0x10zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
89     void idct_row0xCCzmv(Short *blk, UChar *rec, UChar *prev, Int lx);
90 
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 /* Look-up table mapping to RIDCT from bitmap */
97 #ifdef SMALL_DCT
98 
99 static void (*const idctcolVCA[16])(Short*) =
100 {
101     &idct_col0, &idct_col4, &idct_col3, &idct_col4,
102     &idct_col2, &idct_col4, &idct_col3, &idct_col4,
103     &idct_col1, &idct_col4, &idct_col3, &idct_col4,
104     &idct_col2, &idct_col4, &idct_col3, &idct_col4
105 };
106 
107 static void (*const idctrowVCAInter[16])(Short*, UChar*, Int) =
108 {
109     &idct_row0Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
110     &idct_row2Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
111     &idct_row1Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
112     &idct_row2Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter
113 };
114 
115 static void (*const idctrowVCAzmv[16])(Short*, UChar*, UChar*, Int) =
116 {
117     &idct_row0zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
118     &idct_row2zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
119     &idct_row1zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
120     &idct_row2zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv
121 };
122 
123 
124 static void (*const idctrowVCAIntra[16])(Short*, UChar*, Int) =
125 {
126     &idct_row0Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
127     &idct_row2Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
128     &idct_row1Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
129     &idct_row2Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra
130 };
131 
132 #else /* SMALL_DCT */
133 
134 static void (*const idctcolVCA[16])(Short*) =
135 {
136     &idct_col0, &idct_col0x10, &idct_col0x20, &idct_col4,
137     &idct_col0x40, &idct_col4, &idct_col3, &idct_col4,
138     &idct_col1, &idct_col4, &idct_col3, &idct_col4,
139     &idct_col2, &idct_col4, &idct_col3, &idct_col4
140 };
141 
142 static void (*const idctrowVCAInter[16])(Short*, UChar*, Int) =
143 {
144     &idct_row0Inter, &idct_row0x10Inter, &idct_row0x20Inter, &idct_row4Inter,
145     &idct_row0x40Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
146     &idct_row1Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
147     &idct_row2Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter
148 };
149 
150 static void (*const idctrowVCAzmv[16])(Short*, UChar*, UChar*, Int) =
151 {
152     &idct_row0zmv, &idct_row0x10zmv, &idct_row0x20zmv, &idct_row4zmv,
153     &idct_row0x40zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
154     &idct_row1zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
155     &idct_row2zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv
156 };
157 
158 static void (*const idctrowVCAIntra[16])(Short*, UChar*, Int) =
159 {
160     &idct_row0Intra, &idct_row0x10Intra, &idct_row0x20Intra, &idct_row4Intra,
161     &idct_row0x40Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
162     &idct_row1Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
163     &idct_row2Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra
164 };
165 
166 #endif /* SMALL_DCT */
167 
168 #ifdef __cplusplus
169 extern "C"
170 {
171 #endif
172     /* part in AppVCA_dct.c */
173 //void Block1x1DCTzmv (Short *out,UChar *prev,UChar *cur,UChar *rec,Int lx,Int chroma);
174     void Block1x1DCTwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
175     void Block1x1DCTIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
176     /* This part is in dct_aan.c */
177     Void BlockDCT_AANwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
178     Void Block4x4DCT_AANwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
179     Void Block2x2DCT_AANwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
180 //Void BlockDCT_AANzmv(Short *out,UChar *prev,UChar *cur,UChar *rec,Int ColTh,Int lx,Int chroma);
181 //Void Block4x4DCT_AANzmv(Short *out,UChar *prev,UChar *cur,UChar *rec,Int ColTh,Int lx,Int chroma);
182 //Void Block2x2DCT_AANzmv(Short *out,UChar *prev,UChar *cur,UChar *rec,Int ColTh,Int lx,Int chroma);
183     Void BlockDCT_AANIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
184     Void Block4x4DCT_AANIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
185     Void Block2x2DCT_AANIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
186 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif //_DCT_H_
192