ref: 3aa3afe74fb56d733b92c59ef2b7f7ca65983715
parent: a7750b90cc0b03623115de572a4726b7939f7fc9
author: Jean-Marc Valin <[email protected]>
date: Fri Sep 11 16:28:29 EDT 2009
Only calling intra_fold() when there's no pulse allocated
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -458,9 +458,9 @@
}
/* If pitch isn't available, use intra-frame prediction */
- if ((eBands[i] >= m->pitchEnd && fold) || q<=0)
+ if (q==0)
{
- intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], &q, norm, P+eBands[i], eBands[i], B);
+ intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], norm, P+eBands[i], eBands[i], B);
} else if (pitch_used && eBands[i] < m->pitchEnd) {
for (j=eBands[i];j<eBands[i+1];j++)
P[j] = MULT16_16_Q15(pgains[pband], P[j]);
@@ -695,12 +695,9 @@
}
/* If pitch isn't available, use intra-frame prediction */
- if ((eBands[i] >= m->pitchEnd && fold) || (q1+q2)<=0)
+ if (q1+q2==0)
{
- int K[2];
- K[0] = q1;
- K[1] = q2;
- intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], K, norm, P+C*eBands[i], eBands[i], B);
+ intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], eBands[i], B);
deinterleave(P+C*eBands[i], C*N);
} else if (pitch_used && eBands[i] < m->pitchEnd) {
stereo_band_mix(m, P, bandE, qb==0, i, 1);
@@ -825,9 +822,9 @@
}
/* If pitch isn't available, use intra-frame prediction */
- if ((eBands[i] >= m->pitchEnd && fold) || q<=0)
+ if (q==0)
{
- intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], &q, norm, P+eBands[i], eBands[i], B);
+ intra_fold(m, X+eBands[i], eBands[i+1]-eBands[i], norm, P+eBands[i], eBands[i], B);
} else if (pitch_used && eBands[i] < m->pitchEnd) {
for (j=eBands[i];j<eBands[i+1];j++)
P[j] = MULT16_16_Q15(pgains[pband], P[j]);
@@ -1045,12 +1042,9 @@
/* If pitch isn't available, use intra-frame prediction */
- if ((eBands[i] >= m->pitchEnd && fold) || (q1+q2)<=0)
+ if (q1+q2==0)
{
- int K[2];
- K[0] = q1;
- K[1] = q2;
- intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], K, norm, P+C*eBands[i], eBands[i], B);
+ intra_fold(m, X+C*eBands[i], eBands[i+1]-eBands[i], norm, P+C*eBands[i], eBands[i], B);
deinterleave(P+C*eBands[i], C*N);
} else if (pitch_used && eBands[i] < m->pitchEnd) {
stereo_band_mix(m, P, bandE, qb==0, i, 1);
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -433,7 +433,7 @@
P[j] = Y[id++];
}
-void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, int *pulses, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B)
+void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B)
{
int c;
const int C = CHANNELS(m);
@@ -441,8 +441,7 @@
fold(m, N, Y, P, N0, B);
c=0;
do {
- int K = get_pulses(pulses[c]);
- renormalise_vector(P+c, K==0 ? Q15ONE : 0, N, C);
+ renormalise_vector(P+c, Q15ONE, N, C);
} while (++c < C);
}
--- a/libcelt/vq.h
+++ b/libcelt/vq.h
@@ -74,6 +74,6 @@
* @param B Stride (number of channels multiplied by the number of MDCTs per frame)
* @param N0 Number of valid offsets
*/
-void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, int *pulses, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B);
+void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int N0, int B);
#endif /* VQ_H */