Added OpenMP support on audio spectrum generation, and updated portuguese translation a little bit.
Originally committed to SVN as r1734.
This commit is contained in:
parent
a3c8e61f16
commit
e271b979b2
4 changed files with 2416 additions and 2038 deletions
|
@ -39,6 +39,9 @@
|
|||
#include <list>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
#include "audio_spectrum.h"
|
||||
#include "fft.h"
|
||||
#include "colorspace.h"
|
||||
|
@ -155,11 +158,11 @@ public:
|
|||
unsigned int overlap_offset = line_length / overlaps * 2; // FIXME: the result seems weird/wrong without this factor 2, but why?
|
||||
|
||||
// Raw sample data
|
||||
short *raw_sample_data = new short[line_length*2];
|
||||
float *sample_data = new float[line_length*2];
|
||||
short *raw_sample_data = NULL;
|
||||
float *sample_data = NULL;
|
||||
// Real and imaginary components of the output
|
||||
float *out_r = new float[line_length*2];
|
||||
float *out_i = new float[line_length*2];
|
||||
float *out_r = NULL;
|
||||
float *out_i = NULL;
|
||||
|
||||
FFT fft; // Use FFTW instead? A wavelet?
|
||||
|
||||
|
@ -170,7 +173,23 @@ public:
|
|||
// a frequenmcy/power spectrum.
|
||||
int64_t sample = start * line_length*2 + overlap*overlap_offset;
|
||||
|
||||
for (unsigned long i = 0; i < length; ++i) {
|
||||
long len = length;
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel shared(overlap,len,line_length)
|
||||
#endif
|
||||
{
|
||||
short *raw_sample_data = new short[line_length*2];
|
||||
float *sample_data = new float[line_length*2];
|
||||
float *out_r = new float[line_length*2];
|
||||
float *out_i = new float[line_length*2];
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp for
|
||||
#endif
|
||||
for (long i = 0; i < len; ++i) {
|
||||
// Initialize
|
||||
sample = start * line_length*2 + overlap*overlap_offset + i*line_length*2;
|
||||
|
||||
provider->GetAudio(raw_sample_data, sample, line_length*2);
|
||||
for (size_t j = 0; j < line_length; ++j) {
|
||||
sample_data[j*2] = (float)raw_sample_data[j*2];
|
||||
|
@ -184,8 +203,7 @@ public:
|
|||
line[j] = sqrt(out_r[j]*out_r[j] + out_i[j]*out_i[j]);
|
||||
}
|
||||
|
||||
sample += line_length*2;
|
||||
}
|
||||
//sample += line_length*2;
|
||||
}
|
||||
|
||||
delete[] raw_sample_data;
|
||||
|
@ -193,6 +211,8 @@ public:
|
|||
delete[] out_r;
|
||||
delete[] out_i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~FinalSpectrumCache()
|
||||
{
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
OpenMP="true"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdwx.h"
|
||||
WarningLevel="3"
|
||||
|
@ -127,6 +128,7 @@
|
|||
AdditionalIncludeDirectories="../../aegisub/win32;../../hunspell/src"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="2"
|
||||
OpenMP="true"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="stdwx.h"
|
||||
WarningLevel="3"
|
||||
|
|
BIN
po/pt_BR.mo
BIN
po/pt_BR.mo
Binary file not shown.
4388
po/pt_BR.po
4388
po/pt_BR.po
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue