diff --git a/src/main/java/band/full/video/encoder/MuxerMP4.java b/src/main/java/band/full/video/encoder/MuxerMP4.java index d0393a4..a8c2868 100644 --- a/src/main/java/band/full/video/encoder/MuxerMP4.java +++ b/src/main/java/band/full/video/encoder/MuxerMP4.java @@ -67,4 +67,8 @@ public String mux() throws IOException, InterruptedException { return name + MP4_SUFFIX; } + + public void deleteInputs() { + inputs.forEach(in -> new File(dir, in).delete()); + } } diff --git a/src/test/java/band/full/test/video/generate/hdr10/Calibrate2160pHDR10.java b/src/test/java/band/full/test/video/generate/hdr10/Calibrate2160pHDR10.java index 2cdaf06..a90ea52 100644 --- a/src/test/java/band/full/test/video/generate/hdr10/Calibrate2160pHDR10.java +++ b/src/test/java/band/full/test/video/generate/hdr10/Calibrate2160pHDR10.java @@ -5,9 +5,6 @@ import band.full.test.video.executor.GenerateVideo; import band.full.test.video.generator.CalibrationBase; -import band.full.test.video.generator.PatchesGenerator; - -import org.junit.jupiter.api.Test; /** * Calibration box fills. diff --git a/src/test/java/band/full/test/video/generate/hevc/fhd/Gradients1080pHEVC.java b/src/test/java/band/full/test/video/generate/hevc/fhd/Gradients1080pHEVC.java index 5d47f0d..bbc7fbe 100644 --- a/src/test/java/band/full/test/video/generate/hevc/fhd/Gradients1080pHEVC.java +++ b/src/test/java/band/full/test/video/generate/hevc/fhd/Gradients1080pHEVC.java @@ -12,6 +12,8 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; import java.util.Random; /** @@ -24,16 +26,17 @@ @Disabled("Requires lossless encode and reducing bitrate to at least 100Mb/s") public class Gradients1080pHEVC { @Test - public void gradients() { + public void gradients() throws IOException, InterruptedException { gradients("Gradients1080p06"); // 6 bit demo } - public void gradients(String name) { - HEVC.generate("Gradients", name, FULLHD_MAIN8, - e -> { - FrameBuffer fb = e.newFrameBuffer(); - e.render(ofSeconds(30), () -> gradients(fb)); - }, d -> {}); + public void gradients(String name) + throws IOException, InterruptedException { + File dir = HEVC.greet("Gradients", name); + HEVC.encode(dir, name, FULLHD_MAIN8, e -> { + FrameBuffer fb = e.newFrameBuffer(); + e.render(ofSeconds(30), () -> gradients(fb)); + }); } /** Render with new dither per frame */ diff --git a/src/test/java/band/full/test/video/generate/hevc/u4k/Gradients2160pBT709.java b/src/test/java/band/full/test/video/generate/hevc/u4k/Gradients2160pBT709.java index 828d707..bfdb007 100644 --- a/src/test/java/band/full/test/video/generate/hevc/u4k/Gradients2160pBT709.java +++ b/src/test/java/band/full/test/video/generate/hevc/u4k/Gradients2160pBT709.java @@ -12,6 +12,8 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; import java.util.Random; /** @@ -24,16 +26,17 @@ @Disabled("Requires lossless encode and reducing bitrate to at least 100Mb/s") public class Gradients2160pBT709 { @Test - public void gradients() { + public void gradients() throws IOException, InterruptedException { gradients("Gradients-06"); // 6 bit demo } - public void gradients(String name) { - HEVC.generate("Gradients", name, UHD4K_MAIN8, - e -> { - FrameBuffer fb = e.newFrameBuffer(); - e.render(ofSeconds(30), () -> gradients(fb)); - }, d -> {}); + public void gradients(String name) + throws IOException, InterruptedException { + File dir = HEVC.greet("Gradients", name); + HEVC.encode(dir, name, UHD4K_MAIN8, e -> { + FrameBuffer fb = e.newFrameBuffer(); + e.render(ofSeconds(30), () -> gradients(fb)); + }); } /** Render with new dither per frame */ diff --git a/src/test/java/band/full/test/video/generator/BT2111Generator.java b/src/test/java/band/full/test/video/generator/BT2111Generator.java index 3965243..1c743de 100644 --- a/src/test/java/band/full/test/video/generator/BT2111Generator.java +++ b/src/test/java/band/full/test/video/generator/BT2111Generator.java @@ -18,7 +18,7 @@ * @author Igor Malinin */ // TODO output file type and test.full.band branding -public class BT2111Generator extends GeneratorBase { +public class BT2111Generator extends GeneratorBase { private final double alpha; private final Matrix3x3 bt709conv; @@ -37,8 +37,7 @@ public class BT2111Generator extends GeneratorBase { public BT2111Generator(GeneratorFactory factory, EncoderParameters params, String folder, String suffix) { - super(factory, params.withEncoderOptions("--qpmax", "6"), - folder, "BT2111" + suffix); + super(factory, params, folder, "BT2111" + suffix); if (width % STD_1080p.width != 0) throw new IllegalArgumentException( @@ -75,13 +74,13 @@ public BT2111Generator(GeneratorFactory factory, } @Override - protected void encode(EncoderY4M e) { + protected void encode(EncoderY4M e, Void args, String phase) { var fb = draw(e.newFrameBuffer()); - e.render(DURATION_STATIC, () -> fb); + e.render(gop, () -> fb); } @Override - protected void verify(DecoderY4M d) { + protected void verify(DecoderY4M d, Void args) { var expected = draw(d.newFrameBuffer()); d.read(fb -> FrameVerifier.verify(expected, fb, 4, 0.001)); } diff --git a/src/test/java/band/full/test/video/generator/BasicSetupBase.java b/src/test/java/band/full/test/video/generator/BasicSetupBase.java index 9cfa192..4561547 100644 --- a/src/test/java/band/full/test/video/generator/BasicSetupBase.java +++ b/src/test/java/band/full/test/video/generator/BasicSetupBase.java @@ -40,7 +40,8 @@ protected BasicSetupBase(GeneratorFactory factory, @Test @Disabled("TODO") public void blackLevel() { - new BlackLevelGenerator(factory, params, folder, pattern).generate(); + new BlackLevelGenerator(factory, params, folder, pattern) + .generate(null); } @ParameterizedTest diff --git a/src/test/java/band/full/test/video/generator/BasicSetupHDRBase.java b/src/test/java/band/full/test/video/generator/BasicSetupHDRBase.java index a423ee2..69f0376 100644 --- a/src/test/java/band/full/test/video/generator/BasicSetupHDRBase.java +++ b/src/test/java/band/full/test/video/generator/BasicSetupHDRBase.java @@ -17,6 +17,6 @@ protected BasicSetupHDRBase(GeneratorFactory factory, @Test public void bt2111() { - new BT2111Generator(factory, params, folder, pattern).generate(); + new BT2111Generator(factory, params, folder, pattern).generate(null); } } diff --git a/src/test/java/band/full/test/video/generator/BlackLevelGenerator.java b/src/test/java/band/full/test/video/generator/BlackLevelGenerator.java index eab7260..b8d63bd 100644 --- a/src/test/java/band/full/test/video/generator/BlackLevelGenerator.java +++ b/src/test/java/band/full/test/video/generator/BlackLevelGenerator.java @@ -28,7 +28,7 @@ * * @author Igor Malinin */ -public class BlackLevelGenerator extends GeneratorBase { +public class BlackLevelGenerator extends GeneratorBase { protected static final int COLS = 16; public BlackLevelGenerator(GeneratorFactory factory, @@ -37,13 +37,13 @@ public BlackLevelGenerator(GeneratorFactory factory, } @Override - protected void encode(EncoderY4M e) { + protected void encode(EncoderY4M e, Void args, String phase) { var fb = e.newFrameBuffer(); patches(fb); marks(fb); - e.render(DURATION_STATIC, () -> fb); + e.render(gop, () -> fb); } /** @@ -63,7 +63,7 @@ private void patches(FrameBuffer fb) { } @Override - protected void verify(DecoderY4M d) { + protected void verify(DecoderY4M d, Void args) { d.read(fb -> verify(fb)); } diff --git a/src/test/java/band/full/test/video/generator/CheckerboardGenerator.java b/src/test/java/band/full/test/video/generator/CheckerboardGenerator.java index 8df1b55..ec60e39 100644 --- a/src/test/java/band/full/test/video/generator/CheckerboardGenerator.java +++ b/src/test/java/band/full/test/video/generator/CheckerboardGenerator.java @@ -5,6 +5,7 @@ import static java.lang.String.format; import static java.util.stream.Stream.concat; +import band.full.test.video.generator.CheckerboardGenerator.Args; import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; @@ -16,8 +17,7 @@ * * @author Igor Malinin */ -public class CheckerboardGenerator - extends ParameterizedGeneratorBase { +public class CheckerboardGenerator extends GeneratorBase { public static class Args { public final String suffix; public final int yMin, yMax; @@ -68,13 +68,13 @@ protected String getPattern(Args args) { } @Override - protected void encode(EncoderY4M e, Args args) { + protected void encode(EncoderY4M e, Args args, String phase) { var fb = e.newFrameBuffer(); fb.Y.calculate( (x, y) -> (x + y) % 2 == 0 ? args.yMin : args.yMax); - e.render(DURATION_STATIC, () -> fb); + e.render(gop, () -> fb); } @Override diff --git a/src/test/java/band/full/test/video/generator/ChromaSubsamplingBase.java b/src/test/java/band/full/test/video/generator/ChromaSubsamplingBase.java index 4a4b494..7140dce 100644 --- a/src/test/java/band/full/test/video/generator/ChromaSubsamplingBase.java +++ b/src/test/java/band/full/test/video/generator/ChromaSubsamplingBase.java @@ -12,6 +12,7 @@ import static java.util.Arrays.fill; import static org.junit.jupiter.api.TestInstance.Lifecycle.PER_CLASS; +import band.full.test.video.generator.ChromaSubsamplingBase.Args; import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; @@ -29,8 +30,7 @@ * @author Igor Malinin */ @TestInstance(PER_CLASS) -public class ChromaSubsamplingBase - extends ParameterizedGeneratorBase { +public class ChromaSubsamplingBase extends GeneratorBase { private static final int CENTER_X = STD_2160p.width / 2; private static final int CENTER_Y = STD_2160p.height / 2; private static final double MAX_DISTANCE = CENTER_Y; @@ -74,7 +74,7 @@ public Stream args() { } @Override - protected void encode(EncoderY4M e, Args args) { + protected void encode(EncoderY4M e, Args args, String phase) { args.generator.accept(e); } @@ -108,7 +108,7 @@ public void concentricBlackWhiteSineE(EncoderY4M e) { fill(fb.U.pixels, c0); fill(fb.V.pixels, c0); - e.render(DURATION_STATIC, () -> fb); + e.render(gop, () -> fb); } public void concentricBlackWhiteSineO(EncoderY4M e) { @@ -130,7 +130,7 @@ public void concentricBlackWhiteSineO(EncoderY4M e) { fill(fb.U.pixels, c0); fill(fb.V.pixels, c0); - e.render(DURATION_STATIC, () -> fb); + e.render(gop, () -> fb); } /** @@ -185,7 +185,7 @@ public void concentricRedBlueSineE(EncoderY4M e) { } } - e.render(DURATION_STATIC, () -> fb); + e.render(gop, () -> fb); } /** luma log sine sweep */ diff --git a/src/test/java/band/full/test/video/generator/GeneratorBase.java b/src/test/java/band/full/test/video/generator/GeneratorBase.java index 2ab2912..ad8dc6b 100644 --- a/src/test/java/band/full/test/video/generator/GeneratorBase.java +++ b/src/test/java/band/full/test/video/generator/GeneratorBase.java @@ -1,22 +1,28 @@ package band.full.test.video.generator; -import static java.time.Duration.ofSeconds; +import static java.lang.Math.round; +import static java.util.Collections.emptyList; +import static java.util.stream.IntStream.range; import band.full.core.Resolution; import band.full.video.buffer.Framerate; import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; +import band.full.video.encoder.MuxerMP4; import band.full.video.itu.ColorMatrix; import band.full.video.itu.TransferCharacteristics; -import java.time.Duration; +import java.io.File; +import java.io.IOException; /** * @author Igor Malinin */ -public abstract class GeneratorBase { - protected static final Duration DURATION_STATIC = ofSeconds(30); +public abstract class GeneratorBase { + protected static final int PATTERN_SECONDS = 30; + protected static final int INTRO_SECONDS = 5; + protected static final int BODY_SECONDS = PATTERN_SECONDS - INTRO_SECONDS; public final GeneratorFactory factory; public final EncoderParameters params; @@ -27,7 +33,7 @@ public abstract class GeneratorBase { public final ColorMatrix matrix; public final Framerate framerate; public final TransferCharacteristics transfer; - public final int width, height; + public final int width, height, gop; public GeneratorBase(GeneratorFactory factory, EncoderParameters params, String folder, String pattern) { @@ -44,18 +50,52 @@ public GeneratorBase(GeneratorFactory factory, width = resolution.width; height = resolution.height; + + gop = round(framerate.rate); + } + + public void generate(A args) { + String pattern = getPattern(args); + File dir = factory.greet(getFolder(args), pattern); + try { + MuxerMP4 muxer = new MuxerMP4(dir, + pattern, factory.brand, emptyList()); + + generate(muxer, dir, args); + String mp4 = muxer.mux(); + muxer.deleteInputs(); + DecoderY4M.decode(dir, mp4, params, d -> verify(d, args)); + } catch (IOException | InterruptedException e) { + throw new RuntimeException(e); + } + } + + public void generate(MuxerMP4 muxer, File dir, A args) + throws IOException, InterruptedException { + encode(muxer, dir, args, null, PATTERN_SECONDS); } - public void generate() { - factory.generate(getFolder(), pattern, - params, this::encode, this::verify); + public void encode(MuxerMP4 muxer, File dir, + A args, String phase, int repeat) + throws IOException, InterruptedException { + String pattern = getPattern(args); + String name = phase == null ? pattern : pattern + "-" + phase; + + String out = factory.encode(dir, name, params, + e -> encode(e, args, phase)); + + range(0, repeat).forEach(i -> muxer.addInput(out)); } - protected String getFolder() { + protected String getFolder(A args) { return factory.folder + '/' + folder; } - protected abstract void encode(EncoderY4M e); + protected String getPattern(A args) { + return pattern; + } + + protected abstract void encode(EncoderY4M e, A args, String phase); - protected abstract void verify(DecoderY4M d); + protected abstract void verify(DecoderY4M d, A args); } diff --git a/src/test/java/band/full/test/video/generator/GeneratorFactory.java b/src/test/java/band/full/test/video/generator/GeneratorFactory.java index b86d60c..7eb14a0 100644 --- a/src/test/java/band/full/test/video/generator/GeneratorFactory.java +++ b/src/test/java/band/full/test/video/generator/GeneratorFactory.java @@ -3,15 +3,12 @@ import static java.lang.Boolean.getBoolean; import static java.lang.System.getProperty; import static java.util.Arrays.stream; -import static java.util.Collections.emptyList; import static java.util.stream.Stream.concat; -import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderAVC; import band.full.video.encoder.EncoderHEVC; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; -import band.full.video.encoder.MuxerMP4; import java.io.File; import java.io.IOException; @@ -101,7 +98,7 @@ boolean isKeepFile() { this.folder = folder; } - private File greet(String folder, String name) { + public File greet(String folder, String name) { System.out.println(LOSSLESS ? "Generating lossless encode..." : "Generating normal encode..."); @@ -115,39 +112,10 @@ private EncoderParameters enrich(EncoderParameters ep) { return LOSSLESS ? lossless(ep) : bluray(ep); } - public void generate(String folder, String name, EncoderParameters ep, - Consumer ec, Consumer dc) { - File dir = greet(folder, name); - try { - String out = encoder.encode(dir, name, enrich(ep), ec); - - String mp4 = new MuxerMP4(dir, name, brand, emptyList()) - .addInput(out).mux(); - - new File(dir, out).delete(); - DecoderY4M.decode(dir, mp4, ep, dc); - } catch (IOException | InterruptedException e) { - throw new RuntimeException(e); - } - } - - public void generate(String folder, String name, EncoderParameters ep, - A args, - ParametrizedConsumer ec, - ParametrizedConsumer dc) { - File dir = greet(folder, name); - try { - String out = encoder.encode(dir, name, enrich(ep), - e -> ec.accept(e, args)); - - String mp4 = new MuxerMP4(dir, name, brand, emptyList()) - .addInput(out).mux(); - - new File(dir, out).delete(); - DecoderY4M.decode(dir, mp4, ep, d -> dc.accept(d, args)); - } catch (IOException | InterruptedException e) { - throw new RuntimeException(e); - } + public String encode(File dir, String name, + EncoderParameters ep, Consumer ec) + throws IOException, InterruptedException { + return encoder.encode(dir, name, enrich(ep), ec); } @FunctionalInterface @@ -156,9 +124,4 @@ String encode(File dir, String name, EncoderParameters ep, Consumer consumer) throws IOException, InterruptedException; } - - @FunctionalInterface - interface ParametrizedConsumer { - void accept(T t, A args); - } } diff --git a/src/test/java/band/full/test/video/generator/ParameterizedGeneratorBase.java b/src/test/java/band/full/test/video/generator/ParameterizedGeneratorBase.java deleted file mode 100644 index 6681d54..0000000 --- a/src/test/java/band/full/test/video/generator/ParameterizedGeneratorBase.java +++ /dev/null @@ -1,65 +0,0 @@ -package band.full.test.video.generator; - -import static java.time.Duration.ofSeconds; - -import band.full.core.Resolution; -import band.full.video.buffer.Framerate; -import band.full.video.encoder.DecoderY4M; -import band.full.video.encoder.EncoderParameters; -import band.full.video.encoder.EncoderY4M; -import band.full.video.itu.ColorMatrix; -import band.full.video.itu.TransferCharacteristics; - -import java.time.Duration; - -/** - * @author Igor Malinin - */ -public abstract class ParameterizedGeneratorBase { - protected static final Duration DURATION_INTRO = ofSeconds(5); - protected static final Duration DURATION_BODY = ofSeconds(25); - protected static final Duration DURATION_STATIC = ofSeconds(30); - - public final GeneratorFactory factory; - public final EncoderParameters params; - public final String folder, pattern; - - // direct access to commonly used parameters - public final Resolution resolution; - public final ColorMatrix matrix; - public final Framerate framerate; - public final TransferCharacteristics transfer; - public final int width, height; - - public ParameterizedGeneratorBase(GeneratorFactory factory, - EncoderParameters params, String folder, String pattern) { - this.factory = factory; - this.params = params; - this.folder = folder; - this.pattern = pattern; - - resolution = params.resolution; - matrix = params.matrix; - framerate = params.framerate; - - transfer = matrix.transfer; - - width = resolution.width; - height = resolution.height; - } - - public void generate(A args) { - factory.generate(getFolder(args), getPattern(args), - params, args, this::encode, this::verify); - } - - protected String getFolder(A args) { - return factory.folder + '/' + folder; - } - - protected abstract String getPattern(A args); - - protected abstract void encode(EncoderY4M e, A args); - - protected abstract void verify(DecoderY4M d, A args); -} diff --git a/src/test/java/band/full/test/video/generator/PatchesGenerator.java b/src/test/java/band/full/test/video/generator/PatchesGenerator.java index 4a15b2b..9e30743 100644 --- a/src/test/java/band/full/test/video/generator/PatchesGenerator.java +++ b/src/test/java/band/full/test/video/generator/PatchesGenerator.java @@ -22,14 +22,18 @@ import band.full.core.color.CIExyY; import band.full.test.video.executor.FrameVerifier; import band.full.test.video.executor.FxImage; +import band.full.test.video.generator.PatchesGenerator.Args; import band.full.video.buffer.FrameBuffer; import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; +import band.full.video.encoder.MuxerMP4; import band.full.video.itu.ICtCp; import org.junit.jupiter.api.TestInstance; +import java.io.File; +import java.io.IOException; import java.text.DecimalFormat; import java.util.function.DoubleUnaryOperator; @@ -51,8 +55,7 @@ * @see ColorPatchesGenerator */ @TestInstance(PER_CLASS) -public abstract class PatchesGenerator - extends ParameterizedGeneratorBase { +public abstract class PatchesGenerator extends GeneratorBase { public static class Args { public final String file; public final String sequence; @@ -159,18 +162,24 @@ protected String getBottomRightText(Args args) { } @Override - protected void encode(EncoderY4M e, Args args) { + public void generate(MuxerMP4 muxer, File dir, Args args) + throws IOException, InterruptedException { + encode(muxer, dir, args, "intro", INTRO_SECONDS); + encode(muxer, dir, args, null, BODY_SECONDS); + } + + @Override + protected void encode(EncoderY4M e, Args args, String phase) { var win = getWindow(args.window); var fb = e.newFrameBuffer(); fb.fillRect(win.x, win.y, win.width, win.height, args.yuv); - FxImage.overlay(overlay(args), fb); - e.render(DURATION_INTRO, () -> fb); + if (phase != null) { + FxImage.overlay(overlay(args), fb); + } - fb.clear(); - fb.fillRect(win.x, win.y, win.width, win.height, args.yuv); - e.render(DURATION_BODY, () -> fb); + e.render(gop, () -> fb); } @Override diff --git a/src/test/java/band/full/test/video/generator/Quants2DBase.java b/src/test/java/band/full/test/video/generator/Quants2DBase.java index 445cdbd..3c551b2 100644 --- a/src/test/java/band/full/test/video/generator/Quants2DBase.java +++ b/src/test/java/band/full/test/video/generator/Quants2DBase.java @@ -11,15 +11,19 @@ import band.full.core.Window; import band.full.test.video.executor.FrameVerifier; import band.full.test.video.executor.FxImage; +import band.full.test.video.generator.Quants2DBase.Args; import band.full.video.buffer.FrameBuffer; import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; +import band.full.video.encoder.MuxerMP4; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import java.io.File; +import java.io.IOException; import java.util.function.DoubleUnaryOperator; import java.util.stream.Stream; @@ -43,8 +47,7 @@ // TODO Dynamic sweep for non-near black/white patterns (->less files) // TODO Color sweeps @TestInstance(PER_CLASS) -public abstract class Quants2DBase - extends ParameterizedGeneratorBase { +public abstract class Quants2DBase extends GeneratorBase { /** Number of rows have to be an odd number - center row is neutral. */ public static final int ROWS = 17; public static final int COLS = 32; @@ -103,14 +106,20 @@ protected String getPattern(Args args) { } @Override - protected void encode(EncoderY4M e, Args args) { - var fb = e.newFrameBuffer(); - generate(fb, args); - e.render(DURATION_INTRO, () -> fb); + public void generate(MuxerMP4 muxer, File dir, Args args) + throws IOException, InterruptedException { + encode(muxer, dir, args, "intro", INTRO_SECONDS); + encode(muxer, dir, args, null, BODY_SECONDS); + } - fb.clear(); + @Override + protected void encode(EncoderY4M e, Args args, String phase) { + var fb = e.newFrameBuffer(); fill(fb, args); - e.render(DURATION_BODY, () -> fb); + if (phase != null) { + marks(fb, args); + } + e.render(gop, () -> fb); } public void generate(FrameBuffer fb, Args args) { diff --git a/src/test/java/band/full/test/video/generator/Quants3DBase.java b/src/test/java/band/full/test/video/generator/Quants3DBase.java index 0116784..b1f06f6 100644 --- a/src/test/java/band/full/test/video/generator/Quants3DBase.java +++ b/src/test/java/band/full/test/video/generator/Quants3DBase.java @@ -5,11 +5,15 @@ import static java.util.stream.IntStream.rangeClosed; import band.full.test.video.executor.FrameVerifier; +import band.full.test.video.generator.Quants3DBase.Args; import band.full.video.buffer.FrameBuffer; import band.full.video.encoder.DecoderY4M; import band.full.video.encoder.EncoderParameters; import band.full.video.encoder.EncoderY4M; +import band.full.video.encoder.MuxerMP4; +import java.io.File; +import java.io.IOException; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -18,8 +22,7 @@ * * @author Igor Malinin */ -public class Quants3DBase - extends ParameterizedGeneratorBase { +public class Quants3DBase extends GeneratorBase { public static class Args { public final String speed; public final int frames; @@ -58,7 +61,13 @@ protected String getPattern(Args args) { } @Override - protected void encode(EncoderY4M e, Args args) { + public void generate(MuxerMP4 muxer, File dir, Args args) + throws IOException, InterruptedException { + encode(muxer, dir, args, null, 1); + } + + @Override + protected void encode(EncoderY4M e, Args args, String phase) { int uCode = matrix.ACHROMATIC; int vCode = matrix.ACHROMATIC;