20 #if !defined(_MSC_VER) 30 : socket_desc(socket),
36 samples_processed(0) {
77 KALDI_ERR <<
"TCPVectorSource: Pack size must be even!";
94 int32 frame_offset = 0;
97 int size = last_pack_rem < get_size ?
last_pack_rem : get_size;
101 last_pack_rem -= size;
103 frame_offset += size;
106 while (get_size > 0) {
112 int32 size = ret < get_size ? ret : get_size;
114 memcpy(
frame + frame_offset,
pack, size);
119 frame_offset += size;
129 int32 n_elem =
static_cast<uint32
>(data->
Dim());
131 int32 n_bytes = n_elem * 2;
140 int32 n_read = b_read / 2;
142 short* s_frame = (
short*)
frame;
143 for (int32
i = 0;
i < n_read;
i++)
144 (*data)(
i) = s_frame[
i];
148 return (n_read == n_elem);
157 #endif // !defined(_MSC_VER) size_t SamplesProcessed()
This code computes Goodness of Pronunciation (GOP) and extracts phone-level pronunciation feature for...
bool Read(Vector< BaseFloat > *data)
OnlineTcpVectorSource(int32 socket)
bool ReadFull(char *buf, int32 len)
int32 FillFrame(int32 size)
MatrixIndexT Dim() const
Returns the dimension of the vector.
A class representing a vector.