comparison libaf/af_hrtf.c @ 28057:e29d1b1afdc7

Add const to avoid warnings about discarded qualifiers.
author reimar
date Fri, 05 Dec 2008 14:21:22 +0000
parents b2402b4f0afa
children 72d0b1444141
comparison
equal deleted inserted replaced
28056:92d1e627d2c7 28057:e29d1b1afdc7
18 typedef struct af_hrtf_s { 18 typedef struct af_hrtf_s {
19 /* Lengths */ 19 /* Lengths */
20 int dlbuflen, hrflen, basslen; 20 int dlbuflen, hrflen, basslen;
21 /* L, C, R, Ls, Rs channels */ 21 /* L, C, R, Ls, Rs channels */
22 float *lf, *rf, *lr, *rr, *cf, *cr; 22 float *lf, *rf, *lr, *rr, *cf, *cr;
23 float *cf_ir, *af_ir, *of_ir, *ar_ir, *or_ir, *cr_ir; 23 const float *cf_ir, *af_ir, *of_ir, *ar_ir, *or_ir, *cr_ir;
24 int cf_o, af_o, of_o, ar_o, or_o, cr_o; 24 int cf_o, af_o, of_o, ar_o, or_o, cr_o;
25 /* Bass */ 25 /* Bass */
26 float *ba_l, *ba_r; 26 float *ba_l, *ba_r;
27 float *ba_ir; 27 float *ba_ir;
28 /* Whether to matrix decode the rear center channel */ 28 /* Whether to matrix decode the rear center channel */
57 * nk: length of the convolution kernel 57 * nk: length of the convolution kernel
58 * sx: ring buffer 58 * sx: ring buffer
59 * sk: convolution kernel 59 * sk: convolution kernel
60 * offset: offset on the ring buffer, can be 60 * offset: offset on the ring buffer, can be
61 */ 61 */
62 static float conv(const int nx, const int nk, float *sx, float *sk, 62 static float conv(const int nx, const int nk, const float *sx, const float *sk,
63 const int offset) 63 const int offset)
64 { 64 {
65 /* k = reminder of offset / nx */ 65 /* k = reminder of offset / nx */
66 int k = offset >= 0 ? offset % nx : nx + (offset % nx); 66 int k = offset >= 0 ? offset % nx : nx + (offset % nx);
67 67
71 return af_filter_fir(nk + k - nx, sx, sk + nx - k) + 71 return af_filter_fir(nk + k - nx, sx, sk + nx - k) +
72 af_filter_fir(nx - k, sx + k, sk); 72 af_filter_fir(nx - k, sx + k, sk);
73 } 73 }
74 74
75 /* Detect when the impulse response starts (significantly) */ 75 /* Detect when the impulse response starts (significantly) */
76 static int pulse_detect(float *sx) 76 static int pulse_detect(const float *sx)
77 { 77 {
78 /* nmax must be the reference impulse response length (128) minus 78 /* nmax must be the reference impulse response length (128) minus
79 s->hrflen */ 79 s->hrflen */
80 const int nmax = 128 - HRTFFILTLEN; 80 const int nmax = 128 - HRTFFILTLEN;
81 const float thresh = IRTHRESH; 81 const float thresh = IRTHRESH;