projects
/
dcpomatic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d44e39b
)
Another small analysis optimisation, and (I think) a bug fix to peak location.
author
Carl Hetherington
<cth@carlh.net>
Wed, 26 Aug 2015 22:23:08 +0000
(23:23 +0100)
committer
Carl Hetherington
<cth@carlh.net>
Wed, 26 Aug 2015 22:23:08 +0000
(23:23 +0100)
src/lib/analyse_audio_job.cc
patch
|
blob
|
history
diff --git
a/src/lib/analyse_audio_job.cc
b/src/lib/analyse_audio_job.cc
index 164c57b14ab9eef984e71f59886d560e12f962ff..b45af646d24f664a371711470157c04ca9c56e95 100644
(file)
--- a/
src/lib/analyse_audio_job.cc
+++ b/
src/lib/analyse_audio_job.cc
@@
-119,9
+119,10
@@
AnalyseAudioJob::analyse (shared_ptr<const AudioBuffers> b)
int const frames = b->frames ();
int const channels = b->channels ();
int const frames = b->frames ();
int const channels = b->channels ();
- for (int i = 0; i < frames; ++i) {
- for (int j = 0; j < channels; ++j) {
- float s = b->data(j)[i];
+ for (int j = 0; j < channels; ++j) {
+ float* data = b->data(j);
+ for (int i = 0; i < frames; ++i) {
+ float s = data[i];
float as = fabsf (s);
if (as < 10e-7) {
/* SafeStringStream can't serialise and recover inf or -inf, so prevent such
float as = fabsf (s);
if (as < 10e-7) {
/* SafeStringStream can't serialise and recover inf or -inf, so prevent such
@@
-136,13
+137,13
@@
AnalyseAudioJob::analyse (shared_ptr<const AudioBuffers> b)
_overall_peak_frame = _done + i;
}
_overall_peak_frame = _done + i;
}
- if ((
_done
% _samples_per_point) == 0) {
+ if ((
(_done + i)
% _samples_per_point) == 0) {
_current[j][AudioPoint::RMS] = sqrt (_current[j][AudioPoint::RMS] / _samples_per_point);
_analysis->add_point (j, _current[j]);
_current[j] = AudioPoint ();
}
}
_current[j][AudioPoint::RMS] = sqrt (_current[j][AudioPoint::RMS] / _samples_per_point);
_analysis->add_point (j, _current[j]);
_current[j] = AudioPoint ();
}
}
-
- ++_done;
}
}
+
+ _done += frames;
}
}