summaryrefslogtreecommitdiff
path: root/lib/rbcodec/codecs/libopus/celt/pitch.h
diff options
context:
space:
mode:
authorNils Wallménius <nils@rockbox.org>2013-05-20 22:25:57 +0200
committerNils Wallménius <nils@rockbox.org>2013-08-31 08:30:51 +0200
commit580b307fd791c0997a8831bc800bba87797bfb7e (patch)
tree807846056f06fd944a750ce41217a877910ebd59 /lib/rbcodec/codecs/libopus/celt/pitch.h
parent74761b70acd96cecc0d35450dd56a98ad9ee7d3d (diff)
downloadrockbox-580b307fd791c0997a8831bc800bba87797bfb7e.tar.gz
rockbox-580b307fd791c0997a8831bc800bba87797bfb7e.zip
Sync opus codec to upstream git
Sync opus codec to upstream commit 02fed471a4568852d6618e041c4f2af0d7730ee2 (August 30 2013) This brings in a lot of optimizations but also makes the diff between our codec and the upstream much smaller as most of our optimizations have been upstreamed or supeceded. Speedups across the board for CELT mode files: 64kbps 128kbps H300 9.82MHz 15.48MHz c200 4.86MHz 9.63MHz fuze v1 10.32MHz 15.92MHz For the silk mode test file (16kbps) arm targets get a speedup of about 2MHz while the H300 is 7.8MHz slower, likely because it's now using the pseudostack more rather than the real stack which is in iram. Patches to get around that are upcomming. Change-Id: Ifecf963e461c51ac42e09dac1e91bc4bc3b12fa3
Diffstat (limited to 'lib/rbcodec/codecs/libopus/celt/pitch.h')
-rw-r--r--lib/rbcodec/codecs/libopus/celt/pitch.h97
1 files changed, 97 insertions, 0 deletions
diff --git a/lib/rbcodec/codecs/libopus/celt/pitch.h b/lib/rbcodec/codecs/libopus/celt/pitch.h
index 2757071a6f..caffd24bc4 100644
--- a/lib/rbcodec/codecs/libopus/celt/pitch.h
+++ b/lib/rbcodec/codecs/libopus/celt/pitch.h
@@ -36,6 +36,10 @@
36 36
37#include "modes.h" 37#include "modes.h"
38 38
39#if defined(__SSE__) && !defined(FIXED_POINT)
40#include "x86/pitch_sse.h"
41#endif
42
39void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp, 43void pitch_downsample(celt_sig * OPUS_RESTRICT x[], opus_val16 * OPUS_RESTRICT x_lp,
40 int len, int C); 44 int len, int C);
41 45
@@ -45,4 +49,97 @@ void pitch_search(const opus_val16 * OPUS_RESTRICT x_lp, opus_val16 * OPUS_RESTR
45opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, 49opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod,
46 int N, int *T0, int prev_period, opus_val16 prev_gain); 50 int N, int *T0, int prev_period, opus_val16 prev_gain);
47 51
52/* OPT: This is the kernel you really want to optimize. It gets used a lot
53 by the prefilter and by the PLC. */
54#ifndef OVERRIDE_XCORR_KERNEL
55static inline void xcorr_kernel(const opus_val16 * x, const opus_val16 * y, opus_val32 sum[4], int len)
56{
57 int j;
58 opus_val16 y_0, y_1, y_2, y_3;
59 y_3=0; /* gcc doesn't realize that y_3 can't be used uninitialized */
60 y_0=*y++;
61 y_1=*y++;
62 y_2=*y++;
63 for (j=0;j<len-3;j+=4)
64 {
65 opus_val16 tmp;
66 tmp = *x++;
67 y_3=*y++;
68 sum[0] = MAC16_16(sum[0],tmp,y_0);
69 sum[1] = MAC16_16(sum[1],tmp,y_1);
70 sum[2] = MAC16_16(sum[2],tmp,y_2);
71 sum[3] = MAC16_16(sum[3],tmp,y_3);
72 tmp=*x++;
73 y_0=*y++;
74 sum[0] = MAC16_16(sum[0],tmp,y_1);
75 sum[1] = MAC16_16(sum[1],tmp,y_2);
76 sum[2] = MAC16_16(sum[2],tmp,y_3);
77 sum[3] = MAC16_16(sum[3],tmp,y_0);
78 tmp=*x++;
79 y_1=*y++;
80 sum[0] = MAC16_16(sum[0],tmp,y_2);
81 sum[1] = MAC16_16(sum[1],tmp,y_3);
82 sum[2] = MAC16_16(sum[2],tmp,y_0);
83 sum[3] = MAC16_16(sum[3],tmp,y_1);
84 tmp=*x++;
85 y_2=*y++;
86 sum[0] = MAC16_16(sum[0],tmp,y_3);
87 sum[1] = MAC16_16(sum[1],tmp,y_0);
88 sum[2] = MAC16_16(sum[2],tmp,y_1);
89 sum[3] = MAC16_16(sum[3],tmp,y_2);
90 }
91 if (j++<len)
92 {
93 opus_val16 tmp = *x++;
94 y_3=*y++;
95 sum[0] = MAC16_16(sum[0],tmp,y_0);
96 sum[1] = MAC16_16(sum[1],tmp,y_1);
97 sum[2] = MAC16_16(sum[2],tmp,y_2);
98 sum[3] = MAC16_16(sum[3],tmp,y_3);
99 }
100 if (j++<len)
101 {
102 opus_val16 tmp=*x++;
103 y_0=*y++;
104 sum[0] = MAC16_16(sum[0],tmp,y_1);
105 sum[1] = MAC16_16(sum[1],tmp,y_2);
106 sum[2] = MAC16_16(sum[2],tmp,y_3);
107 sum[3] = MAC16_16(sum[3],tmp,y_0);
108 }
109 if (j<len)
110 {
111 opus_val16 tmp=*x++;
112 y_1=*y++;
113 sum[0] = MAC16_16(sum[0],tmp,y_2);
114 sum[1] = MAC16_16(sum[1],tmp,y_3);
115 sum[2] = MAC16_16(sum[2],tmp,y_0);
116 sum[3] = MAC16_16(sum[3],tmp,y_1);
117 }
118}
119#endif /* OVERRIDE_XCORR_KERNEL */
120
121#ifndef OVERRIDE_DUAL_INNER_PROD
122static inline void dual_inner_prod(const opus_val16 *x, const opus_val16 *y01, const opus_val16 *y02,
123 int N, opus_val32 *xy1, opus_val32 *xy2)
124{
125 int i;
126 opus_val32 xy01=0;
127 opus_val32 xy02=0;
128 for (i=0;i<N;i++)
129 {
130 xy01 = MAC16_16(xy01, x[i], y01[i]);
131 xy02 = MAC16_16(xy02, x[i], y02[i]);
132 }
133 *xy1 = xy01;
134 *xy2 = xy02;
135}
136#endif
137
138#ifdef FIXED_POINT
139opus_val32
140#else
141void
142#endif
143celt_pitch_xcorr(const opus_val16 *_x, const opus_val16 *_y, opus_val32 *xcorr, int len, int max_pitch);
144
48#endif 145#endif