diff --git a/celt/celt_decoder.c b/celt/celt_decoder.c index 35a2073a183ee9295c6788b42b565db0a443d27a..883dae15d2907c2d75cc28eaf0c46f8c3e941b8e 100644 --- a/celt/celt_decoder.c +++ b/celt/celt_decoder.c @@ -629,7 +629,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) buf = decode_mem[c]; for (i=0;i<MAX_PERIOD+LPC_ORDER;i++) - exc[i-LPC_ORDER] = ROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-LPC_ORDER+i], SIG_SHIFT); + exc[i-LPC_ORDER] = SROUND16(buf[DECODE_BUFFER_SIZE-MAX_PERIOD-LPC_ORDER+i], SIG_SHIFT); if (loss_duration == 0) { @@ -731,7 +731,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) exc[extrapolation_offset+j])), SIG_SHIFT); /* Compute the energy of the previously decoded signal whose excitation we're copying. */ - tmp = ROUND16( + tmp = SROUND16( buf[DECODE_BUFFER_SIZE-MAX_PERIOD-N+extrapolation_offset+j], SIG_SHIFT); S1 += SHR32(MULT16_16(tmp, tmp), 10); @@ -741,7 +741,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) /* Copy the last decoded samples (prior to the overlap region) to synthesis filter memory so we can have a continuous signal. */ for (i=0;i<LPC_ORDER;i++) - lpc_mem[i] = ROUND16(buf[DECODE_BUFFER_SIZE-N-1-i], SIG_SHIFT); + lpc_mem[i] = SROUND16(buf[DECODE_BUFFER_SIZE-N-1-i], SIG_SHIFT); /* Apply the synthesis filter to convert the excitation back into the signal domain. */ celt_iir(buf+DECODE_BUFFER_SIZE-N, lpc+c*LPC_ORDER, @@ -760,7 +760,7 @@ static void celt_decode_lost(CELTDecoder * OPUS_RESTRICT st, int N, int LM) opus_val32 S2=0; for (i=0;i<extrapolation_len;i++) { - opus_val16 tmp = ROUND16(buf[DECODE_BUFFER_SIZE-N+i], SIG_SHIFT); + opus_val16 tmp = SROUND16(buf[DECODE_BUFFER_SIZE-N+i], SIG_SHIFT); S2 += SHR32(MULT16_16(tmp, tmp), 10); } /* This checks for an "explosion" in the synthesis. */ diff --git a/celt/celt_lpc.c b/celt/celt_lpc.c index 242e6df55e6dc4ee802292ac72f78acaa154bc87..f91721bcab97d54184f6befcbd865035fb244d98 100644 --- a/celt/celt_lpc.c +++ b/celt/celt_lpc.c @@ -159,17 +159,17 @@ void celt_fir_c( sum[2] = SHL32(EXTEND32(x[i+2]), SIG_SHIFT); sum[3] = SHL32(EXTEND32(x[i+3]), SIG_SHIFT); xcorr_kernel(rnum, x+i-ord, sum, ord, arch); - y[i ] = ROUND16(sum[0], SIG_SHIFT); - y[i+1] = ROUND16(sum[1], SIG_SHIFT); - y[i+2] = ROUND16(sum[2], SIG_SHIFT); - y[i+3] = ROUND16(sum[3], SIG_SHIFT); + y[i ] = SROUND16(sum[0], SIG_SHIFT); + y[i+1] = SROUND16(sum[1], SIG_SHIFT); + y[i+2] = SROUND16(sum[2], SIG_SHIFT); + y[i+3] = SROUND16(sum[3], SIG_SHIFT); } for (;i<N;i++) { opus_val32 sum = SHL32(EXTEND32(x[i]), SIG_SHIFT); for (j=0;j<ord;j++) sum = MAC16_16(sum,rnum[j],x[i+j-ord]); - y[i] = ROUND16(sum, SIG_SHIFT); + y[i] = SROUND16(sum, SIG_SHIFT); } RESTORE_STACK; }