Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: celt/mips/pitch_mipsr1.h

Issue 882843002: Update to opus-HEAD-66611f1. (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/opus.git@master
Patch Set: Add the contents of Makefile.mips back. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « celt/mips/mdct_mipsr1.h ('k') | celt/mips/vq_mipsr1.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Written by Jean-Marc Valin */
4 /**
5 @file pitch.h
6 @brief Pitch analysis
7 */
8
9 /*
10 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions
12 are met:
13
14 - Redistributions of source code must retain the above copyright
15 notice, this list of conditions and the following disclaimer.
16
17 - Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
25 OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
26 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
28 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34 #ifndef PITCH_MIPSR1_H
35 #define PITCH_MIPSR1_H
36
37 #define OVERRIDE_DUAL_INNER_PROD
38 static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, c onst opus_val16 *y02,
39 int N, opus_val32 *xy1, opus_val32 *xy2)
40 {
41 int j;
42 opus_val32 xy01=0;
43 opus_val32 xy02=0;
44 asm volatile("MULT $ac1, $0, $0");
45 asm volatile("MULT $ac2, $0, $0");
46 /* Compute the norm of X+Y and X-Y as |X|^2 + |Y|^2 +/- sum(xy) */
47 for (j=0;j<N;j++)
48 {
49 asm volatile("MADD $ac1, %0, %1" : : "r" ((int)x[j]), "r" ((int)y01[j]));
50 asm volatile("MADD $ac2, %0, %1" : : "r" ((int)x[j]), "r" ((int)y02[j]));
51 ++j;
52 asm volatile("MADD $ac1, %0, %1" : : "r" ((int)x[j]), "r" ((int)y01[j]));
53 asm volatile("MADD $ac2, %0, %1" : : "r" ((int)x[j]), "r" ((int)y02[j]));
54 }
55 asm volatile ("mflo %0, $ac1": "=r"(xy01));
56 asm volatile ("mflo %0, $ac2": "=r"(xy02));
57 *xy1 = xy01;
58 *xy2 = xy02;
59 }
60
61 static inline void xcorr_kernel_mips(const opus_val16 * x,
62 const opus_val16 * y, opus_val32 sum[4], int len)
63 {
64 int j;
65 opus_val16 y_0, y_1, y_2, y_3;
66
67 opus_int64 sum_0, sum_1, sum_2, sum_3;
68 sum_0 = (opus_int64)sum[0];
69 sum_1 = (opus_int64)sum[1];
70 sum_2 = (opus_int64)sum[2];
71 sum_3 = (opus_int64)sum[3];
72
73 y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
74 y_0=*y++;
75 y_1=*y++;
76 y_2=*y++;
77 for (j=0;j<len-3;j+=4)
78 {
79 opus_val16 tmp;
80 tmp = *x++;
81 y_3=*y++;
82
83 sum_0 = __builtin_mips_madd( sum_0, tmp, y_0);
84 sum_1 = __builtin_mips_madd( sum_1, tmp, y_1);
85 sum_2 = __builtin_mips_madd( sum_2, tmp, y_2);
86 sum_3 = __builtin_mips_madd( sum_3, tmp, y_3);
87
88 tmp=*x++;
89 y_0=*y++;
90
91 sum_0 = __builtin_mips_madd( sum_0, tmp, y_1 );
92 sum_1 = __builtin_mips_madd( sum_1, tmp, y_2 );
93 sum_2 = __builtin_mips_madd( sum_2, tmp, y_3);
94 sum_3 = __builtin_mips_madd( sum_3, tmp, y_0);
95
96 tmp=*x++;
97 y_1=*y++;
98
99 sum_0 = __builtin_mips_madd( sum_0, tmp, y_2 );
100 sum_1 = __builtin_mips_madd( sum_1, tmp, y_3 );
101 sum_2 = __builtin_mips_madd( sum_2, tmp, y_0);
102 sum_3 = __builtin_mips_madd( sum_3, tmp, y_1);
103
104
105 tmp=*x++;
106 y_2=*y++;
107
108 sum_0 = __builtin_mips_madd( sum_0, tmp, y_3 );
109 sum_1 = __builtin_mips_madd( sum_1, tmp, y_0 );
110 sum_2 = __builtin_mips_madd( sum_2, tmp, y_1);
111 sum_3 = __builtin_mips_madd( sum_3, tmp, y_2);
112
113 }
114 if (j++<len)
115 {
116 opus_val16 tmp = *x++;
117 y_3=*y++;
118
119 sum_0 = __builtin_mips_madd( sum_0, tmp, y_0 );
120 sum_1 = __builtin_mips_madd( sum_1, tmp, y_1 );
121 sum_2 = __builtin_mips_madd( sum_2, tmp, y_2);
122 sum_3 = __builtin_mips_madd( sum_3, tmp, y_3);
123 }
124
125 if (j++<len)
126 {
127 opus_val16 tmp=*x++;
128 y_0=*y++;
129
130 sum_0 = __builtin_mips_madd( sum_0, tmp, y_1 );
131 sum_1 = __builtin_mips_madd( sum_1, tmp, y_2 );
132 sum_2 = __builtin_mips_madd( sum_2, tmp, y_3);
133 sum_3 = __builtin_mips_madd( sum_3, tmp, y_0);
134 }
135
136 if (j<len)
137 {
138 opus_val16 tmp=*x++;
139 y_1=*y++;
140
141 sum_0 = __builtin_mips_madd( sum_0, tmp, y_2 );
142 sum_1 = __builtin_mips_madd( sum_1, tmp, y_3 );
143 sum_2 = __builtin_mips_madd( sum_2, tmp, y_0);
144 sum_3 = __builtin_mips_madd( sum_3, tmp, y_1);
145
146 }
147
148 sum[0] = (opus_val32)sum_0;
149 sum[1] = (opus_val32)sum_1;
150 sum[2] = (opus_val32)sum_2;
151 sum[3] = (opus_val32)sum_3;
152 }
153
154 #define OVERRIDE_XCORR_KERNEL
155 #define xcorr_kernel(x, y, sum, len, arch) \
156 ((void)(arch), xcorr_kernel_mips(x, y, sum, len))
157
158 #endif /* PITCH_MIPSR1_H */
OLDNEW
« no previous file with comments | « celt/mips/mdct_mipsr1.h ('k') | celt/mips/vq_mipsr1.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698