annotate vp3dsp.c @ 10896:f112b4d030fa libavcodec

Avoid wasting 4 cpu cycles per MB in redundantly calculating qp_thresh.
author michael
date Sat, 16 Jan 2010 11:55:35 +0000
parents e9d9d946f213
children f7281af560fe
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 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3505
diff changeset
4 * This file is part of FFmpeg.
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3505
diff changeset
5 *
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3505
diff changeset
6 * FFmpeg is free software; you can redistribute it and/or
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
7 * 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
8 * License as published by the Free Software Foundation; either
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3505
diff changeset
9 * version 2.1 of the License, or (at your option) any later version.
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
10 *
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3505
diff changeset
11 * FFmpeg is distributed in the hope that it will be useful,
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
12 * 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
13 * 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
14 * 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
15 *
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
16 * You should have received a copy of the GNU Lesser General Public
3947
c8c591fe26f8 Change license headers to say 'FFmpeg' instead of 'this program/this library'
diego
parents: 3505
diff changeset
17 * License along with FFmpeg; if not, write to the Free Software
3036
0b546eab515d Update licensing information: The FSF changed postal address.
diego
parents: 2967
diff changeset
18 * 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
19 */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
20
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
21 /**
8718
e9d9d946f213 Use full internal pathname in doxygen @file directives.
diego
parents: 7995
diff changeset
22 * @file libavcodec/vp3dsp.c
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
23 * 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
24 * source code.
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
25 */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
26
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
27 #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
28 #include "dsputil.h"
1866
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
3503
074c9f3d8e62 remove a few useless casts and avoid the useless t1/t2 variables
michael
parents: 3036
diff changeset
39 #define M(a,b) (((a) * (b))>>16)
074c9f3d8e62 remove a few useless casts and avoid the useless t1/t2 variables
michael
parents: 3036
diff changeset
40
4283
d6f83e2f8804 rename always_inline to av_always_inline and move to common.h
mru
parents: 4176
diff changeset
41 static av_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
42 {
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
43 int16_t *ip = input;
4176
23da44e8fd05 rename cropTbl -> ff_cropTbl
mru
parents: 3947
diff changeset
44 uint8_t *cm = ff_cropTbl + MAX_NEG_CROP;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
45
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
46 int A, B, C, D, Ad, Bd, Cd, Dd, E, F, G, H;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
47 int Ed, Gd, Add, Bdd, Fd, Hd;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
48
2834
fd5d7c732c6b kill a bunch of compiler warnings
mru
parents: 2693
diff changeset
49 int i;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
50
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
51 /* Inverse DCT on the rows now */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
52 for (i = 0; i < 8; i++) {
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
53 /* Check for non-zero values */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
54 if ( ip[0] | ip[1] | ip[2] | ip[3] | ip[4] | ip[5] | ip[6] | ip[7] ) {
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
55 A = M(xC1S7, ip[1]) + M(xC7S1, ip[7]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
56 B = M(xC7S1, ip[1]) - M(xC1S7, ip[7]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
57 C = M(xC3S5, ip[3]) + M(xC5S3, ip[5]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
58 D = M(xC3S5, ip[5]) - M(xC5S3, ip[3]);
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
59
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
60 Ad = M(xC4S4, (A - C));
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
61 Bd = M(xC4S4, (B - D));
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
62
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
63 Cd = A + C;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
64 Dd = B + D;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
65
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
66 E = M(xC4S4, (ip[0] + ip[4]));
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
67 F = M(xC4S4, (ip[0] - ip[4]));
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
68
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
69 G = M(xC2S6, ip[2]) + M(xC6S2, ip[6]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
70 H = M(xC6S2, ip[2]) - M(xC2S6, ip[6]);
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
71
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
72 Ed = E - G;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
73 Gd = E + G;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
74
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
75 Add = F + Ad;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
76 Bdd = Bd - H;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
77
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
78 Fd = F - Ad;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
79 Hd = Bd + H;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
80
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
81 /* Final sequence of operations over-write original inputs. */
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
82 ip[0] = Gd + Cd ;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
83 ip[7] = Gd - Cd ;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
84
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
85 ip[1] = Add + Hd;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
86 ip[2] = Add - Hd;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
87
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
88 ip[3] = Ed + Dd ;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
89 ip[4] = Ed - Dd ;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
90
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
91 ip[5] = Fd + Bdd;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
92 ip[6] = Fd - Bdd;
1866
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
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
95 ip += 8; /* next row */
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
96 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
97
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
98 ip = input;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
99
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
100 for ( i = 0; i < 8; i++) {
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
101 /* Check for non-zero values (bitwise or faster than ||) */
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
102 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
103 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
104
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
105 A = M(xC1S7, ip[1*8]) + M(xC7S1, ip[7*8]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
106 B = M(xC7S1, ip[1*8]) - M(xC1S7, ip[7*8]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
107 C = M(xC3S5, ip[3*8]) + M(xC5S3, ip[5*8]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
108 D = M(xC3S5, ip[5*8]) - M(xC5S3, ip[3*8]);
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
109
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
110 Ad = M(xC4S4, (A - C));
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
111 Bd = M(xC4S4, (B - D));
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
112
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
113 Cd = A + C;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
114 Dd = B + D;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
115
3505
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
116 E = M(xC4S4, (ip[0*8] + ip[4*8])) + 8;
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
117 F = M(xC4S4, (ip[0*8] - ip[4*8])) + 8;
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
118
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
119 if(type==1){ //HACK
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
120 E += 16*128;
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
121 F += 16*128;
d8dabe4ca9be avoid 4 +
michael
parents: 3504
diff changeset
122 }
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
123
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
124 G = M(xC2S6, ip[2*8]) + M(xC6S2, ip[6*8]);
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
125 H = M(xC6S2, ip[2*8]) - M(xC2S6, ip[6*8]);
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
126
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
127 Ed = E - G;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
128 Gd = E + G;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
129
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
130 Add = F + Ad;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
131 Bdd = Bd - H;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
132
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
133 Fd = F - Ad;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
134 Hd = Bd + H;
1866
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 /* Final sequence of operations over-write original inputs. */
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
137 if(type==0){
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
138 ip[0*8] = (Gd + Cd ) >> 4;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
139 ip[7*8] = (Gd - Cd ) >> 4;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
140
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
141 ip[1*8] = (Add + Hd ) >> 4;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
142 ip[2*8] = (Add - Hd ) >> 4;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
143
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
144 ip[3*8] = (Ed + Dd ) >> 4;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
145 ip[4*8] = (Ed - Dd ) >> 4;
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
146
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
147 ip[5*8] = (Fd + Bdd ) >> 4;
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
148 ip[6*8] = (Fd - Bdd ) >> 4;
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
149 }else if(type==1){
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
150 dst[0*stride] = cm[(Gd + Cd ) >> 4];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
151 dst[7*stride] = cm[(Gd - Cd ) >> 4];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
152
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
153 dst[1*stride] = cm[(Add + Hd ) >> 4];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
154 dst[2*stride] = cm[(Add - Hd ) >> 4];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
155
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
156 dst[3*stride] = cm[(Ed + Dd ) >> 4];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
157 dst[4*stride] = cm[(Ed - Dd ) >> 4];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
158
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
159 dst[5*stride] = cm[(Fd + Bdd ) >> 4];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
160 dst[6*stride] = cm[(Fd - Bdd ) >> 4];
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
161 }else{
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
162 dst[0*stride] = cm[dst[0*stride] + ((Gd + Cd ) >> 4)];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
163 dst[7*stride] = cm[dst[7*stride] + ((Gd - Cd ) >> 4)];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
164
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
165 dst[1*stride] = cm[dst[1*stride] + ((Add + Hd ) >> 4)];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
166 dst[2*stride] = cm[dst[2*stride] + ((Add - Hd ) >> 4)];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
167
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
168 dst[3*stride] = cm[dst[3*stride] + ((Ed + Dd ) >> 4)];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
169 dst[4*stride] = cm[dst[4*stride] + ((Ed - Dd ) >> 4)];
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
170
3504
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
171 dst[5*stride] = cm[dst[5*stride] + ((Fd + Bdd ) >> 4)];
40d83cd39561 remove 166 useless underscores, and make this file valid c code as a result
michael
parents: 3503
diff changeset
172 dst[6*stride] = cm[dst[6*stride] + ((Fd - Bdd ) >> 4)];
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
173 }
1866
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 } else {
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
176 if(type==0){
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
177 ip[0*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
178 ip[1*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
179 ip[2*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
180 ip[3*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
181 ip[4*8] =
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
182 ip[5*8] =
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
183 ip[6*8] =
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
184 ip[7*8] = ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
185 }else if(type==1){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
186 dst[0*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
187 dst[1*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
188 dst[2*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
189 dst[3*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
190 dst[4*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
191 dst[5*stride]=
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
192 dst[6*stride]=
7274
25914f8a9bb3 Fix decoding of 320x240.ogg.
michael
parents: 4962
diff changeset
193 dst[7*stride]= cm[128 + ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20)];
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
194 }else{
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
195 if(ip[0*8]){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
196 int v= ((xC4S4 * ip[0*8] + (IdctAdjustBeforeShift<<16))>>20);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
197 dst[0*stride] = cm[dst[0*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
198 dst[1*stride] = cm[dst[1*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
199 dst[2*stride] = cm[dst[2*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
200 dst[3*stride] = cm[dst[3*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
201 dst[4*stride] = cm[dst[4*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
202 dst[5*stride] = cm[dst[5*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
203 dst[6*stride] = cm[dst[6*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
204 dst[7*stride] = cm[dst[7*stride] + v];
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
205 }
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
206 }
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
207 }
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 ip++; /* next column */
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
210 dst++;
1866
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
211 }
1755f959ab7f seperated out the C-based VP3 DSP functions into a different file; also
melanson
parents:
diff changeset
212 }
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
213
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
214 void ff_vp3_idct_c(DCTELEM *block/* align 16*/){
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
215 idct(NULL, 0, block, 0);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
216 }
2967
ef2149182f1c COSMETICS: Remove all trailing whitespace.
diego
parents: 2864
diff changeset
217
2693
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
218 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
219 idct(dest, line_size, block, 1);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
220 }
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
221
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
222 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
223 idct(dest, line_size, block, 2);
02925a3903b6 porting vp3 idct over to lavc idct api
michael
parents: 2692
diff changeset
224 }
7995
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
225
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
226 void ff_vp3_v_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
227 {
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
228 unsigned char *end;
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
229 int filter_value;
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
230 const int nstride= -stride;
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
231
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
232 for (end= first_pixel + 8; first_pixel < end; first_pixel++) {
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
233 filter_value =
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
234 (first_pixel[2 * nstride] - first_pixel[ stride])
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
235 +3*(first_pixel[0 ] - first_pixel[nstride]);
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
236 filter_value = bounding_values[(filter_value + 4) >> 3];
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
237 first_pixel[nstride] = av_clip_uint8(first_pixel[nstride] + filter_value);
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
238 first_pixel[0] = av_clip_uint8(first_pixel[0] - filter_value);
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
239 }
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
240 }
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
241
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
242 void ff_vp3_h_loop_filter_c(uint8_t *first_pixel, int stride, int *bounding_values)
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
243 {
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
244 unsigned char *end;
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
245 int filter_value;
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
246
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
247 for (end= first_pixel + 8*stride; first_pixel != end; first_pixel += stride) {
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
248 filter_value =
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
249 (first_pixel[-2] - first_pixel[ 1])
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
250 +3*(first_pixel[ 0] - first_pixel[-1]);
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
251 filter_value = bounding_values[(filter_value + 4) >> 3];
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
252 first_pixel[-1] = av_clip_uint8(first_pixel[-1] + filter_value);
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
253 first_pixel[ 0] = av_clip_uint8(first_pixel[ 0] - filter_value);
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
254 }
1fbfce20cb79 Move VP3 loop filter to DSPContext
conrad
parents: 7274
diff changeset
255 }