Has anyone taken a close look to the three spreading functions
in Lame? For me it looks like they are buggy, but correct me
if I'm wrong.
Here is how I would patch them.
Robert
*** lame3.34/psymodel.c Tue Oct 12 23:14:57 1999
--- lame3.34.w2/psymodel.c Mon Oct 18 21:27:27 1999
***************
*** 328,336 ****
* Now compute the spreading function, s[j][i], the value of the spread-*
* ing function, centered at band j, for band i, store for later use *
************************************************************************/
! for(j=0;j<CBANDS;j++){
! for(i=0;i<CBANDS;i++){
! temp1 = (cbval[i] - cbval[j])*1.05;
if(temp1>=0.5 && temp1<=2.5){
temp2 = temp1 - 0.5;
temp2 = 8.0 * (temp2*(temp2 - 2.0));
--- 328,337 ----
* Now compute the spreading function, s[j][i], the value of the spread-*
* ing function, centered at band j, for band i, store for later use *
************************************************************************/
! for(i=0;i<CBANDS;i++){
! for(j=0;j<CBANDS;j++){
! if(j!=i) temp1 = (cbval[i] - cbval[j])/.33;
! else temp1 = (cbval[i] - cbval[j])/.66;
if(temp1>=0.5 && temp1<=2.5){
temp2 = temp1 - 0.5;
temp2 = 8.0 * (temp2*(temp2 - 2.0));
***************
*** 338,344 ****
else temp2 = 0;
temp1 += 0.474;
temp3 = 15.811389+7.5*temp1-17.5*sqrt((double) (1.0+temp1*temp1));
! if(temp3 <= -100) s[i][j] = 0;
else {
temp3 = (temp2 + temp3)*LN_TO_LOG10;
s[i][j] = exp(temp3);
--- 339,345 ----
else temp2 = 0;
temp1 += 0.474;
temp3 = 15.811389+7.5*temp1-17.5*sqrt((double) (1.0+temp1*temp1));
! if(temp3 <= -60) s[i][j] = 0;
else {
temp3 = (temp2 + temp3)*LN_TO_LOG10;
s[i][j] = exp(temp3);
***************
*** 1032,1039 ****
for(j=0;j<part_max;j++)
{
// tempx = (bval_l[i] - bval_l[j])*1.05;
! if (j>=i) tempx = (bval_l[i] - bval_l[j])*3.0;
! else tempx = (bval_l[i] - bval_l[j])*1.5;
/* if (j>=i) tempx = (bval_l[j] - bval_l[i])*3.0;
else tempx = (bval_l[j] - bval_l[i])*1.5; */
if(tempx>=0.5 && tempx<=2.5)
--- 1033,1040 ----
for(j=0;j<part_max;j++)
{
// tempx = (bval_l[i] - bval_l[j])*1.05;
! if (j!=i) tempx = (bval_l[j] - bval_l[i])/.33;
! else tempx = (bval_l[j] - bval_l[i])/.66;
/* if (j>=i) tempx = (bval_l[j] - bval_l[i])*3.0;
else tempx = (bval_l[j] - bval_l[i])*1.5; */
if(tempx>=0.5 && tempx<=2.5)
***************
*** 1092,1099 ****
for(j=0;j<part_max;j++)
{
// tempx = (bval_s[i] - bval_s[j])*1.05;
! if (j>=i) tempx = (bval_s[i] - bval_s[j])*3.0;
! else tempx = (bval_s[i] - bval_s[j])*1.5;
if(tempx>=0.5 && tempx<=2.5)
{
temp = tempx - 0.5;
--- 1093,1100 ----
for(j=0;j<part_max;j++)
{
// tempx = (bval_s[i] - bval_s[j])*1.05;
! if (j!=i) tempx = (bval_s[j] - bval_s[i])/.33;
! else tempx = (bval_s[j] - bval_s[i])/.66;
if(tempx>=0.5 && tempx<=2.5)
{
temp = tempx - 0.5;
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )