comparison layer/SpectrogramLayer.cpp @ 91:ed01c1261b55

* add a column bitmap to the matrix file object to record which columns are available (optimisation for refreshing during fft creation)
author Chris Cannam
date Mon, 08 May 2006 13:51:16 +0000
parents 7d06e7cf5d5a
children 23d1e37bbfb4
comparison
equal deleted inserted replaced
90:7d06e7cf5d5a 91:ed01c1261b55
31 #include <iostream> 31 #include <iostream>
32 32
33 #include <cassert> 33 #include <cassert>
34 #include <cmath> 34 #include <cmath>
35 35
36 //#define DEBUG_SPECTROGRAM_REPAINT 1 36 #define DEBUG_SPECTROGRAM_REPAINT 1
37 37
38 static double mod(double x, double y) 38 static double mod(double x, double y)
39 { 39 {
40 double a = floor(x / y); 40 double a = floor(x / y);
41 double b = x - (y * a); 41 double b = x - (y * a);
1652 1652
1653 for (int q = q0i; q <= q1i; ++q) { 1653 for (int q = q0i; q <= q1i; ++q) {
1654 for (int s = s0i; s <= s1i; ++s) { 1654 for (int s = s0i; s <= s1i; ++s) {
1655 if (s >= 0 && q >= 0 && s < cw && q < ch) { 1655 if (s >= 0 && q >= 0 && s < cw && q < ch) {
1656 1656
1657 if (!m_cache->haveColumnAt(s)) continue;
1658
1657 float value; 1659 float value;
1658 1660
1659 value = m_cache->getPhaseAt(s, q); 1661 value = m_cache->getPhaseAt(s, q);
1660 if (!have || value < phaseMin) { phaseMin = value; } 1662 if (!have || value < phaseMin) { phaseMin = value; }
1661 if (!have || value > phaseMax) { phaseMax = value; } 1663 if (!have || value > phaseMax) { phaseMax = value; }
1903 continue; 1905 continue;
1904 } else { 1906 } else {
1905 s1i = s0i; 1907 s1i = s0i;
1906 } 1908 }
1907 } 1909 }
1910
1911 bool haveColumn = false;
1912 for (size_t s = s0i; s <= s1i; ++s) {
1913 if (m_cache->haveColumnAt(s)) {
1914 haveColumn = true;
1915 break;
1916 }
1917 }
1918 if (!haveColumn) {
1919 m_mutex.unlock();
1920 continue;
1921 }
1908 1922
1909 for (size_t q = minbin; q < bins; ++q) { 1923 for (size_t q = minbin; q < bins; ++q) {
1910 1924
1911 float f0 = (float(q) * sr) / m_windowSize; 1925 float f0 = (float(q) * sr) / m_windowSize;
1912 float f1 = (float(q + 1) * sr) / m_windowSize; 1926 float f1 = (float(q + 1) * sr) / m_windowSize;