From 65105dd66a570e499702a562e1e6f058b8be301e Mon Sep 17 00:00:00 2001 From: Wang Hangjie Date: Thu, 26 Sep 2024 22:43:45 -0700 Subject: [PATCH 1/2] [ffmpeg-qsv] add jpeg encode playback_seek test case Signed-off-by: Wang Hangjie --- lib/parameters.py | 13 +++++++++++++ test/ffmpeg-qsv/encode/jpeg.py | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/parameters.py b/lib/parameters.py index 34fb1223..a7a9accb 100755 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -750,6 +750,19 @@ def gen_jpeg_cqp_parameters(spec): params = gen_jpeg_cqp_variants(spec) return keys, params +def gen_jpeg_seek_variants(spec): + for case, params in spec.items(): + variants = params.get("variants", dict()).get("seek", []) + for variant in variants: + yield [ + case, variant.get("fps", 25), variant.get("seek", 1) + ] + +def gen_jpeg_seek_parameters(spec): + keys = ("case", "fps", "seek") + params = gen_jpeg_seek_variants(spec) + return keys, params + def gen_vp8_cqp_variants(spec): for case, params in spec.items(): variants = params.get("variants", dict()).get("cqp", None) diff --git a/test/ffmpeg-qsv/encode/jpeg.py b/test/ffmpeg-qsv/encode/jpeg.py index fae31c7c..02e72682 100644 --- a/test/ffmpeg-qsv/encode/jpeg.py +++ b/test/ffmpeg-qsv/encode/jpeg.py @@ -31,3 +31,18 @@ def test_r2r(self, case, quality): self.init(spec_r2r, case, quality) vars(self).setdefault("r2r", 5) self.encode() + +class seek(JPEGEncoderTest): + def init(self, tspec, case, fps, seek): + vars(self).update(tspec[case].copy()) + vars(self).update( + case = case, + rcmode = "cqp", + fps = fps, + seek = seek, + ) + + @slash.parametrize(*gen_jpeg_seek_parameters(spec)) + def test(self, case, fps, seek): + self.init(spec, case, fps, seek) + self.encode() From 81662536d8d08a06542eab178a2bb6de222d4709 Mon Sep 17 00:00:00 2001 From: Wang Hangjie Date: Tue, 8 Oct 2024 01:09:17 -0700 Subject: [PATCH 2/2] [ffmpeg-qsv] add mpeg2 encode playback_seek test case Signed-off-by: Wang Hangjie --- lib/parameters.py | 1 + test/ffmpeg-qsv/encode/mpeg2.py | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/parameters.py b/lib/parameters.py index a7a9accb..ae668858 100755 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -965,6 +965,7 @@ def gen_vp9_seek_lp_parameters(spec): gen_avc_seek_lp_parameters = gen_vp9_seek_lp_parameters gen_av1_seek_parameters = gen_vp9_seek_parameters gen_av1_seek_lp_parameters = gen_vp9_seek_lp_parameters +gen_mpeg2_seek_parameters = gen_vp9_seek_parameters def gen_av1_cqp_variants(spec, strapi=False): for case, params in spec.items(): diff --git a/test/ffmpeg-qsv/encode/mpeg2.py b/test/ffmpeg-qsv/encode/mpeg2.py index 764f8652..5e96f4d2 100644 --- a/test/ffmpeg-qsv/encode/mpeg2.py +++ b/test/ffmpeg-qsv/encode/mpeg2.py @@ -33,3 +33,21 @@ def test_r2r(self, case, gop, bframes, qp, quality): self.init(spec_r2r, case, gop, bframes, qp, quality) vars(self).setdefault("r2r", 5) self.encode() + +class seek(MPEG2EncoderTest): + def init(self, tspec, case, rcmode, bitrate, maxrate, fps, seek): + vars(self).update(tspec[case].copy()) + vars(self).update( + case = case, + bitrate = bitrate, + maxrate = maxrate, + minrate = bitrate, + rcmode = rcmode, + fps = fps, + seek = seek, + ) + + @slash.parametrize(*gen_mpeg2_seek_parameters(spec)) + def test(self, case, rcmode, bitrate, maxrate, fps, seek): + self.init(spec, case, rcmode, bitrate, maxrate, fps, seek) + self.encode()