| 45 | } |
| 46 | |
| 47 | void NormalizeMaxAll::processBlock(InputBuffer* in, OutputBuffer* out, int nbFrames) |
| 48 | { |
| 49 | if (nbFrames<=0) |
| 50 | return; |
| 51 | assert(in->hasTokens(nbFrames)); |
| 52 | assert(in->info().size==out->info().size); |
| 53 | const int size = in->info().size; |
| 54 | double maxvalue = *(in->readToken()); |
| 55 | for (int i=0;i<nbFrames;i++) { |
| 56 | Map<ArrayXd> inData(in->token(i),size); |
| 57 | double m = inData.maxCoeff(); |
| 58 | if (m>maxvalue) |
| 59 | maxvalue = m; |
| 60 | } |
| 61 | for (int i=0;i<nbFrames;i++) { |
| 62 | Map<ArrayXd> inData(in->readToken(),size); |
| 63 | Map<ArrayXd> outData(out->writeToken(),size); |
| 64 | outData = inData / maxvalue; |
| 65 | in->consumeToken(); |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | bool NormalizeMaxAll::process(Ports<InputBuffer*>& inp, Ports<OutputBuffer*>& outp) |
| 70 | { |
nothing calls this directly
no test coverage detected