Mercurial > libavcodec.hg
annotate vp3dsp.c @ 2788:1bf080e490db libavcodec
fix segfault (bug #1165640)
| author | michael |
|---|---|
| date | Mon, 11 Jul 2005 22:56:23 +0000 |
| parents | 02925a3903b6 |
| children | fd5d7c732c6b |
| 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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
21 * Standard C DSP-oriented functions cribbed from the original VP3 |
|
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 #include "vp3data.h" |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
29 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
30 #define IdctAdjustBeforeShift 8 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
31 #define xC1S7 64277 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
32 #define xC2S6 60547 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
33 #define xC3S5 54491 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
34 #define xC4S4 46341 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
35 #define xC5S3 36410 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
36 #define xC6S2 25080 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
37 #define xC7S1 12785 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
38 |
| 2693 | 39 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
|
40 { |
| 2693 | 41 int16_t *ip = input; |
| 42 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
|
43 |
| 2693 | 44 int A_, B_, C_, D_, _Ad, _Bd, _Cd, _Dd, E_, F_, G_, H_; |
| 45 int _Ed, _Gd, _Add, _Bdd, _Fd, _Hd; | |
| 46 int t1, t2; | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
47 |
| 1977 | 48 int i, j; |
|
2692
fb8f26fc57eb
remove permutation done to quant tables and then undone during idct
michael
parents:
2024
diff
changeset
|
49 |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
50 /* Inverse DCT on the rows now */ |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
51 for (i = 0; i < 8; i++) { |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
52 /* Check for non-zero values */ |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
53 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
|
54 t1 = (int32_t)(xC1S7 * ip[1]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
55 t2 = (int32_t)(xC7S1 * ip[7]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
56 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
57 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
58 A_ = t1 + t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
59 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
60 t1 = (int32_t)(xC7S1 * ip[1]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
61 t2 = (int32_t)(xC1S7 * ip[7]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
62 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
63 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
64 B_ = t1 - t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
65 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
66 t1 = (int32_t)(xC3S5 * ip[3]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
67 t2 = (int32_t)(xC5S3 * ip[5]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
68 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
69 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
70 C_ = t1 + t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
71 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
72 t1 = (int32_t)(xC3S5 * ip[5]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
73 t2 = (int32_t)(xC5S3 * ip[3]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
74 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
75 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
76 D_ = t1 - t2; |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
79 t1 = (int32_t)(xC4S4 * (A_ - C_)); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
80 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
81 _Ad = t1; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
82 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
83 t1 = (int32_t)(xC4S4 * (B_ - D_)); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
84 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
85 _Bd = t1; |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
88 _Cd = A_ + C_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
89 _Dd = B_ + D_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
90 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
91 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
|
92 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
93 E_ = t1; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
94 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
95 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
|
96 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
97 F_ = t1; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
98 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
99 t1 = (int32_t)(xC2S6 * ip[2]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
100 t2 = (int32_t)(xC6S2 * ip[6]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
101 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
102 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
103 G_ = t1 + t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
104 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
105 t1 = (int32_t)(xC6S2 * ip[2]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
106 t2 = (int32_t)(xC2S6 * ip[6]); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
107 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
108 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
109 H_ = t1 - t2; |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
112 _Ed = E_ - G_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
113 _Gd = E_ + G_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
114 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
115 _Add = F_ + _Ad; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
116 _Bdd = _Bd - H_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
117 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
118 _Fd = F_ - _Ad; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
119 _Hd = _Bd + H_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
120 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
121 /* Final sequence of operations over-write original inputs. */ |
| 2693 | 122 ip[0] = _Gd + _Cd ; |
| 123 ip[7] = _Gd - _Cd ; | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
124 |
| 2693 | 125 ip[1] = _Add + _Hd; |
| 126 ip[2] = _Add - _Hd; | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
127 |
| 2693 | 128 ip[3] = _Ed + _Dd ; |
| 129 ip[4] = _Ed - _Dd ; | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
130 |
| 2693 | 131 ip[5] = _Fd + _Bdd; |
| 132 ip[6] = _Fd - _Bdd; | |
|
1866
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
136 ip += 8; /* next row */ |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
137 } |
| 2693 | 138 |
| 139 ip = input; | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
140 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
141 for ( i = 0; i < 8; i++) { |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
142 /* Check for non-zero values (bitwise or faster than ||) */ |
| 2693 | 143 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
|
144 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
|
145 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
146 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
|
147 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
|
148 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
149 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
150 A_ = t1 + t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
151 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
152 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
|
153 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
|
154 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
155 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
156 B_ = t1 - t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
157 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
158 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
|
159 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
|
160 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
161 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
162 C_ = t1 + t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
163 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
164 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
|
165 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
|
166 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
167 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
168 D_ = t1 - t2; |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
171 t1 = (int32_t)(xC4S4 * (A_ - C_)); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
172 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
173 _Ad = t1; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
174 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
175 t1 = (int32_t)(xC4S4 * (B_ - D_)); |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
176 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
177 _Bd = t1; |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
180 _Cd = A_ + C_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
181 _Dd = B_ + D_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
182 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
183 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
|
184 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
185 E_ = t1; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
186 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
187 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
|
188 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
189 F_ = t1; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
190 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
191 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
|
192 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
|
193 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
194 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
195 G_ = t1 + t2; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
196 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
197 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
|
198 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
|
199 t1 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
200 t2 >>= 16; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
201 H_ = t1 - t2; |
|
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
204 _Ed = E_ - G_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
205 _Gd = E_ + G_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
206 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
207 _Add = F_ + _Ad; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
208 _Bdd = _Bd - H_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
209 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
210 _Fd = F_ - _Ad; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
211 _Hd = _Bd + H_; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
212 |
| 2693 | 213 if(type==1){ //HACK |
| 214 _Gd += 16*128; | |
| 215 _Add+= 16*128; | |
| 216 _Ed += 16*128; | |
| 217 _Fd += 16*128; | |
| 218 } | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
219 _Gd += IdctAdjustBeforeShift; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
220 _Add += IdctAdjustBeforeShift; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
221 _Ed += IdctAdjustBeforeShift; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
222 _Fd += IdctAdjustBeforeShift; |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
223 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
224 /* Final sequence of operations over-write original inputs. */ |
| 2693 | 225 if(type==0){ |
| 226 ip[0*8] = (_Gd + _Cd ) >> 4; | |
| 227 ip[7*8] = (_Gd - _Cd ) >> 4; | |
| 228 | |
| 229 ip[1*8] = (_Add + _Hd ) >> 4; | |
| 230 ip[2*8] = (_Add - _Hd ) >> 4; | |
| 231 | |
| 232 ip[3*8] = (_Ed + _Dd ) >> 4; | |
| 233 ip[4*8] = (_Ed - _Dd ) >> 4; | |
| 234 | |
| 235 ip[5*8] = (_Fd + _Bdd ) >> 4; | |
| 236 ip[6*8] = (_Fd - _Bdd ) >> 4; | |
| 237 }else if(type==1){ | |
| 238 dst[0*stride] = cm[(_Gd + _Cd ) >> 4]; | |
| 239 dst[7*stride] = cm[(_Gd - _Cd ) >> 4]; | |
| 240 | |
| 241 dst[1*stride] = cm[(_Add + _Hd ) >> 4]; | |
| 242 dst[2*stride] = cm[(_Add - _Hd ) >> 4]; | |
| 243 | |
| 244 dst[3*stride] = cm[(_Ed + _Dd ) >> 4]; | |
| 245 dst[4*stride] = cm[(_Ed - _Dd ) >> 4]; | |
| 246 | |
| 247 dst[5*stride] = cm[(_Fd + _Bdd ) >> 4]; | |
| 248 dst[6*stride] = cm[(_Fd - _Bdd ) >> 4]; | |
| 249 }else{ | |
| 250 dst[0*stride] = cm[dst[0*stride] + ((_Gd + _Cd ) >> 4)]; | |
| 251 dst[7*stride] = cm[dst[7*stride] + ((_Gd - _Cd ) >> 4)]; | |
| 252 | |
| 253 dst[1*stride] = cm[dst[1*stride] + ((_Add + _Hd ) >> 4)]; | |
| 254 dst[2*stride] = cm[dst[2*stride] + ((_Add - _Hd ) >> 4)]; | |
| 255 | |
| 256 dst[3*stride] = cm[dst[3*stride] + ((_Ed + _Dd ) >> 4)]; | |
| 257 dst[4*stride] = cm[dst[4*stride] + ((_Ed - _Dd ) >> 4)]; | |
| 258 | |
| 259 dst[5*stride] = cm[dst[5*stride] + ((_Fd + _Bdd ) >> 4)]; | |
| 260 dst[6*stride] = cm[dst[6*stride] + ((_Fd - _Bdd ) >> 4)]; | |
| 261 } | |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
262 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
263 } else { |
| 2693 | 264 if(type==0){ |
| 265 ip[0*8] = | |
| 266 ip[1*8] = | |
| 267 ip[2*8] = | |
| 268 ip[3*8] = | |
| 269 ip[4*8] = | |
| 270 ip[5*8] = | |
| 271 ip[6*8] = | |
| 272 ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20); | |
| 273 }else if(type==1){ | |
| 274 dst[0*stride]= | |
| 275 dst[1*stride]= | |
| 276 dst[2*stride]= | |
| 277 dst[3*stride]= | |
| 278 dst[4*stride]= | |
| 279 dst[5*stride]= | |
| 280 dst[6*stride]= | |
| 281 dst[7*stride]= 128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20); | |
| 282 }else{ | |
| 283 if(ip[0*8]){ | |
| 284 int v= ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20); | |
| 285 dst[0*stride] = cm[dst[0*stride] + v]; | |
| 286 dst[1*stride] = cm[dst[1*stride] + v]; | |
| 287 dst[2*stride] = cm[dst[2*stride] + v]; | |
| 288 dst[3*stride] = cm[dst[3*stride] + v]; | |
| 289 dst[4*stride] = cm[dst[4*stride] + v]; | |
| 290 dst[5*stride] = cm[dst[5*stride] + v]; | |
| 291 dst[6*stride] = cm[dst[6*stride] + v]; | |
| 292 dst[7*stride] = cm[dst[7*stride] + v]; | |
| 293 } | |
| 294 } | |
|
1866
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 |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
297 ip++; /* next column */ |
| 2693 | 298 dst++; |
|
1866
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
299 } |
|
1755f959ab7f
seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff
changeset
|
300 } |
| 2693 | 301 |
| 302 void ff_vp3_idct_c(DCTELEM *block/* align 16*/){ | |
| 303 idct(NULL, 0, block, 0); | |
| 304 } | |
| 305 | |
| 306 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){ | |
| 307 idct(dest, line_size, block, 1); | |
| 308 } | |
| 309 | |
| 310 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){ | |
| 311 idct(dest, line_size, block, 2); | |
| 312 } |
