summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/codecs/m4v_h263/enc/src/dct.h
blob: 3dceb66705c1f0408550d7c9f9e961cb7c6e8392 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/* ------------------------------------------------------------------
 * Copyright (C) 1998-2009 PacketVideo
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 * -------------------------------------------------------------------
 */
#ifndef _DCT_H_
#define _DCT_H_

const static Int ColThInter[32] = {0, 0x1C, 0x4C, 0x6C, 0x9C, 0xBC, 0xEC, 0x10C,
                                   0x13C, 0x15C, 0x18C, 0x1AC, 0x1DC, 0x1FC, 0x22C, 0x24C,
                                   0x27C, 0x29C, 0x2CC, 0x2EC, 0x31C, 0x33C, 0x36C, 0x38C,
                                   0x3BC, 0x3DC, 0x40C, 0x42C, 0x45C, 0x47C, 0x4AC, 0x4CC
                                  };

const static Int ColThIntra[32] = {0, 0x1C, 0x3C, 0x5C, 0x7C, 0x9C, 0xBC, 0xDC,
                                   0xFC, 0x11C, 0x13C, 0x15C, 0x17C, 0x19C, 0x1BC, 0x1DC,
                                   0x1FC, 0x21C, 0x23C, 0x25C, 0x27C, 0x29C, 0x2BC, 0x2DC,
                                   0x2FC, 0x31C, 0x33C, 0x35C, 0x37C, 0x39C, 0x3BC, 0x3DC
                                  };

/******************************************************/
/********** IDCT part **************************/
const static unsigned char imask[8] = {128, 64, 32, 16, 8, 4, 2, 1};
const static unsigned char mask[8] = {0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe};

#define W1 2841                 /* 2048*sqrt(2)*cos(1*pi/16) */
#define W2 2676                 /* 2048*sqrt(2)*cos(2*pi/16) */
#define W3 2408                 /* 2048*sqrt(2)*cos(3*pi/16) */
#define W5 1609                 /* 2048*sqrt(2)*cos(5*pi/16) */
#define W6 1108                 /* 2048*sqrt(2)*cos(6*pi/16) */
#define W7 565                  /* 2048*sqrt(2)*cos(7*pi/16) */

#ifdef __cplusplus
extern "C"
{
#endif

    /* Reduced input IDCT */
    void idct_col0(Short *blk);
    void idct_col1(Short *blk);
    void idct_col2(Short *blk);
    void idct_col3(Short *blk);
    void idct_col4(Short *blk);
    void idct_col0x40(Short *blk);
    void idct_col0x20(Short *blk);
    void idct_col0x10(Short *blk);

    void idct_rowInter(Short *srce, UChar *rec, Int lx);
    void idct_row0Inter(Short *blk, UChar *rec, Int lx);
    void idct_row1Inter(Short *blk, UChar *rec, Int lx);
    void idct_row2Inter(Short *blk, UChar *rec, Int lx);
    void idct_row3Inter(Short *blk, UChar *rec, Int lx);
    void idct_row4Inter(Short *blk, UChar *rec, Int lx);
    void idct_row0x40Inter(Short *blk, UChar *rec, Int lx);
    void idct_row0x20Inter(Short *blk, UChar *rec, Int lx);
    void idct_row0x10Inter(Short *blk, UChar *rec, Int lx);
    void idct_row0xCCInter(Short *blk, UChar *rec, Int lx);
    void idct_rowIntra(Short *srce, UChar *rec, Int lx);
    void idct_row0Intra(Short *blk, UChar *rec, Int lx);
    void idct_row1Intra(Short *blk, UChar *rec, Int lx);
    void idct_row2Intra(Short *blk, UChar *rec, Int lx);
    void idct_row3Intra(Short *blk, UChar *rec, Int lx);
    void idct_row4Intra(Short *blk, UChar *rec, Int lx);
    void idct_row0x40Intra(Short *blk, UChar *rec, Int lx);
    void idct_row0x20Intra(Short *blk, UChar *rec, Int lx);
    void idct_row0x10Intra(Short *blk, UChar *rec, Int lx);
    void idct_row0xCCIntra(Short *blk, UChar *rec, Int lx);
    void idct_rowzmv(Short *srce, UChar *rec, UChar *prev, Int lx);
    void idct_row0zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row1zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row2zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row3zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row4zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row0x40zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row0x20zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row0x10zmv(Short *blk, UChar *rec, UChar *prev, Int lx);
    void idct_row0xCCzmv(Short *blk, UChar *rec, UChar *prev, Int lx);


#ifdef __cplusplus
}
#endif

/* Look-up table mapping to RIDCT from bitmap */
#ifdef SMALL_DCT

static void (*const idctcolVCA[16])(Short*) =
{
    &idct_col0, &idct_col4, &idct_col3, &idct_col4,
    &idct_col2, &idct_col4, &idct_col3, &idct_col4,
    &idct_col1, &idct_col4, &idct_col3, &idct_col4,
    &idct_col2, &idct_col4, &idct_col3, &idct_col4
};

static void (*const idctrowVCAInter[16])(Short*, UChar*, Int) =
{
    &idct_row0Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
    &idct_row2Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
    &idct_row1Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
    &idct_row2Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter
};

static void (*const idctrowVCAzmv[16])(Short*, UChar*, UChar*, Int) =
{
    &idct_row0zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
    &idct_row2zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
    &idct_row1zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
    &idct_row2zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv
};


static void (*const idctrowVCAIntra[16])(Short*, UChar*, Int) =
{
    &idct_row0Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
    &idct_row2Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
    &idct_row1Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
    &idct_row2Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra
};

#else /* SMALL_DCT */

static void (*const idctcolVCA[16])(Short*) =
{
    &idct_col0, &idct_col0x10, &idct_col0x20, &idct_col4,
    &idct_col0x40, &idct_col4, &idct_col3, &idct_col4,
    &idct_col1, &idct_col4, &idct_col3, &idct_col4,
    &idct_col2, &idct_col4, &idct_col3, &idct_col4
};

static void (*const idctrowVCAInter[16])(Short*, UChar*, Int) =
{
    &idct_row0Inter, &idct_row0x10Inter, &idct_row0x20Inter, &idct_row4Inter,
    &idct_row0x40Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
    &idct_row1Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter,
    &idct_row2Inter, &idct_row4Inter, &idct_row3Inter, &idct_row4Inter
};

static void (*const idctrowVCAzmv[16])(Short*, UChar*, UChar*, Int) =
{
    &idct_row0zmv, &idct_row0x10zmv, &idct_row0x20zmv, &idct_row4zmv,
    &idct_row0x40zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
    &idct_row1zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv,
    &idct_row2zmv, &idct_row4zmv, &idct_row3zmv, &idct_row4zmv
};

static void (*const idctrowVCAIntra[16])(Short*, UChar*, Int) =
{
    &idct_row0Intra, &idct_row0x10Intra, &idct_row0x20Intra, &idct_row4Intra,
    &idct_row0x40Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
    &idct_row1Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra,
    &idct_row2Intra, &idct_row4Intra, &idct_row3Intra, &idct_row4Intra
};

#endif /* SMALL_DCT */

#ifdef __cplusplus
extern "C"
{
#endif
    /* part in AppVCA_dct.c */
//void Block1x1DCTzmv (Short *out,UChar *prev,UChar *cur,UChar *rec,Int lx,Int chroma);
    void Block1x1DCTwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
    void Block1x1DCTIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
    /* This part is in dct_aan.c */
    Void BlockDCT_AANwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
    Void Block4x4DCT_AANwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
    Void Block2x2DCT_AANwSub(Short *out, UChar *cur, UChar *prev, Int pitch_chroma);
//Void BlockDCT_AANzmv(Short *out,UChar *prev,UChar *cur,UChar *rec,Int ColTh,Int lx,Int chroma);
//Void Block4x4DCT_AANzmv(Short *out,UChar *prev,UChar *cur,UChar *rec,Int ColTh,Int lx,Int chroma);
//Void Block2x2DCT_AANzmv(Short *out,UChar *prev,UChar *cur,UChar *rec,Int ColTh,Int lx,Int chroma);
    Void BlockDCT_AANIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
    Void Block4x4DCT_AANIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);
    Void Block2x2DCT_AANIntra(Short *out, UChar *cur, UChar *dummy1, Int pitch_chroma);

#ifdef __cplusplus
}
#endif

#endif //_DCT_H_