cmProc4.h/c: Fixed bug in cmGoertzel where ch->s1 and ch->s2 were swapped.

This commit is contained in:
kevin 2013-11-24 12:14:22 -05:00
parent ab1161d138
commit d011e83cd9
2 changed files with 4 additions and 3 deletions

View File

@ -4559,8 +4559,8 @@ cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* x, unsigned procSmpCnt,
{ {
cmGoertzelCh* ch = p->ch + i; cmGoertzelCh* ch = p->ch + i;
ch->s1 = x[0]; ch->s2 = x[0];
ch->s2 = x[1] + 2 * x[0] * ch->coeff; ch->s1 = x[1] + 2 * x[0] * ch->coeff;
for(j=2; j<procSmpCnt; ++j) for(j=2; j<procSmpCnt; ++j)
{ {
ch->s0 = x[j] + ch->coeff * ch->s1 - ch->s2; ch->s0 = x[j] + ch->coeff * ch->s1 - ch->s2;
@ -4573,3 +4573,5 @@ cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* x, unsigned procSmpCnt,
return cmOkRC; return cmOkRC;
} }

View File

@ -723,7 +723,6 @@ extern "C" {
cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* in, unsigned procSmpCnt, double* outV, unsigned chCnt ); cmRC_t cmGoertzelExec( cmGoertzel* p, const cmSample_t* in, unsigned procSmpCnt, double* outV, unsigned chCnt );
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif