Mercurial > hg > qm-vamp-plugins
comparison plugins/AdaptiveSpectrogram.cpp @ 113:d0920575b48a
* pass allocator through to sub-cuts (duh)
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 20 May 2009 08:52:11 +0000 |
parents | 2e25bdc9f826 |
children | 496e6d6eb413 |
comparison
equal
deleted
inserted
replaced
112:2e25bdc9f826 | 113:d0920575b48a |
---|---|
317 void | 317 void |
318 AdaptiveSpectrogram::getSubCuts(const Spectrograms &s, | 318 AdaptiveSpectrogram::getSubCuts(const Spectrograms &s, |
319 int res, | 319 int res, |
320 int x, int y, int h, | 320 int x, int y, int h, |
321 Cutting *&top, Cutting *&bottom, | 321 Cutting *&top, Cutting *&bottom, |
322 Cutting *&left, Cutting *&right) const | 322 Cutting *&left, Cutting *&right, |
323 BlockAllocator *allocator) const | |
323 { | 324 { |
324 if (m_threaded && !m_threadsInUse) { | 325 if (m_threaded && !m_threadsInUse) { |
325 | 326 |
326 m_threadsInUse = true; | 327 m_threadsInUse = true; |
327 | 328 |
352 | 353 |
353 // The "vertical" division is a top/bottom split. | 354 // The "vertical" division is a top/bottom split. |
354 // Splitting this way keeps us in the same resolution, | 355 // Splitting this way keeps us in the same resolution, |
355 // but with two vertical subregions of height h/2. | 356 // but with two vertical subregions of height h/2. |
356 | 357 |
357 top = cut(s, res, x, y + h/2, h/2, 0); | 358 top = cut(s, res, x, y + h/2, h/2, allocator); |
358 bottom = cut(s, res, x, y, h/2, 0); | 359 bottom = cut(s, res, x, y, h/2, allocator); |
359 | 360 |
360 // The "horizontal" division is a left/right split. Splitting | 361 // The "horizontal" division is a left/right split. Splitting |
361 // this way places us in resolution res/2, which has lower | 362 // this way places us in resolution res/2, which has lower |
362 // vertical resolution but higher horizontal resolution. We | 363 // vertical resolution but higher horizontal resolution. We |
363 // need to double x accordingly. | 364 // need to double x accordingly. |
364 | 365 |
365 left = cut(s, res/2, 2 * x, y/2, h/2, 0); | 366 left = cut(s, res/2, 2 * x, y/2, h/2, allocator); |
366 right = cut(s, res/2, 2 * x + 1, y/2, h/2, 0); | 367 right = cut(s, res/2, 2 * x + 1, y/2, h/2, allocator); |
367 } | 368 } |
368 } | 369 } |
369 | 370 |
370 AdaptiveSpectrogram::Cutting * | 371 AdaptiveSpectrogram::Cutting * |
371 AdaptiveSpectrogram::cut(const Spectrograms &s, | 372 AdaptiveSpectrogram::cut(const Spectrograms &s, |
385 } | 386 } |
386 | 387 |
387 if (h > 1 && res > s.minres) { | 388 if (h > 1 && res > s.minres) { |
388 | 389 |
389 Cutting *top = 0, *bottom = 0, *left = 0, *right = 0; | 390 Cutting *top = 0, *bottom = 0, *left = 0, *right = 0; |
390 getSubCuts(s, res, x, y, h, top, bottom, left, right); | 391 getSubCuts(s, res, x, y, h, top, bottom, left, right, allocator); |
391 | 392 |
392 double vcost = top->cost + bottom->cost; | 393 double vcost = top->cost + bottom->cost; |
393 double hcost = left->cost + right->cost; | 394 double hcost = left->cost + right->cost; |
394 | 395 |
395 bool normalize = true; | 396 bool normalize = true; |