forked from rampa069/PhnRec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdecoder.cpp
70 lines (57 loc) · 1.68 KB
/
decoder.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/**************************************************************************
* copyright : (C) 2004-2006 by Lukas Burget UPGM,FIT,VUT,Brno *
* email : [email protected] *
**************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
**************************************************************************/
#include "decoder.h"
#include "matrix.h"
#include "filename.h"
Decoder::Decoder() :
callbackFunc(0),
callbackTmpParam(0),
mode(DECMODE_DECODE)
{
}
Decoder::~Decoder()
{
}
int Decoder::ProcessFile(char *features, char *label_file, float *score)
{
Mat<float> M;
if(!M.loadHTK(features))
{
return DECERR_INPUTFILE;
}
int ret = Init(label_file);
if(ret != DECERR_NONE)
return ret;
int i;
float *frame = (float *)M.getMem();
for(i = 0; i < M.rows(); i++)
{
ProcessFrame(frame);
frame += M.columns();
}
float score1 = Done();
if(score)
*score = score1;
return DECERR_NONE;
}
int Decoder::Init(char *label_file)
{
puts("decoder init");
return DECERR_NONE;
}
void Decoder::ProcessFrame(float *frame)
{
}
float Decoder::Done()
{
return (float)0;
}