Encode OpenEXR and PNG frames in parallel

This commit is contained in:
Jonas Herzig
2022-06-26 13:32:58 +02:00
parent a3f4049322
commit 517591d72a
8 changed files with 87 additions and 20 deletions

View File

@@ -137,11 +137,19 @@ public class VideoRenderer implements RenderInfo {
}
ffmpegWriter = frameConsumer instanceof FFmpegWriter ? (FFmpegWriter) frameConsumer : null;
FrameConsumer<BitmapFrame> previewingFrameConsumer = new FrameConsumer<BitmapFrame>() {
private int lastFrameId = -1;
@Override
public void consume(Map<Channel, BitmapFrame> channels) {
BitmapFrame bgra = channels.get(Channel.BRGA);
if (bgra != null) {
gui.updatePreview(bgra.getByteBuffer(), bgra.getSize());
synchronized (this) {
int frameId = bgra.getFrameId();
if (lastFrameId < frameId) {
lastFrameId = frameId;
gui.updatePreview(bgra.getByteBuffer(), bgra.getSize());
}
}
}
frameConsumer.consume(channels);
}
@@ -150,6 +158,11 @@ public class VideoRenderer implements RenderInfo {
public void close() throws IOException {
frameConsumer.close();
}
@Override
public boolean isParallelCapable() {
return frameConsumer.isParallelCapable();
}
};
this.renderingPipeline = Pipelines.newPipeline(settings.getRenderMethod(), this, previewingFrameConsumer);
}