shithub: opus

Download patch

ref: 5de868c6d326ab92e4bcf2c8f53592cc6b15be96
parent: 1bc8a2e4b17c840e806856a7b7f44c4d118d4662
author: Jean-Marc Valin <[email protected]>
date: Tue Mar 25 18:38:58 EDT 2008

A bunch of pointers marked as "restrict" to ease the job of the compiler

--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -269,7 +269,7 @@
 }
 
 /* Apply the (quantised) gain to each "pitch band" */
-void pitch_quant_bands(const CELTMode *m, celt_norm_t *P, const celt_pgain_t *gains)
+void pitch_quant_bands(const CELTMode *m, celt_norm_t * restrict P, const celt_pgain_t * restrict gains)
 {
    int i, B;
    const celt_int16_t *pBands = m->pBands;
@@ -287,7 +287,7 @@
 
 
 /* Quantisation of the residual */
-void quant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, celt_mask_t *W, int total_bits, ec_enc *enc)
+void quant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, celt_mask_t *W, int total_bits, ec_enc *enc)
 {
    int i, j, B, bits;
    const celt_int16_t *eBands = m->eBands;
@@ -347,7 +347,7 @@
 }
 
 /* Decoding of the residual */
-void unquant_bands(const CELTMode *m, celt_norm_t *X, celt_norm_t *P, int total_bits, ec_dec *dec)
+void unquant_bands(const CELTMode *m, celt_norm_t * restrict X, celt_norm_t *P, int total_bits, ec_dec *dec)
 {
    int i, j, B, bits;
    const celt_int16_t *eBands = m->eBands;
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -147,7 +147,7 @@
    with associated sign bits.
   _x:      Returns the combination with elements sorted in ascending order.
   _s:      Returns the associated sign bits.*/
-void cwrsi(int _n,int _m,celt_uint32_t _i,int *_x,int *_s){
+void cwrsi(int _n,int _m,celt_uint32_t _i,int * restrict _x,int * restrict _s){
   int j;
   int k;
   VARDECL(celt_uint32_t, nc);
@@ -237,7 +237,7 @@
    with associated sign bits.
   _x:      Returns the combination with elements sorted in ascending order.
   _s:      Returns the associated sign bits.*/
-void cwrsi64(int _n,int _m,celt_uint64_t _i,int *_x,int *_s){
+void cwrsi64(int _n,int _m,celt_uint64_t _i,int * restrict _x,int * restrict _s){
   int j;
   int k;
   VARDECL(celt_uint64_t, nc);
--- a/libcelt/psy.c
+++ b/libcelt/psy.c
@@ -129,7 +129,7 @@
 }
 
 /* Compute a marking threshold from the spectrum X. */
-void compute_masking(const struct PsyDecay *decay, celt_word16_t *X, celt_mask_t *mask, int len)
+void compute_masking(const struct PsyDecay *decay, celt_word16_t *X, celt_mask_t * restrict mask, int len)
 {
    int i;
    int N;
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -42,7 +42,7 @@
 /** Takes the pitch vector and the decoded residual vector (non-compressed), 
    applies the compression in the pitch direction, computes the gain that will
    give ||p+g*y||=1 and mixes the residual with the pitch. */
-static void mix_pitch_and_residual(int *iy, celt_norm_t *X, int N, int K, const celt_norm_t *P)
+static void mix_pitch_and_residual(int * restrict iy, celt_norm_t * restrict X, int N, int K, const celt_norm_t * restrict P)
 {
    int i;
    celt_word32_t Ryp, Ryy, Rpp;
@@ -240,7 +240,7 @@
 #define MAX_INTRA 32
 #define LOG_MAX_INTRA 5
       
-void intra_prediction(celt_norm_t *x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_enc *enc)
+void intra_prediction(celt_norm_t *x, celt_mask_t *W, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int B, int N0, ec_enc *enc)
 {
    int i,j;
    int best=0;
@@ -318,7 +318,7 @@
 
 }
 
-void intra_unquant(celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t *P, int B, int N0, ec_dec *dec)
+void intra_unquant(celt_norm_t *x, int N, int K, celt_norm_t *Y, celt_norm_t * restrict P, int B, int N0, ec_dec *dec)
 {
    int j;
    int sign;
@@ -363,7 +363,7 @@
    }
 }
 
-void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t *P, int B, int N0, int Nmax)
+void intra_fold(celt_norm_t *x, int N, celt_norm_t *Y, celt_norm_t * restrict P, int B, int N0, int Nmax)
 {
    int i, j;
    celt_word32_t E;