Commit 3aa3afe7 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Only calling intra_fold() when there's no pulse allocated

parent a7750b90
......@@ -458,9 +458,9 @@ void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, ce
}
/* 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 @@ void quant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t
}
/* 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 @@ void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P,
}
/* 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 @@ void unquant_bands_stereo(const CELTMode *m, celt_norm_t * restrict X, celt_norm
/* 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);
......
......@@ -433,7 +433,7 @@ static void fold(const CELTMode *m, int N, celt_norm_t *Y, celt_norm_t * restric
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 @@ void intra_fold(const CELTMode *m, celt_norm_t * restrict x, int N, int *pulses,
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);
}
......@@ -74,6 +74,6 @@ celt_word16_t renormalise_vector(celt_norm_t *X, celt_word16_t value, int N, int
* @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 */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment