示例#1
0
 public static WindowBufferProcessorCtx ctreateWindowBufferProcessorCtx(IExtractorConfig config) {
   WindowBufferProcessorCtx ctx = new WindowBufferProcessorCtx();
   ctx.setConfig(config);
   ctx.setBuffer(new FrameValues());
   ctx.getBuffer().setFrameIndex(0L);
   return ctx;
 }
示例#2
0
  public FrameValues calculate(Double value, WindowBufferProcessorCtx ctx) {
    FrameValues windowedWindow = ctx.getBuffer();
    windowedWindow.add(value);

    if (windowedWindow.size() >= ctx.getConfig().getWindowSize()) {
      windowedWindow.setSampleRate(calculateExtractorSampleRate(ctx.getConfig()));
      FrameValues newWindow =
          windowedWindow.subList(
              ctx.getConfig().getWindowSize() - ctx.getConfig().getWindowOverlap(),
              windowedWindow.size());
      ctx.setBuffer(newWindow);
      ctx.getBuffer().setFrameIndex(windowedWindow.getFrameIndex() + 1);
    } else {
      return null;
    }

    return windowedWindow;
  }