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

Side by Side Diff: celt/pitch.h

Issue 107243004: Updating Opus to release 1.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/opus
Patch Set: Created 7 years 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 | Annotate | Revision Log
« 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 17 matching lines...) Expand all
28 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 28 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 29 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
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 39
39 #if defined(__SSE__) && !defined(FIXED_POINT) 40 #if defined(__SSE__) && !defined(FIXED_POINT)
40 #include "x86/pitch_sse.h" 41 #include "x86/pitch_sse.h"
41 #endif 42 #endif
42 43
44 #if defined(OPUS_ARM_ASM) && defined(FIXED_POINT)
45 # include "arm/pitch_arm.h"
46 #endif
47
43 void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x _lp, 48 void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x _lp,
44 int len, int C); 49 int len, int C, int arch);
45 50
46 void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR ICT y, 51 void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR ICT y,
47 int len, int max_pitch, int *pitch); 52 int len, int max_pitch, int *pitch, int arch);
48 53
49 opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, 54 opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
50 int N, int *T0, int prev_period, opus_val16 prev_gain); 55 int N, int *T0, int prev_period, opus_val16 prev_gain);
51 56
52 /* OPT: This is the kernel you really want to optimize. It gets used a lot 57 /* OPT: This is the kernel you really want to optimize. It gets used a lot
53 by the prefilter and by the PLC. */ 58 by the prefilter and by the PLC. */
54 #ifndef OVERRIDE_XCORR_KERNEL 59 #ifndef OVERRIDE_XCORR_KERNEL
55 static inline void xcorr_kernel(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)
56 { 61 {
57 int j; 62 int j;
58 opus_val16 y_0, y_1, y_2, y_3; 63 opus_val16 y_0, y_1, y_2, y_3;
64 celt_assert(len>=3);
59 y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */ 65 y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
60 y_0=*y++; 66 y_0=*y++;
61 y_1=*y++; 67 y_1=*y++;
62 y_2=*y++; 68 y_2=*y++;
63 for (j=0;j<len-3;j+=4) 69 for (j=0;j<len-3;j+=4)
64 { 70 {
65 opus_val16 tmp; 71 opus_val16 tmp;
66 tmp = *x++; 72 tmp = *x++;
67 y_3=*y++; 73 y_3=*y++;
68 sum[0] = MAC16_16(sum[0],tmp,y_0); 74 sum[0] = MAC16_16(sum[0],tmp,y_0);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 y_1=*y++; 118 y_1=*y++;
113 sum[0] = MAC16_16(sum[0],tmp,y_2); 119 sum[0] = MAC16_16(sum[0],tmp,y_2);
114 sum[1] = MAC16_16(sum[1],tmp,y_3); 120 sum[1] = MAC16_16(sum[1],tmp,y_3);
115 sum[2] = MAC16_16(sum[2],tmp,y_0); 121 sum[2] = MAC16_16(sum[2],tmp,y_0);
116 sum[3] = MAC16_16(sum[3],tmp,y_1); 122 sum[3] = MAC16_16(sum[3],tmp,y_1);
117 } 123 }
118 } 124 }
119 #endif /* OVERRIDE_XCORR_KERNEL */ 125 #endif /* OVERRIDE_XCORR_KERNEL */
120 126
121 #ifndef OVERRIDE_DUAL_INNER_PROD 127 #ifndef OVERRIDE_DUAL_INNER_PROD
122 static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, c onst opus_val16 *y02, 128 static OPUS_INLINE void dual_inner_prod(const opus_val16 *x, const opus_val16 *y 01, const opus_val16 *y02,
123 int N, opus_val32 *xy1, opus_val32 *xy2) 129 int N, opus_val32 *xy1, opus_val32 *xy2)
124 { 130 {
125 int i; 131 int i;
126 opus_val32 xy01=0; 132 opus_val32 xy01=0;
127 opus_val32 xy02=0; 133 opus_val32 xy02=0;
128 for (i=0;i<N;i++) 134 for (i=0;i<N;i++)
129 { 135 {
130 xy01 = MAC16_16(xy01, x[i], y01[i]); 136 xy01 = MAC16_16(xy01, x[i], y01[i]);
131 xy02 = MAC16_16(xy02, x[i], y02[i]); 137 xy02 = MAC16_16(xy02, x[i], y02[i]);
132 } 138 }
133 *xy1 = xy01; 139 *xy1 = xy01;
134 *xy2 = xy02; 140 *xy2 = xy02;
135 } 141 }
136 #endif 142 #endif
137 143
138 #ifdef FIXED_POINT 144 #ifdef FIXED_POINT
139 opus_val32 145 opus_val32
140 #else 146 #else
141 void 147 void
142 #endif 148 #endif
143 celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch); 149 celt_pitch_xcorr_c(const opus_val16 *_x, const opus_val16 *_y,
150 opus_val32 *xcorr, int len, int max_pitch);
151
152 #if !defined(OVERRIDE_PITCH_XCORR)
153 /*Is run-time CPU detection enabled on this platform?*/
154 # if defined(OPUS_HAVE_RTCD)
155 extern
156 # if defined(FIXED_POINT)
157 opus_val32
158 # else
159 void
160 # endif
161 (*const CELT_PITCH_XCORR_IMPL[OPUS_ARCHMASK+1])(const opus_val16 *,
162 const opus_val16 *, opus_val32 *, int, int);
163
164 # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
165 ((*CELT_PITCH_XCORR_IMPL[(arch)&OPUS_ARCHMASK])(_x, _y, \
166 xcorr, len, max_pitch))
167 # else
168 # define celt_pitch_xcorr(_x, _y, xcorr, len, max_pitch, arch) \
169 ((void)(arch),celt_pitch_xcorr_c(_x, _y, xcorr, len, max_pitch))
170 # endif
171 #endif
144 172
145 #endif 173 #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