comparison src/vamp-hostsdk/PluginSummarisingAdapter.cpp @ 421:35fa4733bc5d

Fix compiler warnings, and fix potential mangling of utf8 when downcasing (this is still a nasty and incomplete way to do it though)
author Chris Cannam
date Thu, 14 Apr 2016 11:49:12 +0100
parents 55de53d7c777
children 7bab0c5422f4
comparison
equal deleted inserted replaced
420:99868cd95acb 421:35fa4733bc5d
364 if (continuous) result = summary.variance_c; 364 if (continuous) result = summary.variance_c;
365 else result = summary.variance; 365 else result = summary.variance;
366 break; 366 break;
367 367
368 case StandardDeviation: 368 case StandardDeviation:
369 if (continuous) result = sqrtf(summary.variance_c); 369 if (continuous) result = sqrt(summary.variance_c);
370 else result = sqrtf(summary.variance); 370 else result = sqrt(summary.variance);
371 break; 371 break;
372 372
373 case Count: 373 case Count:
374 result = summary.count; 374 result = summary.count;
375 break; 375 break;
379 379
380 default: 380 default:
381 break; 381 break;
382 } 382 }
383 383
384 f.values.push_back(result); 384 f.values.push_back(float(result));
385 } 385 }
386 386
387 fl.push_back(f); 387 fl.push_back(f);
388 } 388 }
389 return fl; 389 return fl;
554 Result result; 554 Result result;
555 result.time = timestamp; 555 result.time = timestamp;
556 result.duration = INVALID_DURATION; 556 result.duration = INVALID_DURATION;
557 557
558 if (int(f.values.size()) > m_accumulators[output].bins) { 558 if (int(f.values.size()) > m_accumulators[output].bins) {
559 m_accumulators[output].bins = f.values.size(); 559 m_accumulators[output].bins = int(f.values.size());
560 } 560 }
561 561
562 for (int i = 0; i < int(f.values.size()); ++i) { 562 for (int i = 0; i < int(f.values.size()); ++i) {
563 result.values.push_back(f.values[i]); 563 result.values.push_back(f.values[i]);
564 } 564 }
572 for (OutputTimestampMap::iterator i = m_prevTimestamps.begin(); 572 for (OutputTimestampMap::iterator i = m_prevTimestamps.begin();
573 i != m_prevTimestamps.end(); ++i) { 573 i != m_prevTimestamps.end(); ++i) {
574 574
575 int output = i->first; 575 int output = i->first;
576 576
577 int acount = m_accumulators[output].results.size(); 577 int acount = int(m_accumulators[output].results.size());
578 578
579 if (acount == 0) continue; 579 if (acount == 0) continue;
580 580
581 #ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER 581 #ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER
582 cerr << "output " << output << ": "; 582 cerr << "output " << output << ": ";
758 j != segments.end(); ++j) { 758 j != segments.end(); ++j) {
759 759
760 RealTime segmentStart = j->first; 760 RealTime segmentStart = j->first;
761 OutputAccumulator &accumulator = j->second; 761 OutputAccumulator &accumulator = j->second;
762 762
763 int sz = accumulator.results.size(); 763 int sz = int(accumulator.results.size());
764 764
765 #ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER 765 #ifdef DEBUG_PLUGIN_SUMMARISING_ADAPTER
766 cerr << "reduce: segment starting at " << segmentStart 766 cerr << "reduce: segment starting at " << segmentStart
767 << " on output " << output << " has " << sz << " result(s)" << endl; 767 << " on output " << output << " has " << sz << " result(s)" << endl;
768 #endif 768 #endif
817 } 817 }
818 } 818 }
819 819
820 for (int k = 0; k < sz; ++k) { 820 for (int k = 0; k < sz; ++k) {
821 float value = accumulator.results[k].values[bin]; 821 float value = accumulator.results[k].values[bin];
822 valvec.push_back(ValueDurationFloatPair 822 valvec.push_back
823 (value, 823 (ValueDurationFloatPair
824 toSec(accumulator.results[k].duration))); 824 (value,
825 float(toSec(accumulator.results[k].duration))));
825 } 826 }
826 827
827 sort(valvec.begin(), valvec.end()); 828 sort(valvec.begin(), valvec.end());
828 829
829 summary.minimum = valvec[0].value; 830 summary.minimum = valvec[0].value;