Using restrict to make it clear there's no aliasing issues in the mdct.
This commit is contained in:
parent
a536f77202
commit
3203474732
2 changed files with 13 additions and 13 deletions
|
@ -156,7 +156,7 @@ static inline celt_int16_t SIG2INT16(celt_sig_t x)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Apply window and compute the MDCT for all sub-frames and all channels in a frame */
|
/** Apply window and compute the MDCT for all sub-frames and all channels in a frame */
|
||||||
static celt_word32_t compute_mdcts(const mdct_lookup *lookup, const celt_word16_t * restrict window, celt_sig_t *in, celt_sig_t *out, int N, int overlap, int B, int C)
|
static celt_word32_t compute_mdcts(const mdct_lookup *lookup, const celt_word16_t * restrict window, celt_sig_t * restrict in, celt_sig_t * restrict out, int N, int overlap, int B, int C)
|
||||||
{
|
{
|
||||||
int i, c, N4;
|
int i, c, N4;
|
||||||
celt_word32_t E = 0;
|
celt_word32_t E = 0;
|
||||||
|
@ -171,12 +171,17 @@ static celt_word32_t compute_mdcts(const mdct_lookup *lookup, const celt_word16_
|
||||||
for (i=0;i<B;i++)
|
for (i=0;i<B;i++)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
|
celt_word32_t * restrict x1, * restrict x2;
|
||||||
for (j=0;j<2*N-2*N4;j++)
|
for (j=0;j<2*N-2*N4;j++)
|
||||||
x[j+N4] = in[C*i*N+C*j+c];
|
x[j+N4] = in[C*i*N+C*j+c];
|
||||||
|
x1 = x+N4;
|
||||||
|
x2 = x+2*N-N4-1;
|
||||||
for (j=0;j<overlap;j++)
|
for (j=0;j<overlap;j++)
|
||||||
{
|
{
|
||||||
x[j+N4] = MULT16_32_Q15(window[j],x[j+N4]);
|
*x1 = MULT16_32_Q15(window[j],*x1);
|
||||||
x[2*N-j-N4-1] = MULT16_32_Q15(window[j],x[2*N-j-N4-1]);
|
*x2 = MULT16_32_Q15(window[j],*x2);
|
||||||
|
x1++;
|
||||||
|
x2--;
|
||||||
}
|
}
|
||||||
for (j=0;j<N4;j++)
|
for (j=0;j<N4;j++)
|
||||||
{
|
{
|
||||||
|
@ -196,7 +201,7 @@ static celt_word32_t compute_mdcts(const mdct_lookup *lookup, const celt_word16_
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Compute the IMDCT and apply window for all sub-frames and all channels in a frame */
|
/** Compute the IMDCT and apply window for all sub-frames and all channels in a frame */
|
||||||
static void compute_inv_mdcts(const mdct_lookup *lookup, const celt_word16_t * restrict window, celt_sig_t *X, celt_sig_t *out_mem, celt_sig_t *mdct_overlap, int N, int overlap, int B, int C)
|
static void compute_inv_mdcts(const mdct_lookup *lookup, const celt_word16_t * restrict window, celt_sig_t *X, celt_sig_t * restrict out_mem, celt_sig_t * restrict mdct_overlap, int N, int overlap, int B, int C)
|
||||||
{
|
{
|
||||||
int i, c, N4;
|
int i, c, N4;
|
||||||
VARDECL(celt_word32_t, x);
|
VARDECL(celt_word32_t, x);
|
||||||
|
@ -217,16 +222,11 @@ static void compute_inv_mdcts(const mdct_lookup *lookup, const celt_word16_t * r
|
||||||
/* The first and last part would need to be set to zero if we actually
|
/* The first and last part would need to be set to zero if we actually
|
||||||
wanted to use them. */
|
wanted to use them. */
|
||||||
for (j=0;j<overlap;j++)
|
for (j=0;j<overlap;j++)
|
||||||
{
|
out_mem[C*(MAX_PERIOD+(i-B)*N)+C*j+c] = 2*(mdct_overlap[C*j+c]+MULT16_32_Q15(window[j],x[j+N4]));
|
||||||
x[j+N4] = MULT16_32_Q15(window[j],x[j+N4]);
|
|
||||||
x[2*N-j-N4-1] = MULT16_32_Q15(window[j],x[2*N-j-N4-1]);
|
|
||||||
}
|
|
||||||
for (j=0;j<overlap;j++)
|
for (j=0;j<overlap;j++)
|
||||||
out_mem[C*(MAX_PERIOD+(i-B)*N)+C*j+c] = 2*(x[N4+j]+mdct_overlap[C*j+c]);
|
mdct_overlap[C*(overlap-j-1)+c] = MULT16_32_Q15(window[j],x[2*N-j-N4-1]);
|
||||||
for (j=0;j<2*N4;j++)
|
for (j=0;j<2*N4;j++)
|
||||||
out_mem[C*(MAX_PERIOD+(i-B)*N)+C*(j+overlap)+c] = 2*x[j+N4+overlap];
|
out_mem[C*(MAX_PERIOD+(i-B)*N)+C*(j+overlap)+c] = 2*x[j+N4+overlap];
|
||||||
for (j=0;j<overlap;j++)
|
|
||||||
mdct_overlap[C*j+c] = x[N+N4+j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RESTORE_STACK;
|
RESTORE_STACK;
|
||||||
|
|
|
@ -86,7 +86,7 @@ void mdct_clear(mdct_lookup *l)
|
||||||
celt_free(l->trig);
|
celt_free(l->trig);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out)
|
void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int N, N2, N4;
|
int N, N2, N4;
|
||||||
|
@ -131,7 +131,7 @@ void mdct_forward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *ou
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar *out)
|
void mdct_backward(const mdct_lookup *l, kiss_fft_scalar *in, kiss_fft_scalar * restrict out)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int N, N2, N4;
|
int N, N2, N4;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue