Mercurial > hg > nnls-chroma
comparison NNLSChroma.cpp @ 91:b56dde3417d4 matthiasm-plugin
* Fix the "comparison between signed and unsigned" warnings; remove some ifdef'd-out old code
author | Chris Cannam |
---|---|
date | Thu, 02 Dec 2010 13:05:23 +0000 |
parents | 7af5312e66f8 |
children | d1398182a072 |
comparison
equal
deleted
inserted
replaced
90:b095d83585c9 | 91:b56dde3417d4 |
---|---|
406 int indx[84+1000]; | 406 int indx[84+1000]; |
407 int mode; | 407 int mode; |
408 int dictsize = nNote*signifIndex.size(); | 408 int dictsize = nNote*signifIndex.size(); |
409 // cerr << "dictsize is " << dictsize << "and values size" << f3.values.size()<< endl; | 409 // cerr << "dictsize is " << dictsize << "and values size" << f3.values.size()<< endl; |
410 float *curr_dict = new float[dictsize]; | 410 float *curr_dict = new float[dictsize]; |
411 for (unsigned iNote = 0; iNote < signifIndex.size(); ++iNote) { | 411 for (int iNote = 0; iNote < (int)signifIndex.size(); ++iNote) { |
412 for (unsigned iBin = 0; iBin < nNote; iBin++) { | 412 for (int iBin = 0; iBin < nNote; iBin++) { |
413 curr_dict[iNote * nNote + iBin] = 1.0 * m_dict[signifIndex[iNote] * nNote + iBin]; | 413 curr_dict[iNote * nNote + iBin] = 1.0 * m_dict[signifIndex[iNote] * nNote + iBin]; |
414 } | 414 } |
415 } | 415 } |
416 nnls(curr_dict, nNote, nNote, signifIndex.size(), b, x, &rnorm, w, zz, indx, &mode); | 416 nnls(curr_dict, nNote, nNote, signifIndex.size(), b, x, &rnorm, w, zz, indx, &mode); |
417 delete [] curr_dict; | 417 delete [] curr_dict; |
418 for (unsigned iNote = 0; iNote < signifIndex.size(); ++iNote) { | 418 for (int iNote = 0; iNote < (int)signifIndex.size(); ++iNote) { |
419 f3.values[signifIndex[iNote]] = x[iNote]; | 419 f3.values[signifIndex[iNote]] = x[iNote]; |
420 // cerr << mode << endl; | 420 // cerr << mode << endl; |
421 chroma[signifIndex[iNote] % 12] += x[iNote] * treblewindow[signifIndex[iNote]]; | 421 chroma[signifIndex[iNote] % 12] += x[iNote] * treblewindow[signifIndex[iNote]]; |
422 basschroma[signifIndex[iNote] % 12] += x[iNote] * basswindow[signifIndex[iNote]]; | 422 basschroma[signifIndex[iNote] % 12] += x[iNote] * basswindow[signifIndex[iNote]]; |
423 } | 423 } |
479 } | 479 } |
480 chromanorm[2] = sqrt(chromanorm[2]); | 480 chromanorm[2] = sqrt(chromanorm[2]); |
481 break; | 481 break; |
482 } | 482 } |
483 if (chromanorm[0] > 0) { | 483 if (chromanorm[0] > 0) { |
484 for (int i = 0; i < f4.values.size(); i++) { | 484 for (size_t i = 0; i < f4.values.size(); i++) { |
485 f4.values[i] /= chromanorm[0]; | 485 f4.values[i] /= chromanorm[0]; |
486 } | 486 } |
487 } | 487 } |
488 if (chromanorm[1] > 0) { | 488 if (chromanorm[1] > 0) { |
489 for (int i = 0; i < f5.values.size(); i++) { | 489 for (size_t i = 0; i < f5.values.size(); i++) { |
490 f5.values[i] /= chromanorm[1]; | 490 f5.values[i] /= chromanorm[1]; |
491 } | 491 } |
492 } | 492 } |
493 if (chromanorm[2] > 0) { | 493 if (chromanorm[2] > 0) { |
494 for (int i = 0; i < f6.values.size(); i++) { | 494 for (size_t i = 0; i < f6.values.size(); i++) { |
495 f6.values[i] /= chromanorm[2]; | 495 f6.values[i] /= chromanorm[2]; |
496 } | 496 } |
497 } | 497 } |
498 } | 498 } |
499 | 499 |