TMS5xxx: Fix for occasional audio 'spike' instability/wraparound glitches caused by improper truncation in the lattice filter multiplier. This is not an optimal fix as it isn't correct to hardware, but it works better than the previous approximation. [Lord Nightmare]

This commit is contained in:
Lord-Nightmare 2015-11-02 17:26:34 -05:00
parent 2323a3c851
commit 70b81eb7c8
2 changed files with 2 additions and 2 deletions

View File

@ -676,7 +676,7 @@ static INT32 matrix_multiply(INT32 a, INT32 b)
while (a<-512) { a+=1024; }
while (b>16383) { b-=32768; }
while (b<-16384) { b+=32768; }
result = ((a*b)>>9)|1;//&(~1);
result = ((a*b)>>9); /** TODO: this isn't technically right to the chip, which truncates the lowest result bit, but it causes glitches otherwise. **/
#ifdef VERBOSE
if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result);
if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result);

View File

@ -1079,7 +1079,7 @@ static INT32 matrix_multiply(INT32 a, INT32 b)
while (a<-512) { a+=1024; }
while (b>16383) { b-=32768; }
while (b<-16384) { b+=32768; }
result = ((a*b)>>9)|1;//&(~1);
result = ((a*b)>>9); /** TODO: this isn't technically right to the chip, which truncates the lowest result bit, but it causes glitches otherwise. **/
#ifdef VERBOSE
if (result>16383) fprintf(stderr,"matrix multiplier overflowed! a: %x, b: %x, result: %x", a, b, result);
if (result<-16384) fprintf(stderr,"matrix multiplier underflowed! a: %x, b: %x, result: %x", a, b, result);