Mercurial > libavcodec.hg
annotate vp3dsp.c @ 3214:91f89a395b28 libavcodec
10l
author | lorenm |
---|---|
date | Wed, 22 Mar 2006 22:08:28 +0000 |
parents | 0b546eab515d |
children | 074c9f3d8e62 |
rev | line source |
---|---|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
1 /* |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
2 * Copyright (C) 2004 the ffmpeg project |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
3 * |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
4 * This library is free software; you can redistribute it and/or |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
5 * modify it under the terms of the GNU Lesser General Public |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
6 * License as published by the Free Software Foundation; either |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
7 * version 2 of the License, or (at your option) any later version. |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
8 * |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
9 * This library is distributed in the hope that it will be useful, |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
12 * Lesser General Public License for more details. |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
13 * |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
14 * You should have received a copy of the GNU Lesser General Public |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
15 * License along with this library; if not, write to the Free Software |
3036
0b546eab515d
Update licensing information: The FSF changed postal address.
diego
parents:
2967
diff
changeset
|
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
17 */ |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
18 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
19 /** |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
20 * @file vp3dsp.c |
2967 | 21 * Standard C DSP-oriented functions cribbed from the original VP3 |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
22 * source code. |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
23 */ |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
24 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
25 #include "common.h" |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
26 #include "avcodec.h" |
2024
f65d87bfdd5a
some of the warning fixes by (Michael Roitzsch <mroi at users dot sourceforge dot net>)
michael
parents:
1977
diff
changeset
|
27 #include "dsputil.h" |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
28 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
29 #define IdctAdjustBeforeShift 8 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
30 #define xC1S7 64277 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
31 #define xC2S6 60547 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
32 #define xC3S5 54491 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
33 #define xC4S4 46341 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
34 #define xC5S3 36410 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
35 #define xC6S2 25080 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
36 #define xC7S1 12785 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
37 |
2693 | 38 static always_inline void idct(uint8_t *dst, int stride, int16_t *input, int type) |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
39 { |
2693 | 40 int16_t *ip = input; |
41 uint8_t *cm = cropTbl + MAX_NEG_CROP; | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
42 |
2693 | 43 int A_, B_, C_, D_, _Ad, _Bd, _Cd, _Dd, E_, F_, G_, H_; |
44 int _Ed, _Gd, _Add, _Bdd, _Fd, _Hd; | |
45 int t1, t2; | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
46 |
2834 | 47 int i; |
2967 | 48 |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
49 /* Inverse DCT on the rows now */ |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
50 for (i = 0; i < 8; i++) { |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
51 /* Check for non-zero values */ |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
52 if ( ip[0] | ip[1] | ip[2] | ip[3] | ip[4] | ip[5] | ip[6] | ip[7] ) { |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
53 t1 = (int32_t)(xC1S7 * ip[1]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
54 t2 = (int32_t)(xC7S1 * ip[7]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
55 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
56 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
57 A_ = t1 + t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
58 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
59 t1 = (int32_t)(xC7S1 * ip[1]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
60 t2 = (int32_t)(xC1S7 * ip[7]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
61 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
62 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
63 B_ = t1 - t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
64 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
65 t1 = (int32_t)(xC3S5 * ip[3]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
66 t2 = (int32_t)(xC5S3 * ip[5]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
67 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
68 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
69 C_ = t1 + t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
70 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
71 t1 = (int32_t)(xC3S5 * ip[5]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
72 t2 = (int32_t)(xC5S3 * ip[3]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
73 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
74 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
75 D_ = t1 - t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
76 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
77 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
78 t1 = (int32_t)(xC4S4 * (A_ - C_)); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
79 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
80 _Ad = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
81 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
82 t1 = (int32_t)(xC4S4 * (B_ - D_)); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
83 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
84 _Bd = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
85 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
86 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
87 _Cd = A_ + C_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
88 _Dd = B_ + D_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
89 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
90 t1 = (int32_t)(xC4S4 * (ip[0] + ip[4])); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
91 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
92 E_ = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
93 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
94 t1 = (int32_t)(xC4S4 * (ip[0] - ip[4])); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
95 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
96 F_ = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
97 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
98 t1 = (int32_t)(xC2S6 * ip[2]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
99 t2 = (int32_t)(xC6S2 * ip[6]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
100 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
101 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
102 G_ = t1 + t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
103 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
104 t1 = (int32_t)(xC6S2 * ip[2]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
105 t2 = (int32_t)(xC2S6 * ip[6]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
106 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
107 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
108 H_ = t1 - t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
109 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
110 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
111 _Ed = E_ - G_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
112 _Gd = E_ + G_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
113 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
114 _Add = F_ + _Ad; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
115 _Bdd = _Bd - H_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
116 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
117 _Fd = F_ - _Ad; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
118 _Hd = _Bd + H_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
119 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
120 /* Final sequence of operations over-write original inputs. */ |
2693 | 121 ip[0] = _Gd + _Cd ; |
122 ip[7] = _Gd - _Cd ; | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
123 |
2693 | 124 ip[1] = _Add + _Hd; |
125 ip[2] = _Add - _Hd; | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
126 |
2693 | 127 ip[3] = _Ed + _Dd ; |
128 ip[4] = _Ed - _Dd ; | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
129 |
2693 | 130 ip[5] = _Fd + _Bdd; |
131 ip[6] = _Fd - _Bdd; | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
132 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
133 } |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
134 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
135 ip += 8; /* next row */ |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
136 } |
2967 | 137 |
2693 | 138 ip = input; |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
139 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
140 for ( i = 0; i < 8; i++) { |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
141 /* Check for non-zero values (bitwise or faster than ||) */ |
2693 | 142 if ( ip[1 * 8] | ip[2 * 8] | ip[3 * 8] | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
143 ip[4 * 8] | ip[5 * 8] | ip[6 * 8] | ip[7 * 8] ) { |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
144 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
145 t1 = (int32_t)(xC1S7 * ip[1*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
146 t2 = (int32_t)(xC7S1 * ip[7*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
147 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
148 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
149 A_ = t1 + t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
150 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
151 t1 = (int32_t)(xC7S1 * ip[1*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
152 t2 = (int32_t)(xC1S7 * ip[7*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
153 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
154 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
155 B_ = t1 - t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
156 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
157 t1 = (int32_t)(xC3S5 * ip[3*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
158 t2 = (int32_t)(xC5S3 * ip[5*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
159 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
160 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
161 C_ = t1 + t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
162 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
163 t1 = (int32_t)(xC3S5 * ip[5*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
164 t2 = (int32_t)(xC5S3 * ip[3*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
165 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
166 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
167 D_ = t1 - t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
168 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
169 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
170 t1 = (int32_t)(xC4S4 * (A_ - C_)); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
171 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
172 _Ad = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
173 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
174 t1 = (int32_t)(xC4S4 * (B_ - D_)); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
175 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
176 _Bd = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
177 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
178 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
179 _Cd = A_ + C_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
180 _Dd = B_ + D_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
181 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
182 t1 = (int32_t)(xC4S4 * (ip[0*8] + ip[4*8])); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
183 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
184 E_ = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
185 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
186 t1 = (int32_t)(xC4S4 * (ip[0*8] - ip[4*8])); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
187 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
188 F_ = t1; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
189 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
190 t1 = (int32_t)(xC2S6 * ip[2*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
191 t2 = (int32_t)(xC6S2 * ip[6*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
192 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
193 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
194 G_ = t1 + t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
195 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
196 t1 = (int32_t)(xC6S2 * ip[2*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
197 t2 = (int32_t)(xC2S6 * ip[6*8]); |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
198 t1 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
199 t2 >>= 16; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
200 H_ = t1 - t2; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
201 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
202 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
203 _Ed = E_ - G_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
204 _Gd = E_ + G_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
205 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
206 _Add = F_ + _Ad; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
207 _Bdd = _Bd - H_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
208 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
209 _Fd = F_ - _Ad; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
210 _Hd = _Bd + H_; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
211 |
2693 | 212 if(type==1){ //HACK |
213 _Gd += 16*128; | |
214 _Add+= 16*128; | |
215 _Ed += 16*128; | |
216 _Fd += 16*128; | |
217 } | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
218 _Gd += IdctAdjustBeforeShift; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
219 _Add += IdctAdjustBeforeShift; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
220 _Ed += IdctAdjustBeforeShift; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
221 _Fd += IdctAdjustBeforeShift; |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
222 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
223 /* Final sequence of operations over-write original inputs. */ |
2693 | 224 if(type==0){ |
225 ip[0*8] = (_Gd + _Cd ) >> 4; | |
226 ip[7*8] = (_Gd - _Cd ) >> 4; | |
2967 | 227 |
2693 | 228 ip[1*8] = (_Add + _Hd ) >> 4; |
229 ip[2*8] = (_Add - _Hd ) >> 4; | |
2967 | 230 |
2693 | 231 ip[3*8] = (_Ed + _Dd ) >> 4; |
232 ip[4*8] = (_Ed - _Dd ) >> 4; | |
2967 | 233 |
2693 | 234 ip[5*8] = (_Fd + _Bdd ) >> 4; |
235 ip[6*8] = (_Fd - _Bdd ) >> 4; | |
236 }else if(type==1){ | |
237 dst[0*stride] = cm[(_Gd + _Cd ) >> 4]; | |
238 dst[7*stride] = cm[(_Gd - _Cd ) >> 4]; | |
2967 | 239 |
2693 | 240 dst[1*stride] = cm[(_Add + _Hd ) >> 4]; |
241 dst[2*stride] = cm[(_Add - _Hd ) >> 4]; | |
2967 | 242 |
2693 | 243 dst[3*stride] = cm[(_Ed + _Dd ) >> 4]; |
244 dst[4*stride] = cm[(_Ed - _Dd ) >> 4]; | |
2967 | 245 |
2693 | 246 dst[5*stride] = cm[(_Fd + _Bdd ) >> 4]; |
247 dst[6*stride] = cm[(_Fd - _Bdd ) >> 4]; | |
248 }else{ | |
249 dst[0*stride] = cm[dst[0*stride] + ((_Gd + _Cd ) >> 4)]; | |
250 dst[7*stride] = cm[dst[7*stride] + ((_Gd - _Cd ) >> 4)]; | |
2967 | 251 |
2693 | 252 dst[1*stride] = cm[dst[1*stride] + ((_Add + _Hd ) >> 4)]; |
253 dst[2*stride] = cm[dst[2*stride] + ((_Add - _Hd ) >> 4)]; | |
2967 | 254 |
2693 | 255 dst[3*stride] = cm[dst[3*stride] + ((_Ed + _Dd ) >> 4)]; |
256 dst[4*stride] = cm[dst[4*stride] + ((_Ed - _Dd ) >> 4)]; | |
2967 | 257 |
2693 | 258 dst[5*stride] = cm[dst[5*stride] + ((_Fd + _Bdd ) >> 4)]; |
259 dst[6*stride] = cm[dst[6*stride] + ((_Fd - _Bdd ) >> 4)]; | |
260 } | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
261 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
262 } else { |
2693 | 263 if(type==0){ |
2967 | 264 ip[0*8] = |
265 ip[1*8] = | |
266 ip[2*8] = | |
267 ip[3*8] = | |
268 ip[4*8] = | |
269 ip[5*8] = | |
2693 | 270 ip[6*8] = |
271 ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20); | |
272 }else if(type==1){ | |
273 dst[0*stride]= | |
274 dst[1*stride]= | |
275 dst[2*stride]= | |
276 dst[3*stride]= | |
277 dst[4*stride]= | |
278 dst[5*stride]= | |
279 dst[6*stride]= | |
280 dst[7*stride]= 128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20); | |
281 }else{ | |
282 if(ip[0*8]){ | |
283 int v= ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20); | |
284 dst[0*stride] = cm[dst[0*stride] + v]; | |
285 dst[1*stride] = cm[dst[1*stride] + v]; | |
286 dst[2*stride] = cm[dst[2*stride] + v]; | |
287 dst[3*stride] = cm[dst[3*stride] + v]; | |
288 dst[4*stride] = cm[dst[4*stride] + v]; | |
289 dst[5*stride] = cm[dst[5*stride] + v]; | |
290 dst[6*stride] = cm[dst[6*stride] + v]; | |
291 dst[7*stride] = cm[dst[7*stride] + v]; | |
292 } | |
293 } | |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
294 } |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
295 |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
296 ip++; /* next column */ |
2693 | 297 dst++; |
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
298 } |
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
299 } |
2693 | 300 |
301 void ff_vp3_idct_c(DCTELEM *block/* align 16*/){ | |
302 idct(NULL, 0, block, 0); | |
303 } | |
2967 | 304 |
2693 | 305 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){ |
306 idct(dest, line_size, block, 1); | |
307 } | |
308 | |
309 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){ | |
310 idct(dest, line_size, block, 2); | |
311 } |