chunk data before analysis, prefer 8K

* consistent spectrum display for all reports (same binsize)
* improved performance (power of two)
This commit is contained in:
Robin Gareus
2016-02-16 14:25:49 +01:00
parent c52854fd3d
commit a664fb703e
2 changed files with 6 additions and 1 deletions

View File

@@ -127,6 +127,7 @@ class LIBARDOUR_API ExportGraphBuilder
void set_peak (float);
private:
typedef boost::shared_ptr<AudioGrapher::Chunker<float> > ChunkerPtr;
typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<Sample> > FloatConverterPtr;
typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<int> > IntConverterPtr;
typedef boost::shared_ptr<AudioGrapher::SampleFormatConverter<short> > ShortConverterPtr;
@@ -135,6 +136,7 @@ class LIBARDOUR_API ExportGraphBuilder
boost::ptr_list<Encoder> children;
int data_width;
ChunkerPtr chunker;
AnalysisPtr analyser;
bool _analyse;
// Only one of these should be available at a time

View File

@@ -311,8 +311,11 @@ ExportGraphBuilder::SFC::SFC (ExportGraphBuilder &parent, FileSpec const & new_c
framecnt_t sb = config.format->silence_beginning_at (parent.timespan->get_start(), sample_rate);
framecnt_t se = config.format->silence_end_at (parent.timespan->get_end(), sample_rate);
framecnt_t duration = parent.timespan->get_length () + sb + se;
max_frames = min ((framecnt_t) 8192 * channels, max ((framecnt_t) 4096 * channels, max_frames));
chunker.reset (new Chunker<Sample> (max_frames));
analyser.reset (new Analyser (config.format->sample_rate(), channels, max_frames,
(framecnt_t) ceil (duration * config.format->sample_rate () / sample_rate)));
chunker->add_output (analyser);
parent.add_analyser (config.filename->get_path (config.format), analyser);
}
@@ -348,7 +351,7 @@ ExportGraphBuilder::FloatSinkPtr
ExportGraphBuilder::SFC::sink ()
{
if (_analyse) {
return analyser;
return chunker;
} else if (data_width == 8 || data_width == 16) {
return short_converter;
} else if (data_width == 24 || data_width == 32) {