comparison vamp-sdk/PluginAdapter.h @ 12:a3d35e11c3fe

* Avoid repeated malloc/free for returned feature lists -- reuse static feature lists where possible. Need to document the host behaviour that permits this (i.e. a returned feature list is only valid until the next call to process, getRemainingFeatures or releaseFeatureSet)
author cannam
date Thu, 06 Apr 2006 15:12:25 +0000
parents 83d3eb580731
children 85801331454c
comparison
equal deleted inserted replaced
11:6616075ec7b6 12:a3d35e11c3fe
82 static VampOutputDescriptor *vampGetOutputDescriptor(VampPluginHandle handle, 82 static VampOutputDescriptor *vampGetOutputDescriptor(VampPluginHandle handle,
83 unsigned int i); 83 unsigned int i);
84 84
85 static void vampReleaseOutputDescriptor(VampOutputDescriptor *desc); 85 static void vampReleaseOutputDescriptor(VampOutputDescriptor *desc);
86 86
87 static VampFeatureList **vampProcess(VampPluginHandle handle, 87 static VampFeatureList *vampProcess(VampPluginHandle handle,
88 float **inputBuffers, 88 float **inputBuffers,
89 int sec, 89 int sec,
90 int nsec); 90 int nsec);
91 91
92 static VampFeatureList **vampGetRemainingFeatures(VampPluginHandle handle); 92 static VampFeatureList *vampGetRemainingFeatures(VampPluginHandle handle);
93 93
94 static void vampReleaseFeatureSet(VampFeatureList **fs); 94 static void vampReleaseFeatureSet(VampFeatureList *fs);
95 95
96 void cleanup(Plugin *plugin); 96 void cleanup(Plugin *plugin);
97 void checkOutputMap(Plugin *plugin); 97 void checkOutputMap(Plugin *plugin);
98 unsigned int getOutputCount(Plugin *plugin); 98 unsigned int getOutputCount(Plugin *plugin);
99 VampOutputDescriptor *getOutputDescriptor(Plugin *plugin, 99 VampOutputDescriptor *getOutputDescriptor(Plugin *plugin,
100 unsigned int i); 100 unsigned int i);
101 VampFeatureList **process(Plugin *plugin, 101 VampFeatureList *process(Plugin *plugin,
102 float **inputBuffers, 102 float **inputBuffers,
103 int sec, int nsec); 103 int sec, int nsec);
104 VampFeatureList **getRemainingFeatures(Plugin *plugin); 104 VampFeatureList *getRemainingFeatures(Plugin *plugin);
105 VampFeatureList **convertFeatures(const Plugin::FeatureSet &features); 105 VampFeatureList *convertFeatures(Plugin *plugin,
106 const Plugin::FeatureSet &features);
106 107
107 typedef std::map<const void *, PluginAdapterBase *> AdapterMap; 108 typedef std::map<const void *, PluginAdapterBase *> AdapterMap;
108 static AdapterMap m_adapterMap; 109 static AdapterMap m_adapterMap;
109 static PluginAdapterBase *lookupAdapter(VampPluginHandle); 110 static PluginAdapterBase *lookupAdapter(VampPluginHandle);
110 111
114 Plugin::ProgramList m_programs; 115 Plugin::ProgramList m_programs;
115 116
116 typedef std::map<Plugin *, Plugin::OutputList *> OutputMap; 117 typedef std::map<Plugin *, Plugin::OutputList *> OutputMap;
117 OutputMap m_pluginOutputs; 118 OutputMap m_pluginOutputs;
118 119
119 typedef std::map<Plugin *, VampFeature ***> FeatureBufferMap; 120 std::map<Plugin *, VampFeatureList *> m_fs;
120 FeatureBufferMap m_pluginFeatures; 121 std::map<Plugin *, std::vector<size_t> > m_fsizes;
122 std::map<Plugin *, std::vector<std::vector<size_t> > > m_fvsizes;
123 void resizeFS(Plugin *plugin, int n);
124 void resizeFL(Plugin *plugin, int n, size_t sz);
125 void resizeFV(Plugin *plugin, int n, int j, size_t sz);
121 }; 126 };
122 127
123 template <typename P> 128 template <typename P>
124 class PluginAdapter : public PluginAdapterBase 129 class PluginAdapter : public PluginAdapterBase
125 { 130 {