Skip to content

Commit e8af0cc

Browse files
committed
fix: Add missing profiles to MPEG2v test suites
1 parent 946c7c7 commit e8af0cc

File tree

4 files changed

+84
-7
lines changed

4 files changed

+84
-7
lines changed

fluster/codec.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ class Profile(Enum):
8989
MAIN_4_2_2_10 = "Main 4:2:2 10"
9090
MAIN_4_4_4_12 = "Main 4:4:4 12"
9191

92+
# MPEG2 video
93+
PROFILE_4_2_2 = "4:2:2"
94+
SIMPLE = "Simple"
95+
9296
# MPEG4 video
9397
SIMPLE_PROFILE = "Simple Profile"
9498
ADVANCED_SIMPLE_PROFILE = "Advanced Simple Profile"

scripts/gen_mpeg2_video.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
3030
from fluster import utils
31-
from fluster.codec import Codec, OutputFormat
31+
from fluster.codec import Codec, OutputFormat, Profile
3232
from fluster.test_suite import TestMethod, TestSuite
3333
from fluster.test_vector import TestVector
3434

@@ -147,14 +147,15 @@ def generate(self, download: bool, jobs: int) -> None:
147147
"-select_streams",
148148
"v:0",
149149
"-show_entries",
150-
"stream=pix_fmt",
150+
"stream=profile,pix_fmt",
151151
"-of",
152152
"default=nokey=1:noprint_wrappers=1",
153153
absolute_input_path,
154154
]
155155

156156
result = utils.run_command_with_output(command).splitlines()
157-
pix_fmt = result[0]
157+
profile = result[0]
158+
pix_fmt = result[1]
158159
try:
159160
test_vector.output_format = OutputFormat[pix_fmt.upper()]
160161
except KeyError as key_err:
@@ -163,6 +164,26 @@ def generate(self, download: bool, jobs: int) -> None:
163164
test_vector.output_format = exceptions[test_vector.name]
164165
else:
165166
raise key_err
167+
try:
168+
transformed_profile = profile.translate(str.maketrans(" :", "__")).upper()
169+
if transformed_profile[0].isdigit():
170+
transformed_profile = "PROFILE_" + transformed_profile
171+
test_vector.profile = Profile[transformed_profile]
172+
except KeyError as key_err:
173+
exceptions_profile = {
174+
# Values come from official spec validated with mediainfo online
175+
# Test suite: MPEG2_VIDEO-MAIN
176+
"MEI": Profile.SIMPLE, # Mpeg version 1
177+
"MEI.stream16": Profile.SIMPLE, # Mpeg version 1
178+
"tcela-16": Profile.MAIN, # Mpeg version 1
179+
"tcela-18": Profile.SIMPLE, # Mpeg version 1
180+
"tcela-19": Profile.SIMPLE, # Mpeg version 1
181+
"ccm1": Profile.SIMPLE, # Mpeg version 1
182+
}
183+
if test_vector.name in exceptions_profile:
184+
test_vector.profile = exceptions_profile[test_vector.name]
185+
else:
186+
raise key_err
166187

167188
absolute_output_filepath = os.path.join(absolute_dest_dir, output_filepath)
168189
test_suite.to_json_file(absolute_output_filepath)

test_suites/mpeg2v/MPEG2_VIDEO-422.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
"name": "MPEG2_VIDEO-422",
33
"codec": "MPEG2_VIDEO",
44
"description": "ISO IEC 13818-4 MPEG2 video 422 profile test suite",
5-
"test_method": "pixel",
65
"test_vectors": [
76
{
87
"name": "sony_422_id13-1",
98
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/sony/sony_422_id13-1/sony_422_id13-1.bs.gz",
109
"source_checksum": "3b414fcbb3852e6f2d9448e7cb07562d",
1110
"input_file": "sony_422_id13-1.bs",
11+
"profile": "4:2:2",
1212
"output_format": "yuv422p",
1313
"result": ""
1414
},
@@ -17,6 +17,7 @@
1717
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/sony/sony_422_id01-1/sony_422_id01-1.bs.gz",
1818
"source_checksum": "990d85154d183313d84b7f519b000911",
1919
"input_file": "sony_422_id01-1.bs",
20+
"profile": "4:2:2",
2021
"output_format": "yuv422p",
2122
"result": ""
2223
},
@@ -25,6 +26,7 @@
2526
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/sony/sony_422_id03-1/sony_422_id03-1.bs.gz",
2627
"source_checksum": "ea556c2c9f835efa132bea12ffc13932",
2728
"input_file": "sony_422_id03-1.bs",
29+
"profile": "4:2:2",
2830
"output_format": "yuv422p",
2931
"result": ""
3032
},
@@ -33,6 +35,7 @@
3335
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/hhi/hhi_burst_422/hhi_burst_422_short.bits.gz",
3436
"source_checksum": "12825629678abc21619c68f2e193bf71",
3537
"input_file": "hhi_burst_422_short.bits",
38+
"profile": "4:2:2",
3639
"output_format": "yuv422p",
3740
"result": ""
3841
},
@@ -41,6 +44,7 @@
4144
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/hhi/hhi_burst_422/hhi_burst_422_long.bits.gz",
4245
"source_checksum": "bd1efead61da7563aa3b5c7ab919c0ce",
4346
"input_file": "hhi_burst_422_long.bits",
47+
"profile": "4:2:2",
4448
"output_format": "yuv422p",
4549
"result": ""
4650
},
@@ -49,6 +53,7 @@
4953
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/tek/Tek9-422-uniformVLC/Tek9.bit.gz",
5054
"source_checksum": "d9e4a14ce972571f77ba0ba55c8850fb",
5155
"input_file": "Tek9.bit",
56+
"profile": "4:2:2",
5257
"output_format": "yuv422p",
5358
"result": ""
5459
},
@@ -57,6 +62,7 @@
5762
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/tek/Tek6-422-bigBpic/Tek6.bit.gz",
5863
"source_checksum": "86792f7770eaf6debce5d19ef357602a",
5964
"input_file": "Tek6.bit",
65+
"profile": "4:2:2",
6066
"output_format": "yuv422p",
6167
"result": ""
6268
},
@@ -65,6 +71,7 @@
6571
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/tek/Tek7-422-smallSlices/Tek7.bit.gz",
6672
"source_checksum": "210837e0f55a342947ce2a58222f3fbf",
6773
"input_file": "Tek7.bit",
74+
"profile": "4:2:2",
6875
"output_format": "yuv422p",
6976
"result": ""
7077
},
@@ -73,8 +80,10 @@
7380
"source": "https://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_IEC_13818-4_2004_Conformance_Testing/Video/bitstreams/422-profile/ibm/ibm_dp_intra_422/ibm_dp_intra_422.m2v.gz",
7481
"source_checksum": "5df0d337e4a059df924e3a928db6b6aa",
7582
"input_file": "ibm_dp_intra_422.m2v",
83+
"profile": "4:2:2",
7684
"output_format": "yuv422p",
7785
"result": ""
7886
}
79-
]
87+
],
88+
"test_method": "pixel"
8089
}

0 commit comments

Comments
 (0)