Skip to content

Commit f807d7d

Browse files
committed
feat: add support for test vector profile as optional parameter
- create profile enumerator class for H.264 profiles - modify test vector class structure
1 parent e5ba4ca commit f807d7d

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

fluster/codec.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,24 @@ class OutputFormat(Enum):
6060
GRAY16LE = "gray16le"
6161
UNKNOWN = "Unknown"
6262
FLTP = "fltp"
63+
64+
65+
class Profile(Enum):
66+
"""Profile"""
67+
68+
NONE = "None"
69+
70+
# H.264
71+
CONSTRAINED_BASELINE = "Constrained Baseline"
72+
BASELINE = "Baseline"
73+
EXTENDED = "Extended"
74+
MAIN = "Main"
75+
HIGH = "High"
76+
HIGH_10 = "High 10"
77+
HIGH_10_INTRA = "High 10 Intra"
78+
HIGH_4_2_2 = "High 4:2:2"
79+
HIGH_4_2_2_INTRA = "High 4:2:2 Intra"
80+
HIGH_4_4_4_INTRA = "High 4:4:4 Intra"
81+
HIGH_4_4_4_PREDICTIVE = "High 4:4:4 Predictive"
82+
CAVLC_4_4_4 = "CAVLC 4:4:4"
83+
CAVLC_4_4_4_INTRA = "CAVLC 4:4:4 Intra"

fluster/test_vector.py

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

1818
from enum import Enum
19-
from typing import Any, Dict, List, Type
19+
from typing import Any, Dict, List, Optional, Type
2020

21-
from fluster.codec import OutputFormat
21+
from fluster.codec import OutputFormat, Profile
2222

2323

2424
class TestVectorResult(Enum):
@@ -43,12 +43,14 @@ def __init__(
4343
input_file: str,
4444
output_format: OutputFormat,
4545
result: str,
46+
profile: Optional[Profile] = None,
4647
):
4748
# JSON members
4849
self.name = name
4950
self.source = source
5051
self.source_checksum = source_checksum
5152
self.input_file = input_file
53+
self.profile = profile
5254
self.output_format = output_format
5355
self.result = result
5456

@@ -64,6 +66,11 @@ def from_json(cls: Type["TestVector"], data: Any) -> Any:
6466
data["output_format"] = OutputFormat(data["output_format"])
6567
else:
6668
data["output_format"] = OutputFormat.NONE
69+
70+
# We only define profile if the paramter is found in .json of test suite
71+
if "profile" in data:
72+
data["profile"] = Profile(data["profile"])
73+
6774
return (data["name"], cls(**data))
6875

6976
def data_to_serialize(self) -> Dict[str, object]:
@@ -73,13 +80,18 @@ def data_to_serialize(self) -> Dict[str, object]:
7380
data.pop("errors")
7481
data.pop("test_time")
7582
data["output_format"] = str(self.output_format.value)
83+
if self.profile is not None:
84+
data["profile"] = str(self.profile.value)
85+
else:
86+
data.pop("profile")
7687
return data
7788

7889
def __str__(self) -> str:
7990
ret = (
8091
f" {self.name}\n"
8192
f" Source: {self.source}\n"
8293
f" Input: {self.input_file}\n"
94+
f" Profile: {self.profile}\n"
8395
f" Result: {self.result}"
8496
)
8597
return ret

0 commit comments

Comments
 (0)