1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-21 07:16:56 +00:00

Add const to libaf/filter.c functions.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27290 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-07-15 19:05:42 +00:00
parent 803385a5d7
commit 7c78c34ace
2 changed files with 17 additions and 17 deletions

View File

@ -25,8 +25,8 @@
w filter taps w filter taps
x input signal must be a circular buffer which is indexed backwards x input signal must be a circular buffer which is indexed backwards
*/ */
inline FLOAT_TYPE af_filter_fir(register unsigned int n, FLOAT_TYPE* w, inline FLOAT_TYPE af_filter_fir(register unsigned int n, const FLOAT_TYPE* w,
FLOAT_TYPE* x) const FLOAT_TYPE* x)
{ {
register FLOAT_TYPE y; // Output register FLOAT_TYPE y; // Output
y = 0.0; y = 0.0;
@ -48,11 +48,11 @@ inline FLOAT_TYPE af_filter_fir(register unsigned int n, FLOAT_TYPE* w,
s output buffer stride s output buffer stride
*/ */
FLOAT_TYPE* af_filter_pfir(unsigned int n, unsigned int d, unsigned int xi, FLOAT_TYPE* af_filter_pfir(unsigned int n, unsigned int d, unsigned int xi,
FLOAT_TYPE** w, FLOAT_TYPE** x, FLOAT_TYPE* y, const FLOAT_TYPE** w, const FLOAT_TYPE** x, FLOAT_TYPE* y,
unsigned int s) unsigned int s)
{ {
register FLOAT_TYPE* xt = *x + xi; register const FLOAT_TYPE* xt = *x + xi;
register FLOAT_TYPE* wt = *w; register const FLOAT_TYPE* wt = *w;
register int nt = 2*n; register int nt = 2*n;
while(d-- > 0){ while(d-- > 0){
*y = af_filter_fir(n,wt,xt); *y = af_filter_fir(n,wt,xt);
@ -69,7 +69,7 @@ FLOAT_TYPE* af_filter_pfir(unsigned int n, unsigned int d, unsigned int xi,
filter. xq must be n*2 by k big, s is the index for in. filter. xq must be n*2 by k big, s is the index for in.
*/ */
int af_filter_updatepq(unsigned int n, unsigned int d, unsigned int xi, int af_filter_updatepq(unsigned int n, unsigned int d, unsigned int xi,
FLOAT_TYPE** xq, FLOAT_TYPE* in, unsigned int s) FLOAT_TYPE** xq, const FLOAT_TYPE* in, unsigned int s)
{ {
register FLOAT_TYPE* txq = *xq + xi; register FLOAT_TYPE* txq = *xq + xi;
register int nt = n*2; register int nt = n*2;
@ -99,7 +99,7 @@ int af_filter_updatepq(unsigned int n, unsigned int d, unsigned int xi,
returns 0 if OK, -1 if fail returns 0 if OK, -1 if fail
*/ */
int af_filter_design_fir(unsigned int n, FLOAT_TYPE* w, FLOAT_TYPE* fc, int af_filter_design_fir(unsigned int n, FLOAT_TYPE* w, const FLOAT_TYPE* fc,
unsigned int flags, FLOAT_TYPE opt) unsigned int flags, FLOAT_TYPE opt)
{ {
unsigned int o = n & 1; // Indicator for odd filter length unsigned int o = n & 1; // Indicator for odd filter length
@ -238,7 +238,7 @@ int af_filter_design_fir(unsigned int n, FLOAT_TYPE* w, FLOAT_TYPE* fc,
returns 0 if OK, -1 if fail returns 0 if OK, -1 if fail
*/ */
int af_filter_design_pfir(unsigned int n, unsigned int k, FLOAT_TYPE* w, int af_filter_design_pfir(unsigned int n, unsigned int k, const FLOAT_TYPE* w,
FLOAT_TYPE** pw, FLOAT_TYPE g, unsigned int flags) FLOAT_TYPE** pw, FLOAT_TYPE g, unsigned int flags)
{ {
int l = (int)n/k; // Length of individual FIR filters int l = (int)n/k; // Length of individual FIR filters
@ -316,7 +316,7 @@ static void af_filter_prewarp(FLOAT_TYPE* a, FLOAT_TYPE fc, FLOAT_TYPE fs)
Return: On return, set coef z-domain coefficients and k to the gain Return: On return, set coef z-domain coefficients and k to the gain
required to maintain overall gain = 1.0; required to maintain overall gain = 1.0;
*/ */
static void af_filter_bilinear(FLOAT_TYPE* a, FLOAT_TYPE* b, FLOAT_TYPE* k, static void af_filter_bilinear(const FLOAT_TYPE* a, const FLOAT_TYPE* b, FLOAT_TYPE* k,
FLOAT_TYPE fs, FLOAT_TYPE *coef) FLOAT_TYPE fs, FLOAT_TYPE *coef)
{ {
FLOAT_TYPE ad, bd; FLOAT_TYPE ad, bd;
@ -417,7 +417,7 @@ static void af_filter_bilinear(FLOAT_TYPE* a, FLOAT_TYPE* b, FLOAT_TYPE* k,
return -1 if fail 0 if success. return -1 if fail 0 if success.
*/ */
int af_filter_szxform(FLOAT_TYPE* a, FLOAT_TYPE* b, FLOAT_TYPE Q, FLOAT_TYPE fc, int af_filter_szxform(const FLOAT_TYPE* a, const FLOAT_TYPE* b, FLOAT_TYPE Q, FLOAT_TYPE fc,
FLOAT_TYPE fs, FLOAT_TYPE *k, FLOAT_TYPE *coef) FLOAT_TYPE fs, FLOAT_TYPE *k, FLOAT_TYPE *coef)
{ {
FLOAT_TYPE at[3]; FLOAT_TYPE at[3];

View File

@ -44,26 +44,26 @@
#define ODD 0x00000010 // Make filter HP #define ODD 0x00000010 // Make filter HP
// Exported functions // Exported functions
extern FLOAT_TYPE af_filter_fir(unsigned int n, FLOAT_TYPE* w, FLOAT_TYPE* x); extern FLOAT_TYPE af_filter_fir(unsigned int n, const FLOAT_TYPE* w, const FLOAT_TYPE* x);
extern FLOAT_TYPE* af_filter_pfir(unsigned int n, unsigned int k, extern FLOAT_TYPE* af_filter_pfir(unsigned int n, unsigned int k,
unsigned int xi, FLOAT_TYPE** w, unsigned int xi, const FLOAT_TYPE** w,
FLOAT_TYPE** x, FLOAT_TYPE* y, const FLOAT_TYPE** x, FLOAT_TYPE* y,
unsigned int s); unsigned int s);
//extern int af_filter_updateq(unsigned int n, unsigned int xi, //extern int af_filter_updateq(unsigned int n, unsigned int xi,
// FLOAT_TYPE* xq, FLOAT_TYPE* in); // FLOAT_TYPE* xq, FLOAT_TYPE* in);
extern int af_filter_updatepq(unsigned int n, unsigned int k, unsigned int xi, extern int af_filter_updatepq(unsigned int n, unsigned int k, unsigned int xi,
FLOAT_TYPE** xq, FLOAT_TYPE* in, unsigned int s); FLOAT_TYPE** xq, const FLOAT_TYPE* in, unsigned int s);
extern int af_filter_design_fir(unsigned int n, FLOAT_TYPE* w, FLOAT_TYPE* fc, extern int af_filter_design_fir(unsigned int n, FLOAT_TYPE* w, const FLOAT_TYPE* fc,
unsigned int flags, FLOAT_TYPE opt); unsigned int flags, FLOAT_TYPE opt);
extern int af_filter_design_pfir(unsigned int n, unsigned int k, FLOAT_TYPE* w, extern int af_filter_design_pfir(unsigned int n, unsigned int k, const FLOAT_TYPE* w,
FLOAT_TYPE** pw, FLOAT_TYPE g, FLOAT_TYPE** pw, FLOAT_TYPE g,
unsigned int flags); unsigned int flags);
extern int af_filter_szxform(FLOAT_TYPE* a, FLOAT_TYPE* b, FLOAT_TYPE Q, extern int af_filter_szxform(const FLOAT_TYPE* a, const FLOAT_TYPE* b, FLOAT_TYPE Q,
FLOAT_TYPE fc, FLOAT_TYPE fs, FLOAT_TYPE *k, FLOAT_TYPE fc, FLOAT_TYPE fs, FLOAT_TYPE *k,
FLOAT_TYPE *coef); FLOAT_TYPE *coef);