Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorvald Natvig <slicer@users.sourceforge.net>2008-03-01 19:57:14 +0300
committerThorvald Natvig <slicer@users.sourceforge.net>2008-03-01 19:57:14 +0300
commitd6ef7b8c5109fbb51c0abef7eeaf62e70a657825 (patch)
tree82537d44de7696b1bb2dd2e1ff838002b68104d8 /speexbuild
parent8b5507d8c1a82a1dea63a5cd5d62e334a92f910f (diff)
Compile Win32 with Visual Studio + Intel C Compiler
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@958 05730e5d-ab1b-0410-a4ac-84af385074fa
Diffstat (limited to 'speexbuild')
-rw-r--r--speexbuild/SpeexMark.cpp75
-rw-r--r--speexbuild/SpeexMark.pro8
-rw-r--r--speexbuild/speexbuild.pro12
3 files changed, 63 insertions, 32 deletions
diff --git a/speexbuild/SpeexMark.cpp b/speexbuild/SpeexMark.cpp
index c913487ec..173970bcc 100644
--- a/speexbuild/SpeexMark.cpp
+++ b/speexbuild/SpeexMark.cpp
@@ -1,73 +1,88 @@
+
#include <QtCore>
-#include <math.h>
+
+#ifdef Q_OS_WIN
+#define _WIN32_IE 0x0600
+#include <windows.h>
+#include <shellapi.h>
+#else
+#define VALGRIND
+#endif
+
+#include <math.h>
#include <speex/speex.h>
#include <speex/speex_jitter.h>
#include <speex/speex_preprocess.h>
#include <speex/speex_echo.h>
#include <speex/speex_callbacks.h>
-#include <valgrind/callgrind.h>
+
+#ifdef VALGRIND
+#include <valgrind/callgrind.h>
+#endif
#include "Timer.h"
int main(int argc, char **argv) {
+#ifdef VALGRIND
CALLGRIND_STOP_INSTRUMENTATION;
CALLGRIND_ZERO_STATS;
-
+#endif
+
QCoreApplication a(argc, argv);
-
+
QFile f((argc >= 2) ? argv[1] : "wb_male.wav");
if (! f.open(QIODevice::ReadOnly)) {
qFatal("Failed to open file!");
}
f.seek(36 + 8);
-
+
void *enc = speex_encoder_init(&speex_wb_mode);
-
+
int iarg = 1;
speex_encoder_ctl(enc, SPEEX_SET_VBR, &iarg);
iarg = 0;
speex_encoder_ctl(enc, SPEEX_SET_VAD, &iarg);
speex_encoder_ctl(enc, SPEEX_SET_DTX, &iarg);
-
+
float farg = 6.0;
speex_encoder_ctl(enc, SPEEX_SET_VBR_QUALITY, &farg);
speex_encoder_ctl(enc, SPEEX_GET_BITRATE, &iarg);
speex_encoder_ctl(enc, SPEEX_SET_VBR_MAX_BITRATE, &iarg);
-
+
iarg = 4;
speex_encoder_ctl(enc, SPEEX_SET_COMPLEXITY, &iarg);
-
+
int iFrameSize;
speex_encoder_ctl(enc, SPEEX_GET_FRAME_SIZE, &iFrameSize);
-
+
SpeexPreprocessState *spp = speex_preprocess_state_init(iFrameSize, 16000);
iarg = 1;
speex_preprocess_ctl(spp, SPEEX_PREPROCESS_SET_VAD, &iarg);
speex_preprocess_ctl(spp, SPEEX_PREPROCESS_SET_DENOISE, &iarg);
speex_preprocess_ctl(spp, SPEEX_PREPROCESS_SET_AGC, &iarg);
speex_preprocess_ctl(spp, SPEEX_PREPROCESS_SET_DEREVERB, &iarg);
-
+
SpeexEchoState *ses = speex_echo_state_init(iFrameSize, iFrameSize * 10);
iarg = 16000;
speex_echo_ctl(ses, SPEEX_SET_SAMPLING_RATE, &iarg);
speex_preprocess_ctl(spp, SPEEX_PREPROCESS_SET_ECHO_STATE, ses);
-
+
QVector<QByteArray> v;
while(1) {
QByteArray qba = f.read(iFrameSize * 2);
- if (qba.size() != iFrameSize * 2)
+ if (qba.size() != iFrameSize * 2)
break;
v.append(qba);
}
-
+
int nframes = v.size();
-
+
qWarning("Ready to process %d frames of %d samples", nframes, iFrameSize);
QVector<short *> sv;
-
- short tframe[iFrameSize];
+
+ short tframe[2048];
for(int i=0;i<iFrameSize;i++)
tframe[i] = 0;
@@ -77,21 +92,37 @@ int main(int argc, char **argv) {
SpeexBits sb;
speex_bits_init(&sb);
-
+
+#ifdef Q_OS_WIN
+ if (!SetPriorityClass(GetCurrentProcess(),REALTIME_PRIORITY_CLASS))
+ qWarning("Application: Failed to set priority!");
+#endif
+
Timer t;
t.restart();
-
+
+#ifdef VALGRIND
CALLGRIND_START_INSTRUMENTATION;
+#endif
for(int i=0;i<nframes-2;i++) {
- speex_bits_reset(&sb);
+ speex_bits_reset(&sb);
speex_echo_cancellation(ses, sv[i], sv[i+2], tframe);
speex_preprocess_run(spp, tframe);
speex_encode_int(enc, tframe, &sb);
}
+#ifdef VALGRIND
CALLGRIND_STOP_INSTRUMENTATION;
-
+#endif
+
+#ifdef Q_OS_WIN
+ if (!SetPriorityClass(GetCurrentProcess(),NORMAL_PRIORITY_CLASS))
+ qWarning("Application: Failed to reset priority!");
+#endif
+
quint64 e = t.elapsed();
-
+
qWarning("Used %llu usec", e);
qWarning("%.2f times realtime", (20000ULL * nframes) / (e * 1.0));
}
+
+#include "Timer.cpp"
diff --git a/speexbuild/SpeexMark.pro b/speexbuild/SpeexMark.pro
index efbb3455b..6a4a8555b 100644
--- a/speexbuild/SpeexMark.pro
+++ b/speexbuild/SpeexMark.pro
@@ -1,11 +1,9 @@
TEMPLATE =app
-CONFIG += qt warn_on release
+CONFIG += qt warn_on release console
QT -= gui
TARGET = SpeexMark
-SOURCES = SpeexMark.cpp Timer.cpp
+SOURCES = SpeexMark.cpp
HEADERS = Timer.h
-VPATH += ../src
INCLUDEPATH = ../src ../speex/include
LIBS += -lspeex
-QMAKE_LFLAGS += -L../release
-QMAKE_LFLAGS += -fprofile-generate
+LIBPATH += ../release
diff --git a/speexbuild/speexbuild.pro b/speexbuild/speexbuild.pro
index 374a38177..32bbbcad4 100644
--- a/speexbuild/speexbuild.pro
+++ b/speexbuild/speexbuild.pro
@@ -11,6 +11,10 @@ INCLUDEPATH = ../speex/include ../speex/libspeex
win32 {
DEFINES+=WIN32 _WINDOWS _USE_SSE VAR_ARRAYS
+ QMAKE_CC = icl
+ QMAKE_CFLAGS += -Qstd=c99 -Qrestrict
+ QMAKE_CFLAGS_RELEASE += -O3 -QxK -Qip
+ QMAKE_CFLAGS_DEBUG += -O2 -QxK -Ob0
INCLUDEPATH += ../speex/win32
}
@@ -37,11 +41,9 @@ CONFIG(release, debug|release) {
}
CONFIG(symbols) {
- QMAKE_CFLAGS_RELEASE += -g
- QMAKE_CXXFLAGS_RELEASE += -g
- QMAKE_LFLAGS += -g
- QMAKE_LFLAGS -= -Wl,-s
- QMAKE_LFLAGS_RELEASE -= -Wl,-s
+ QMAKE_CFLAGS_RELEASE += -Zi
+ QMAKE_CXXFLAGS_RELEASE += -Zi
+ QMAKE_LFLAGS += /DEBUG
}
CONFIG(optgen) {