Skip to content

Commit 6d221dc

Browse files
committed
Some memory optimizations
1 parent 4df4b56 commit 6d221dc

File tree

2 files changed

+188
-143
lines changed

2 files changed

+188
-143
lines changed

include/private/plugins/matcher.h

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,28 @@ namespace lsp
8181

8282
enum profile_type_t
8383
{
84-
PROF_INPUT, // Profile for the dynamic input audio
85-
PROF_REFERENCE, // Profile for the dynamic reference audio
86-
PROF_STATIC, // Profile for the static input audio
87-
PROF_CAPTURE, // Profile for the static captured audio
88-
PROF_FILE, // Profile for the file
89-
PROF_REF_EQUALIZER, // Profile for the reference equalizer
90-
PROF_MIN_EQUALIZER, // Profile for the minimum equalizer
91-
PROF_MAX_EQUALIZER, // Profile for the maximum equalizer
84+
PROF_MATCH, // Profile for matching curve, SR -> recompute
85+
PROF_INPUT, // Profile for the dynamic input audio, SR -> reset
86+
PROF_REFERENCE, // Profile for the dynamic reference audio, SR -> reset
87+
PROF_STATIC, // Profile for the static input audio, SR -> resample
88+
PROF_CAPTURE, // Profile for the static captured audio, SR -> resample
89+
PROF_FILE, // Profile for the file, SR -> re-render
90+
PROF_REF_EQUALIZER, // Profile for the reference equalizer, SR -> recompute
91+
PROF_MIN_EQUALIZER, // Profile for the minimum equalizer, SR -> recompute
92+
PROF_MAX_EQUALIZER, // Profile for the maximum equalizer, SR -> recompute
9293

9394
PROF_TOTAL
9495
};
9596

97+
enum state_profile_type_t
98+
{
99+
SPROF_STATIC,
100+
SPROF_CAPTURE,
101+
SPROF_FILE,
102+
103+
SPROF_TOTAL
104+
};
105+
96106
enum profile_data_flags_t
97107
{
98108
PFLAGS_NONE = 0,
@@ -114,15 +124,13 @@ namespace lsp
114124

115125
typedef struct profile_data_t
116126
{
117-
uint32_t nOriginRate; // Original sample rate of the profile
118-
uint32_t nActualRate; // Actual sample rate of the profile
119-
uint32_t nOriginRank; // Original FFT rank of the profile
120-
uint32_t nActualRank; // Actual FFT rank of the profile
127+
uint32_t nSampleRate; // Sample rate of the profile
128+
uint32_t nChannels; // Number of channels
129+
uint32_t nRank; // FFT rank of the profile
121130
float fLoudness; // Profile loudness
122131
uint32_t nFlags; // Profile data flags
123132
uint32_t nFrames; // Number of frames collected
124-
float **vOriginData; // Original data (without resampling)
125-
float **vActualData; // Resampled data (matching processing)
133+
float **vData; // Sample data
126134
} profile_data_t;
127135

128136
typedef struct af_descriptor_t
@@ -251,9 +259,9 @@ namespace lsp
251259
match_band_t vMatchBands[meta::matcher::MATCH_BANDS]; // Match bands
252260
ipc::IExecutor *pExecutor; // Task executor
253261
dspu::Sample *pGCList; // Garbage collection list
254-
profile_data_t *pEqProfile; // Actual equalization profile
255262
profile_data_t *pReactivity; // Reactivity profile
256-
lltl::state<profile_data_t> vProfileData[PROF_TOTAL]; // Profile data
263+
profile_data_t *vProfileData[PROF_TOTAL]; // Profile data
264+
lltl::state<profile_data_t> vProfileState[SPROF_TOTAL]; // Record of the input profile
257265

258266
uint16_t *vIndices; // FFT indices
259267
float *vFreqs; // FFT frequencies
@@ -310,7 +318,6 @@ namespace lsp
310318
uint32_t decode_reference_source(size_t ref) const;
311319
uint32_t decode_capture_source(size_t cap, size_t ref) const;
312320
bool check_need_profile_sync();
313-
void output_profile_mesh(float *dst, const profile_data_t *profile, size_t channel, bool envelope);
314321
void record_profile(profile_data_t *profile, float * const * spectrum, size_t channel);
315322
void clear_profile_data(profile_data_t *profile);
316323
status_t load_audio_file(af_descriptor_t *descr);
@@ -325,6 +332,7 @@ namespace lsp
325332
void update_profiles();
326333
void build_eq_profile(profile_data_t *profile, eq_param_t param);
327334
void smooth_eq_curve(float *dst, float x1, float y1, float x2, float y2, size_t count);
335+
void sync_profile(profile_data_t *dst, profile_data_t *src);
328336

329337
public:
330338
explicit matcher(const meta::plugin_t *meta);

0 commit comments

Comments
 (0)