Skip to content

Commit 9512441

Browse files
committed
feat: add TestVector optional decoder parameters
adding the capability to include an optional decoder parameters set for a specfic test vector in the test suite definition. optional parameters are utilized in Decoder class decode function abstraction and are applied in Gstreamer(Decoder) and Ffmpeg(Decoder) classes implementations. It's child class responsibility to handle the optional parameters.
1 parent 118254e commit 9512441

21 files changed

Lines changed: 59 additions & 3 deletions

fluster/decoder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def decode(
4747
timeout: int,
4848
verbose: bool,
4949
keep_files: bool,
50+
optional_params: Optional[dict],
5051
) -> str:
5152
"""Decodes input_filepath in output_filepath"""
5253
raise Exception("Not implemented")

fluster/decoders/av1_aom.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public
1616
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
17+
from typing import Optional
1718

1819
from fluster.codec import Codec, OutputFormat
1920
from fluster.decoder import Decoder, register_decoder
@@ -38,6 +39,7 @@ def decode(
3839
timeout: int,
3940
verbose: bool,
4041
keep_files: bool,
42+
optional_params: Optional[dict],
4143
) -> str:
4244
"""Decodes input_filepath in output_filepath"""
4345
fmt = "--rawvideo"

fluster/decoders/av1_dav1d.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public
1616
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
17+
from typing import Optional
1718

1819
from fluster.codec import Codec, OutputFormat
1920
from fluster.decoder import Decoder, register_decoder
@@ -37,6 +38,7 @@ def decode(
3738
timeout: int,
3839
verbose: bool,
3940
keep_files: bool,
41+
optional_params: Optional[dict],
4042
) -> str:
4143
"""Decodes input_filepath in output_filepath"""
4244
fmt = "yuv"

fluster/decoders/chromium.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
1717

1818
from functools import lru_cache
19+
from typing import Optional
1920

2021
from fluster.codec import Codec, OutputFormat
2122
from fluster.decoder import Decoder, register_decoder
@@ -50,6 +51,7 @@ def decode(
5051
timeout: int,
5152
verbose: bool,
5253
keep_files: bool,
54+
optional_params: Optional[dict],
5355
) -> str:
5456
return str(main(input_filepath))
5557

fluster/decoders/cros_codecs.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public
1616
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
17+
from typing import Optional
1718

1819
from fluster.codec import Codec, OutputFormat
1920
from fluster.decoder import Decoder, register_decoder
@@ -38,6 +39,7 @@ def decode(
3839
timeout: int,
3940
verbose: bool,
4041
keep_files: bool,
42+
optional_params: Optional[dict],
4143
) -> str:
4244
"""Decodes input_filepath in output_filepath"""
4345

fluster/decoders/dummy.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#
1515
# You should have received a copy of the GNU Lesser General Public
1616
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
17+
from typing import Optional
1718

1819
from fluster.codec import Codec, OutputFormat
1920
from fluster.decoder import Decoder, register_decoder
@@ -36,5 +37,6 @@ def decode(
3637
timeout: int,
3738
verbose: bool,
3839
keep_files: bool,
40+
optional_params: Optional[dict],
3941
) -> str:
4042
return file_checksum(input_filepath)

fluster/decoders/ffmpeg.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def decode(
7070
timeout: int,
7171
verbose: bool,
7272
keep_files: bool,
73+
optional_params: Optional[dict],
7374
) -> str:
7475
"""Decodes input_filepath in output_filepath"""
7576
command = [self.binary, "-hide_banner", "-nostdin"]
@@ -99,6 +100,11 @@ def decode(
99100
elif self.ffmpeg_codec:
100101
command.extend(["-codec", self.ffmpeg_codec])
101102

103+
# Optional decoder parameters
104+
if optional_params:
105+
for key, value in optional_params.items():
106+
command.extend([key, str(value)])
107+
102108
# Input file
103109
command.extend(["-i", input_filepath])
104110

fluster/decoders/gstreamer.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,21 @@ def gen_pipeline(
109109
input_filepath: str,
110110
output_filepath: Optional[str],
111111
output_format: OutputFormat,
112+
optional_params: Optional[dict] = None,
112113
) -> str:
113114
"""Generate the GStreamer pipeline used to decode the test vector"""
114115
output = f"location={output_filepath}" if output_filepath else ""
116+
117+
decoder_params = ""
118+
if optional_params:
119+
for key, value in optional_params.items():
120+
decoder_params += f" {key}={value} "
121+
115122
return PIPELINE_TPL.format(
116123
self.cmd,
117124
input_filepath,
118125
self.parser if self.parser else "parsebin",
119-
self.decoder_bin,
126+
self.decoder_bin + decoder_params,
120127
self.caps,
121128
self.sink,
122129
output,
@@ -149,6 +156,7 @@ def decode(
149156
timeout: int,
150157
verbose: bool,
151158
keep_files: bool,
159+
optional_params: Optional[dict],
152160
) -> str:
153161
"""Decode the test vector and do the checksum"""
154162
# When using videocodectestsink we can avoid writing files to disk
@@ -162,7 +170,7 @@ def decode(
162170
data = run_command_with_output(command, timeout=timeout, verbose=verbose).splitlines()
163171
return self.parse_videocodectestsink_md5sum(data)
164172

165-
pipeline = self.gen_pipeline(input_filepath, output_filepath, output_format)
173+
pipeline = self.gen_pipeline(input_filepath, output_filepath, output_format, optional_params)
166174
run_command(shlex.split(pipeline), timeout=timeout, verbose=verbose)
167175
return file_checksum(output_filepath)
168176

@@ -193,6 +201,7 @@ def gen_pipeline(
193201
input_filepath: str,
194202
output_filepath: Optional[str],
195203
output_format: OutputFormat,
204+
optional_params: Optional[dict] = None,
196205
) -> str:
197206
raw_caps = "video/x-raw"
198207
try:

fluster/decoders/h264_jct_vt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#
1616
# You should have received a copy of the GNU Lesser General Public
1717
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
18+
from typing import Optional
1819

1920
from fluster.codec import Codec, OutputFormat
2021
from fluster.decoder import Decoder, register_decoder
@@ -38,6 +39,7 @@ def decode(
3839
timeout: int,
3940
verbose: bool,
4041
keep_files: bool,
42+
optional_params: Optional[dict],
4143
) -> str:
4244
"""Decodes input_filepath in output_filepath"""
4345
run_command(

fluster/decoders/h265_jct_vt.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#
1616
# You should have received a copy of the GNU Lesser General Public
1717
# License along with this library. If not, see <https://www.gnu.org/licenses/>.
18+
from typing import Optional
1819

1920
from fluster.codec import Codec, OutputFormat
2021
from fluster.decoder import Decoder, register_decoder
@@ -38,6 +39,7 @@ def decode(
3839
timeout: int,
3940
verbose: bool,
4041
keep_files: bool,
42+
optional_params: Optional[dict],
4143
) -> str:
4244
"""Decodes input_filepath in output_filepath"""
4345
run_command(

0 commit comments

Comments
 (0)