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

Side by Side Diff: celt/pitch.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/os_support.h ('k') | celt/pitch.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2007-2008 CSIRO 1 /* Copyright (c) 2007-2008 CSIRO
2 Copyright (c) 2007-2009 Xiph.Org Foundation 2 Copyright (c) 2007-2009 Xiph.Org Foundation
3 Written by Jean-Marc Valin */ 3 Written by Jean-Marc Valin */
4 /** 4 /**
5 @file pitch.h 5 @file pitch.h
6 @brief Pitch analysis 6 @brief Pitch analysis
7 */ 7 */
8 8
9 /* 9 /*
10 Redistribution and use in source and binary forms, with or without 10 Redistribution and use in source and binary forms, with or without
(...skipping 19 matching lines...) Expand all
30 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 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. 31 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */ 32 */
33 33
34 #ifndef PITCH_H 34 #ifndef PITCH_H
35 #define PITCH_H 35 #define PITCH_H
36 36
37 #include "modes.h" 37 #include "modes.h"
38 #include "cpu_support.h" 38 #include "cpu_support.h"
39 39
40 #if defined(__SSE__) && !defined(FIXED_POINT) 40 #if defined(__SSE__) && !defined(FIXED_POINT) \
41 || defined(OPUS_X86_MAY_HAVE_SSE4_1) || defined(OPUS_X86_MAY_HAVE_SSE2)
41 #include "x86/pitch_sse.h" 42 #include "x86/pitch_sse.h"
42 #endif 43 #endif
43 44
44 #if defined(OPUS_ARM_ASM) && defined(FIXED_POINT) 45 #if defined(MIPSr1_ASM)
46 #include "mips/pitch_mipsr1.h"
47 #endif
48
49 #if ((defined(OPUS_ARM_ASM) && defined(FIXED_POINT)) \
50 || defined(OPUS_ARM_NEON_INTR))
45 # include "arm/pitch_arm.h" 51 # include "arm/pitch_arm.h"
46 #endif 52 #endif
47 53
48 void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x _lp, 54 void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x _lp,
49 int len, int C, int arch); 55 int len, int C, int arch);
50 56
51 void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR ICT y, 57 void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR ICT y,
52 int len, int max_pitch, int *pitch, int arch); 58 int len, int max_pitch, int *pitch, int arch);
53 59
54 opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, 60 opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
55 int N, int *T0, int prev_period, opus_val16 prev_gain); 61 int N, int *T0, int prev_period, opus_val16 prev_gain, int arch);
62
56 63
57 /* OPT: This is the kernel you really want to optimize. It gets used a lot 64 /* OPT: This is the kernel you really want to optimize. It gets used a lot
58 by the prefilter and by the PLC. */ 65 by the prefilter and by the PLC. */
59 #ifndef OVERRIDE_XCORR_KERNEL 66 static OPUS_INLINE void xcorr_kernel_c(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len)
60 static OPUS_INLINE void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len)
61 { 67 {
62 int j; 68 int j;
63 opus_val16 y_0, y_1, y_2, y_3; 69 opus_val16 y_0, y_1, y_2, y_3;
64 celt_assert(len>=3); 70 celt_assert(len>=3);
65 y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */ 71 y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
66 y_0=*y++; 72 y_0=*y++;
67 y_1=*y++; 73 y_1=*y++;
68 y_2=*y++; 74 y_2=*y++;
69 for (j=0;j<len-3;j+=4) 75 for (j=0;j<len-3;j+=4)
70 { 76 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 if (j<len) 121 if (j<len)
116 { 122 {
117 opus_val16 tmp=*x++; 123 opus_val16 tmp=*x++;
118 y_1=*y++; 124 y_1=*y++;
119 sum[0] = MAC16_16(sum[0],tmp,y_2); 125 sum[0] = MAC16_16(sum[0],tmp,y_2);
120 sum[1] = MAC16_16(sum[1],tmp,y_3); 126 sum[1] = MAC16_16(sum[1],tmp,y_3);
121 sum[2] = MAC16_16(sum[2],tmp,y_0); 127 sum[2] = MAC16_16(sum[2],tmp,y_0);
122 sum[3] = MAC16_16(sum[3],tmp,y_1); 128 sum[3] = MAC16_16(sum[3],tmp,y_1);
123 } 129 }
124 } 130 }
131
132 #ifndef OVERRIDE_XCORR_KERNEL
133 #define xcorr_kernel(x, y, sum, len, arch) \
134 ((void)(arch),xcorr_kernel_c(x, y, sum, len))
125 #endif /* OVERRIDE_XCORR_KERNEL */ 135 #endif /* OVERRIDE_XCORR_KERNEL */
126 136
137
127 #ifndef OVERRIDE_DUAL_INNER_PROD 138 #ifndef OVERRIDE_DUAL_INNER_PROD
128 static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y 01, const opus_val16 *y02, 139 static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y 01, const opus_val16 *y02,
129 int N, opus_val32 *xy1, opus_val32 *xy2) 140 int N, opus_val32 *xy1, opus_val32 *xy2)
130 { 141 {
131 int i; 142 int i;
132 opus_val32 xy01=0; 143 opus_val32 xy01=0;
133 opus_val32 xy02=0; 144 opus_val32 xy02=0;
134 for (i=0;i<N;i++) 145 for (i=0;i<N;i++)
135 { 146 {
136 xy01 = MAC16_16(xy01, x[i], y01[i]); 147 xy01 = MAC16_16(xy01, x[i], y01[i]);
137 xy02 = MAC16_16(xy02, x[i], y02[i]); 148 xy02 = MAC16_16(xy02, x[i], y02[i]);
138 } 149 }
139 *xy1 = xy01; 150 *xy1 = xy01;
140 *xy2 = xy02; 151 *xy2 = xy02;
141 } 152 }
142 #endif 153 #endif
143 154
155 /*We make sure a C version is always available for cases where the overhead of
156 vectorization and passing around an arch flag aren't worth it.*/
157 static OPUS_INLINE opus_val32 celt_inner_prod_c(const opus_val16 *x,
158 const opus_val16 *y, int N)
159 {
160 int i;
161 opus_val32 xy=0;
162 for (i=0;i<N;i++)
163 xy = MAC16_16(xy, x[i], y[i]);
164 return xy;
165 }
166
167 #if !defined(OVERRIDE_CELT_INNER_PROD)
168 # define celt_inner_prod(x, y, N, arch) \
169 ((void)(arch),celt_inner_prod_c(x, y, N))
170 #endif
171
144 #ifdef FIXED_POINT 172 #ifdef FIXED_POINT
145 opus_val32 173 opus_val32
146 #else 174 #else
147 void 175 void
148 #endif 176 #endif
149 celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y, 177 celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y,
150 opus_val32 *xcorr, int len, int max_pitch); 178 opus_val32 *xcorr, int len, int max_pitch);
151 179
152 #if !defined(OVERRIDE_PITCH_XCORR) 180 #if !defined(OVERRIDE_PITCH_XCORR)
153 /*Is run-time CPU detection enabled on this platform?*/ 181 /*Is run-time CPU detection enabled on this platform?*/
154 # if defined(OPUS_HAVE_RTCD) 182 # if defined(OPUS_HAVE_RTCD) && \
183 (defined(OPUS_ARM_ASM) || defined(OPUS_ARM_NEON_INTR))
155 extern 184 extern
156 # if defined(FIXED_POINT) 185 # if defined(FIXED_POINT)
157 opus_val32 186 opus_val32
158 # else 187 # else
159 void 188 void
160 # endif 189 # endif
161 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *, 190 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
162 const opus_val16 *, opus_val32 *, int, int); 191 const opus_val16 *, opus_val32 *, int, int);
163 192
193 # define OVERRIDE_PITCH_XCORR
164 # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ 194 # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
165 ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \ 195 ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
166 xcorr, len, max_pitch)) 196 xcorr, len, max_pitch))
167 # else 197 # else
168 # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \ 198
169 ((void)(arch),celt_pitch_xcorr_c(_x, _y, xcorr, len, max_pitch)) 199 #ifdef FIXED_POINT
200 opus_val32
201 #else
202 void
203 #endif
204 celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y,
205 opus_val32 *xcorr, int len, int max_pitch, int arch);
206
170 # endif 207 # endif
171 #endif 208 #endif
172 209
173 #endif 210 #endif
OLDNEW
« no previous file with comments | « celt/os_support.h ('k') | celt/pitch.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698