From d54d26e822661e76a56fe7d8bb371f1b3944e066 Mon Sep 17 00:00:00 2001 From: Sakari Bergen Date: Sun, 24 Jun 2012 19:45:20 +0000 Subject: Inrease the export "chunk size" to speed it up over 10% at least in some situations git-svn-id: svn://localhost/ardour2/branches/3.0@12919 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ardour/export_graph_builder.h | 5 ++++- libs/ardour/export_graph_builder.cc | 15 ++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libs/ardour/ardour/export_graph_builder.h b/libs/ardour/ardour/export_graph_builder.h index f565fd4134..07e866475a 100644 --- a/libs/ardour/ardour/export_graph_builder.h +++ b/libs/ardour/ardour/export_graph_builder.h @@ -32,6 +32,7 @@ namespace AudioGrapher { class SampleRateConverter; class PeakReader; class Normalizer; + template class Chunker; template class SampleFormatConverter; template class Interleaver; template class SndfileWriter; @@ -209,12 +210,14 @@ class ExportGraphBuilder private: typedef boost::shared_ptr > InterleaverPtr; + typedef boost::shared_ptr > ChunkerPtr; ExportGraphBuilder & parent; FileSpec config; boost::ptr_list children; InterleaverPtr interleaver; - framecnt_t max_frames; + ChunkerPtr chunker; + framecnt_t max_frames_out; }; Session const & session; diff --git a/libs/ardour/export_graph_builder.cc b/libs/ardour/export_graph_builder.cc index 5061bcecfd..2be9044415 100644 --- a/libs/ardour/export_graph_builder.cc +++ b/libs/ardour/export_graph_builder.cc @@ -1,6 +1,7 @@ #include "ardour/export_graph_builder.h" #include "audiographer/process_context.h" +#include "audiographer/general/chunker.h" #include "audiographer/general/interleaver.h" #include "audiographer/general/normalizer.h" #include "audiographer/general/peak_reader.h" @@ -474,11 +475,18 @@ ExportGraphBuilder::ChannelConfig::ChannelConfig (ExportGraphBuilder & parent, F typedef ExportChannelConfiguration::ChannelList ChannelList; config = new_config; - max_frames = parent.session.engine().frames_per_cycle(); + framecnt_t max_frames = parent.session.engine().frames_per_cycle(); interleaver.reset (new Interleaver ()); interleaver->init (new_config.channel_config->get_n_chans(), max_frames); + // Make the chunk size divisible by the channel count + int chan_count = new_config.channel_config->get_n_chans(); + max_frames_out = 8192; + max_frames_out -= max_frames_out % chan_count; + chunker.reset (new Chunker (max_frames_out)); + interleaver->add_output(chunker); + ChannelList const & channel_list = config.channel_config->get_channels(); unsigned chan = 0; for (ChannelList::const_iterator it = channel_list.begin(); it != channel_list.end(); ++it, ++chan) { @@ -498,6 +506,8 @@ ExportGraphBuilder::ChannelConfig::ChannelConfig (ExportGraphBuilder & parent, F void ExportGraphBuilder::ChannelConfig::add_child (FileSpec const & new_config) { + assert (*this == new_config); + for (boost::ptr_list::iterator it = children.begin(); it != children.end(); ++it) { if (*it == new_config) { it->add_child (new_config); @@ -505,9 +515,8 @@ ExportGraphBuilder::ChannelConfig::add_child (FileSpec const & new_config) } } - framecnt_t const max_frames_out = new_config.channel_config->get_n_chans() * max_frames; children.push_back (new SilenceHandler (parent, new_config, max_frames_out)); - interleaver->add_output (children.back().sink ()); + chunker->add_output (children.back().sink ()); } bool -- cgit v1.2.3