本文整理汇总了C++中OutputBuffer::tokenno方法的典型用法代码示例。如果您正苦于以下问题:C++ OutputBuffer::tokenno方法的具体用法?C++ OutputBuffer::tokenno怎么用?C++ OutputBuffer::tokenno使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OutputBuffer
的用法示例。
在下文中一共展示了OutputBuffer::tokenno方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: process
bool ComplexDomainFlux::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
{
assert(inp.size()==1);
InputBuffer* in = inp[0].data;
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
if ((out->tokenno()==0) && (in->tokenno()!=-2))
in->prependZeros(2);
if (!in->hasTokens(3)) return false;
const int N = in->info().size/2;
ArrayXcd inPredPredRotator(N);
ArrayXcd inPredRotator(N);
rotatorOp<double> op;
{
Map<ArrayXcd> inPredPredData((complex<double>*) in->token(0),N);
inPredPredRotator = inPredPredData.unaryExpr(op);
}
while (in->hasTokens(3))
{
Map<ArrayXcd> inPredData((complex<double>*) in->token(1),N);
Map<ArrayXcd> inData((complex<double>*) in->token(2), N);
inPredRotator = inPredData.unaryExpr(op);
double* output = out->writeToken();
*output++ = (inData - (inPredData * (inPredRotator * inPredPredRotator.conjugate()))).abs().sum();
in->consumeToken();
inPredPredRotator.swap(inPredRotator);
}
return true;
}
示例2: process
bool Flux::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
{
assert(inp.size()==1);
InputBuffer* in = inp[0].data;
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
if ((out->tokenno()==0) && (in->tokenno()!=-1))
in->prependZeros(1);
if (!in->hasTokens(2))
return false;
const int N = in->info().size;
double lastNorm = 0.0;
double nextNorm = Map<VectorXd>(in->token(0),N).norm();
while (in->hasTokens(2))
{
Map<VectorXd> last(in->token(0),N);
lastNorm = nextNorm;
Map<VectorXd> next(in->token(1),N);
nextNorm = next.norm();
double* output = out->writeToken();
if (lastNorm*nextNorm==0)
*output = 0.0;
else if (m_onlyIncrease)
*output = (next-last).unaryExpr(filterNegativeOp<double>()).squaredNorm() / (lastNorm*nextNorm);
else
*output = (next - last).squaredNorm() / (lastNorm * nextNorm);
in->consumeToken();
}
return true;
}
示例3: process
bool Variation::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
{
assert(inp.size()==1);
InputBuffer* in = inp[0].data;
if (!in->hasTokens(2)) return false;
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
if ((out->tokenno()==0) && (in->tokenno()!=-1))
in->prependZeros(1);
const int N = in->info().size;
double lastNorm = 0.0;
double nextNorm = Map<VectorXd>(in->token(0),N).norm();
while (in->hasTokens(2))
{
Map<VectorXd> last(in->token(0),N);
lastNorm = nextNorm;
Map<VectorXd> next(in->token(1),N);
nextNorm = next.norm();
if (lastNorm*nextNorm !=0)
lastNorm = 1 - last.dot(next) / (lastNorm * nextNorm);
else
lastNorm = 0.0;
out->write(&lastNorm,1);
in->consumeToken();
}
return true;
}
示例4: process
bool AdvancedFrameTokenizer::process(YAAFE::Ports<YAAFE::InputBuffer*>& inp, YAAFE::Ports<YAAFE::OutputBuffer*>& outp)
{
assert(inp.size()==1);
InputBuffer* in = inp[0].data;
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
assert(in->size()==1);
if ((out->tokenno()==0) && (in->tokenno()!=-m_blockSize/2))
in->prependZeros(m_blockSize/2);
if (!in->hasTokens(m_blockSize))
return false;
while (in->hasTokens(m_blockSize)) {
in->read(out->writeToken(),m_blockSize);
int nextInputToken = (int) floor(out->tokenno() * m_outStepSize * in->info().sampleRate / m_outSampleRate + 0.5);
in->consumeTokens(nextInputToken - m_blockSize/2 - in->tokenno());
}
return true;
}
示例5: process
bool FrameTokenizer::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp)
{
assert(inp.size()==1);
InputBuffer* in = inp[0].data;
assert(outp.size()==1);
OutputBuffer* out = outp[0].data;
assert(in->size()==1);
if ((out->tokenno()==0) && (in->tokenno()!=-m_blockSize/2))
in->prependZeros(m_blockSize/2);
if (!in->hasTokens(m_blockSize))
return false;
while (in->hasTokens(m_blockSize)) {
in->read(out->writeToken(),m_blockSize);
in->consumeTokens(m_stepSize);
}
return true;
}