Skip to content

Commit

Permalink
[ffmpeg-qsv] add avce playback_seek test case
Browse files Browse the repository at this point in the history
Signed-off-by: Wang Hangjie <[email protected]>
  • Loading branch information
Hangjie22Coder committed Sep 6, 2024
1 parent 1d268ed commit 3edb84c
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
50 changes: 50 additions & 0 deletions lib/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,56 @@ def gen_avc_rqp_parameters(spec, profiles):
params = gen_avc_rqp_variants(spec, profiles)
return keys, params

def gen_avc_seek_variants(spec):
for case, params in spec.items():
variants = params.get("variants", dict()).get("seek", [])
for variant in variants:
rcmode = variant["rcmode"]
bitrate = variant["bitrate"]

# Update maxrate according to rcmode
if "cbr" == rcmode:
variant.update(maxrate = bitrate)
elif "vbr" == rcmode:
variant.update(maxrate = bitrate * 2)
else:
variant.update(maxrate = None)

yield [
case, rcmode, bitrate, variant.get("maxrate", None),
variant.get("fps", 25), variant.get("seek", 1)
]

def gen_avc_seek_parameters(spec):
keys = ("case", "rcmode", "bitrate", "maxrate", "fps", "seek")
params = gen_avc_seek_variants(spec)
return keys, params

def gen_avc_seek_lp_variants(spec):
for case, params in spec.items():
variants = params.get("variants", dict()).get("seek_lp", [])
for variant in variants:
rcmode = variant["rcmode"]
bitrate = variant["bitrate"]

# Update maxrate according to rcmode
if "cbr" == rcmode:
variant.update(maxrate = bitrate)
elif "vbr" == rcmode:
variant.update(maxrate = bitrate * 2)
else:
variant.update(maxrate = None)

yield [
case, rcmode, bitrate, variant.get("maxrate", None),
variant.get("fps", 25), variant.get("seek", 1)
]

def gen_avc_seek_lp_parameters(spec):
keys = ("case", "rcmode", "bitrate", "maxrate", "fps", "seek")
params = gen_avc_seek_lp_variants(spec)
return keys, params

def gen_hevc_cqp_lp_variants(spec, profiles, strapi=False):
for case, params in spec.items():
if strapi:
Expand Down
36 changes: 36 additions & 0 deletions test/ffmpeg-qsv/encode/avc.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,39 @@ def init(self, tspec, case, gop, bframes, bitrate, maxrate, profile, rcmode, max
def test(self, case, gop, bframes, bitrate, maxrate, profile, rcmode, maxi, mini, maxp, minp, maxb, minb):
self.init(spec, case, gop, bframes, bitrate, maxrate, profile, rcmode, maxi, mini, maxp, minp, maxb, minb)
self.encode()

class seek(AVCEncoderTest):
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_avc_seek_parameters(spec))
def test(self, case, rcmode, bitrate, maxrate, fps, seek):
self.init(spec, case, rcmode, bitrate, maxrate, fps, seek)
self.encode()

class seek_lp(AVCEncoderTest):
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_avc_seek_lp_parameters(spec))
def test(self, case, rcmode, bitrate, maxrate, fps, seek):
self.init(spec, case, rcmode, bitrate, maxrate, fps, seek)
self.encode()

0 comments on commit 3edb84c

Please sign in to comment.