annotate vp3dsp.c @ 3362:c43fcf831f7c libavcodec

Do not read full byte when less than 8 bits are still to be read. Does not make a difference with any of my samples, but current code does not make much sense.
author reimar
date Tue, 27 Jun 2006 12:13:01 +0000
parents 0b546eab515d
children 074c9f3d8e62
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
40 int16_t *ip = input;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
43 int A_, B_, C_, D_, _Ad, _Bd, _Cd, _Dd, E_, F_, G_, H_;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
44 int _Ed, _Gd, _Add, _Bdd, _Fd, _Hd;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
fd5d7c732c6b kill a bunch of compiler warnings
mru
parents: 2693
diff changeset
47 int i;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
121 ip[0] = _Gd + _Cd ;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
124 ip[1] = _Add + _Hd;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
127 ip[3] = _Ed + _Dd ;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
130 ip[5] = _Fd + _Bdd;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
137
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
212 if(type==1){ //HACK
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
213 _Gd += 16*128;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
214 _Add+= 16*128;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
215 _Ed += 16*128;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
216 _Fd += 16*128;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
224 if(type==0){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
225 ip[0*8] = (_Gd + _Cd ) >> 4;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
226 ip[7*8] = (_Gd - _Cd ) >> 4;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
227
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
228 ip[1*8] = (_Add + _Hd ) >> 4;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
229 ip[2*8] = (_Add - _Hd ) >> 4;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
230
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
231 ip[3*8] = (_Ed + _Dd ) >> 4;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
232 ip[4*8] = (_Ed - _Dd ) >> 4;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
233
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
234 ip[5*8] = (_Fd + _Bdd ) >> 4;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
235 ip[6*8] = (_Fd - _Bdd ) >> 4;
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
236 }else if(type==1){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
237 dst[0*stride] = cm[(_Gd + _Cd ) >> 4];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
238 dst[7*stride] = cm[(_Gd - _Cd ) >> 4];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
239
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
240 dst[1*stride] = cm[(_Add + _Hd ) >> 4];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
241 dst[2*stride] = cm[(_Add - _Hd ) >> 4];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
242
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
243 dst[3*stride] = cm[(_Ed + _Dd ) >> 4];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
244 dst[4*stride] = cm[(_Ed - _Dd ) >> 4];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
245
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
246 dst[5*stride] = cm[(_Fd + _Bdd ) >> 4];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
247 dst[6*stride] = cm[(_Fd - _Bdd ) >> 4];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
248 }else{
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
249 dst[0*stride] = cm[dst[0*stride] + ((_Gd + _Cd ) >> 4)];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
250 dst[7*stride] = cm[dst[7*stride] + ((_Gd - _Cd ) >> 4)];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
251
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
252 dst[1*stride] = cm[dst[1*stride] + ((_Add + _Hd ) >> 4)];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
253 dst[2*stride] = cm[dst[2*stride] + ((_Add - _Hd ) >> 4)];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
254
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
255 dst[3*stride] = cm[dst[3*stride] + ((_Ed + _Dd ) >> 4)];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
256 dst[4*stride] = cm[dst[4*stride] + ((_Ed - _Dd ) >> 4)];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
257
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
258 dst[5*stride] = cm[dst[5*stride] + ((_Fd + _Bdd ) >> 4)];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
259 dst[6*stride] = cm[dst[6*stride] + ((_Fd - _Bdd ) >> 4)];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
263 if(type==0){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
264 ip[0*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
265 ip[1*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
266 ip[2*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
267 ip[3*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
268 ip[4*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
269 ip[5*8] =
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
270 ip[6*8] =
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
271 ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
272 }else if(type==1){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
273 dst[0*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
274 dst[1*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
275 dst[2*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
276 dst[3*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
277 dst[4*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
278 dst[5*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
279 dst[6*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
280 dst[7*stride]= 128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
281 }else{
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
282 if(ip[0*8]){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
283 int v= ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
284 dst[0*stride] = cm[dst[0*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
285 dst[1*stride] = cm[dst[1*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
286 dst[2*stride] = cm[dst[2*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
287 dst[3*stride] = cm[dst[3*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
288 dst[4*stride] = cm[dst[4*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
289 dst[5*stride] = cm[dst[5*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
290 dst[6*stride] = cm[dst[6*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
291 dst[7*stride] = cm[dst[7*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
292 }
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
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
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
300
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
301 void ff_vp3_idct_c(DCTELEM *block/* align 16*/){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
302 idct(NULL, 0, block, 0);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
303 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
304
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
305 void ff_vp3_idct_put_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
306 idct(dest, line_size, block, 1);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
307 }
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
308
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
309 void ff_vp3_idct_add_c(uint8_t *dest/*align 8*/, int line_size, DCTELEM *block/*align 16*/){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
310 idct(dest, line_size, block, 2);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
311 }