Skip to content

Commit 1bc5bef

Browse files
Merge pull request #2 from MPEGGroup/develop
Develop
2 parents b0e9299 + ef1a20e commit 1bc5bef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+3692
-2392
lines changed

.clang-tidy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ CheckOptions:
2424
- key: readability-identifier-length.MinimumLoopCounterNameLength
2525
value: 1
2626
- key: readability-function-size.LineThreshold
27-
value: 130
27+
value: 175
2828
- key: readability-function-size.StatementThreshold
29-
value: 110
29+
value: 120
3030
- key: readability-function-size.ParameterThreshold
3131
value: 6
3232
- key: readability-function-size.NestingThreshold
3333
value: 7
3434
- key: readability-function-size.VariableThreshold
35-
value: 35
35+
value: 40
3636
- key: readability-function-cognitive-complexity.Threshold
37-
value: 60
37+
value: 65
3838
- key: bugprone-easily-swappable-parameters.MinimumLength
3939
value: 4
4040
- key: bugprone-easily-swappable-parameters.ModelImplicitConversions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ AutoTest.Net/
182182
# Web workbench (sass)
183183
.sass-cache/
184184

185+
out/
186+
185187
# Installshield output folder
186188
[Ee]xpress/
187189

.gitlab-ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
1+
variables:
2+
JOB_TAG: "linux"
3+
IMAGE_CBACHHUBER_CLANG_PREFIX: ""
4+
IMAGE_CBACHHUBER_CLANG_TAG: "cbachhuber/clang:12"
5+
GIT_MPEG_EXPERT_ACCESS_URL: "https://gitlab-ci-token:${CI_JOB_TOKEN}@git.mpeg.expert"
6+
17
stages:
28
- check
39
- build
410
- test
511

612
default:
713
interruptible: true
14+
tags:
15+
- ${JOB_TAG}
816

917
include:
1018
- /.gitlab/checks.yml

.gitlab/builds.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
Clang 12 Debug:
22
stage: build
3-
image: cbachhuber/clang:12
4-
tags: [linux]
3+
image: ${IMAGE_CBACHHUBER_CLANG_PREFIX}${IMAGE_CBACHHUBER_CLANG_TAG}
54
script:
65
- git config --global http.sslVerify "false"
7-
- echo "https://gitlab-ci-token:${CI_JOB_TOKEN}@git.mpeg.expert" > ~/git.store
6+
- echo "${GIT_MPEG_EXPERT_ACCESS_URL}" > ~/git.store
87
- git config --global credential.helper 'store --file ~/git.store'
98
- mkdir -p build && cd build
109
- >
@@ -35,14 +34,15 @@ Clang 12 Debug:
3534

3635
GCC 10 Release:
3736
stage: build
38-
image: rikorose/gcc-cmake
39-
tags: [linux]
37+
variables:
38+
IMAGE_RIKOROSE_GCC_CMAKE_PREFIX: ""
39+
image: ${IMAGE_RIKOROSE_GCC_CMAKE_PREFIX}rikorose/gcc-cmake
4040
before_script:
4141
- export CXX=/usr/bin/g++-10
4242
- export CC=/usr/bin/gcc-10
4343
script:
4444
- git config --global http.sslVerify "false"
45-
- echo "https://gitlab-ci-token:${CI_JOB_TOKEN}@git.mpeg.expert" > ~/git.store
45+
- echo "${GIT_MPEG_EXPERT_ACCESS_URL}" > ~/git.store
4646
- git config --global credential.helper 'store --file ~/git.store'
4747
- mkdir -p build && cd build
4848
- cmake -DENABLE_CLANG_TIDY=OFF -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic -Werror" -DCMAKE_BUILD_TYPE=Release ..

.gitlab/checks.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
clang-format:
22
stage: check
3-
image: cbachhuber/clang:12
4-
tags: [ linux ]
3+
image: ${IMAGE_CBACHHUBER_CLANG_PREFIX}${IMAGE_CBACHHUBER_CLANG_TAG}
54
script:
65
- python3 scripts/check/clang_format.py
76
- git diff

.gitlab/tests.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
Metrics:
22
stage: test
3-
image: gcc-cmake-python:RM0
4-
tags: [linux]
3+
variables:
4+
IMAGE_GCC_CMAKE_PYTHON_PREFIX: ""
5+
image: ${IMAGE_GCC_CMAKE_PYTHON_PREFIX}gcc-cmake-python:RM0
56
before_script:
67
- export CXX=/usr/bin/g++-10
78
- export CC=/usr/bin/gcc-10
89
script:
910
- git config --global http.sslVerify "false"
10-
- echo "https://gitlab-ci-token:${CI_JOB_TOKEN}@git.mpeg.expert" > ~/git.store
11+
- echo "${GIT_MPEG_EXPERT_ACCESS_URL}" > ~/git.store
1112
- git config --global credential.helper 'store --file ~/git.store'
1213
- mkdir -p build && cd build
1314
- cmake -DENABLE_CLANG_TIDY=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=~/install ..

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ endif()
1010
option(BUILD_DECODER "Enable building Decoder" ON)
1111
option(BUILD_ENCODER "Enable building Encoder" ON)
1212
option(BUILD_SYNTHESIZER "Enable building Synthesizer" ON)
13+
option(BUILD_CONFORMANCE "Enable building Conformance" ON)
1314

1415
option(NO_INTERNET "Use pre-downloaded source archives for external libraries, e.g. Catch2" OFF)
1516

cmake/pugixml.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ include(FetchContent)
44
if(NO_INTERNET)
55
set(LOCAL_PUGIXML_DIR ${CMAKE_SOURCE_DIR}/../pugixml CACHE PATH "Path to the local PUGIXML directory" )
66
message(STATUS "Looking for a local copy of the PUGIXML test framework in ${LOCAL_PUGIXML_DIR}")
7-
fetchcontent_declare(DR_LIBS URL ${LOCAL_PUGIXML_DIR})
7+
fetchcontent_declare(PUGIXML URL ${LOCAL_PUGIXML_DIR})
88
else()
99
FetchContent_Declare(pugixml
1010
GIT_REPOSITORY "https://github.com/zeux/pugixml"

scripts/RM_submission/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"synthesizer_path": "Synthesizer\\Synthesizer.exe",
66

77
"reference_files": {
8-
"main_folder": "..\\..\\..\\..\\..\\..\\..\\Data\\Part40-HapticSupport",
8+
"main_folder": "..\\..\\..\\..\\..\\..\\Data\\Part31-HapticSupport",
99
"reference_bitratePSNR": "reference_bitratePSNR.csv",
1010
"short_effects": [
1111
{

scripts/RM_submission/conformance_check.py

Lines changed: 56 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
from soundfile import read, write
4545

4646
RM_INSTALL_DIR = "RM_install_dir"
47+
CONFORMANCE_PATH_KEY = "conformance_path"
4748
ENCODER_PATH_KEY = "encoder_path"
4849
DECODER_PATH_KEY = "decoder_path"
4950
SYNTHESIZER_PATH_KEY = "synthesizer_path"
@@ -59,8 +60,11 @@
5960
CONFORMANCE_FILES_KEY = "conformance_files"
6061
CONFORMANCE_TEST_SET_KEYS = [
6162
"schemas_checks",
62-
"semantic_checks"
63+
"semantic_checks",
64+
"hmpg_compatibility_checks",
65+
"hmpg_conformance_checks"
6366
]
67+
CONFORMANCE_TEST_SET_KEY = "conversion_checks"
6468

6569
def checkSoftwarePath(config: dict):
6670
def _check_software(dir_key: str,path_key: str):
@@ -71,6 +75,7 @@ def _check_software(dir_key: str,path_key: str):
7175
assert os.path.exists(config_file), f"{path_key} should be an existing file"
7276
assert os.access(config_file, os.X_OK), f"{path_key} should be executable"
7377

78+
_check_software(RM_INSTALL_DIR, CONFORMANCE_PATH_KEY)
7479
_check_software(RM_INSTALL_DIR, ENCODER_PATH_KEY)
7580
_check_software(RM_INSTALL_DIR, DECODER_PATH_KEY)
7681
_check_software(RM_INSTALL_DIR, SYNTHESIZER_PATH_KEY)
@@ -85,15 +90,13 @@ def main():
8590
if os.path.exists(output_folder):
8691
shutil.rmtree(output_folder)
8792

88-
89-
#text_file = open("testlog.txt", "w")
93+
print("####### HJIF Conformance Tests")
9094
nb_tests = 0
9195
nb_success = 0
9296
check_fails = []
9397
for conformance_check_type in CONFORMANCE_TEST_SET_KEYS:
9498
print("\n****** ",conformance_check_type," ******")
9599
test_number = 1;
96-
#text_file.write("****** "+conformance_check_type+" ******\n")
97100
for conformance_check in config[CONFORMANCE_FILES_KEY][conformance_check_type]:
98101
input_file_path = conformance_check[HAPTIC_FILE_PATH_KEY]
99102
if MAIN_FOLDER_KEY in config[CONFORMANCE_FILES_KEY]:
@@ -105,27 +108,64 @@ def main():
105108
input_file_path = os.path.join(config[CONFORMANCE_FILES_KEY][MAIN_FOLDER_KEY], input_file_path)
106109
if(not os.path.exists(input_file_path)):
107110
print(f"FILE NOT FOUND: {input_file_path}")
111+
nb_tests+=1
112+
test_number+=1
108113
continue
109-
#print("\n",conformance_check[NAME_KEY])
110-
#print(datetime.now().strftime(f"[ %Hh : %Mm : %Ss ] => Encoder on : {input_file_path}"))
111-
result = subprocess.run(f"{os.path.join(config[RM_INSTALL_DIR], config[ENCODER_PATH_KEY])} -f {input_file_path} -o test.hjif",shell=True, capture_output=True, text=True)
112-
valid = result.stderr.splitlines()==conformance_check[EXPECTED_OUTPUT_KEY].splitlines()
114+
result = subprocess.run(f"{os.path.join(config[RM_INSTALL_DIR], config[CONFORMANCE_PATH_KEY])} -f {input_file_path}",shell=True, capture_output=True, text=True)
115+
expected_output = conformance_check[EXPECTED_OUTPUT_KEY].replace("{main_folder}",config[CONFORMANCE_FILES_KEY][MAIN_FOLDER_KEY])
116+
valid = result.stderr.splitlines()==expected_output.splitlines()
113117
if(not valid):
114-
check_fails.append("*********\n"+conformance_check_type +" #"+str(test_number)+" failed: "+conformance_check[NAME_KEY]+"\n")
118+
check_fails.append("\n---------------------\n"+conformance_check_type +" #"+str(test_number)+" failed: "+conformance_check[NAME_KEY]+"\n")
115119
check_fails.append("- Output : \n"+result.stderr)
116-
check_fails.append("- Expected output: \n"+conformance_check[EXPECTED_OUTPUT_KEY])
120+
check_fails.append("- Expected output: \n"+expected_output)
117121
print("Test #",test_number,":\t",valid,"\t|\t",conformance_check[NAME_KEY])
118122
nb_tests+=1
119123
test_number+=1
120124
if(valid):
121125
nb_success+=1
122-
#text_file.write('\\n'.join(result.stderr.replace("\\","\\\\").splitlines())+"\n\n")
123-
#text_file.close()
124-
print("####### Conformance Results")
125-
if(nb_success == nb_tests):
126-
print("SUCCESS: ",nb_success,"/",nb_tests," valid tests")
126+
if(nb_success == nb_tests):
127+
print("\nSUCCESS: ",nb_success,"/",nb_tests," valid tests")
128+
else:
129+
print("\nFAIL: ",nb_success,"/",nb_tests," valid tests")
130+
print("The following tests failed:")
131+
print("\n".join(check_fails))
132+
133+
check_fails = []
134+
test_number = 1;
135+
nb_success = 0;
136+
nb_tests = 0;
137+
138+
print("\n####### Conversion Conformance Tests\n")
139+
for conversion_check in config[CONFORMANCE_FILES_KEY][CONFORMANCE_TEST_SET_KEY]:
140+
input_file_path = conversion_check[HAPTIC_FILE_PATH_KEY]
141+
if MAIN_FOLDER_KEY in config[CONFORMANCE_FILES_KEY]:
142+
if(input_file_path == ""):
143+
print("Conversion Test ",conversion_check[NAME_KEY],"TO DO\t")
144+
test_number+=1
145+
continue
146+
input_file_path = os.path.join(config[CONFORMANCE_FILES_KEY][MAIN_FOLDER_KEY], input_file_path)
147+
if(not os.path.exists(input_file_path)):
148+
print(f"FILE NOT FOUND: {input_file_path}")
149+
test_number+=1
150+
continue
151+
binary_encoding_result = subprocess.run(f"{os.path.join(config[RM_INSTALL_DIR], config[ENCODER_PATH_KEY])} -f {input_file_path} -o test.hmpg -b",shell=True, capture_output=True, text=True)
152+
decoding_result = subprocess.run(f"{os.path.join(config[RM_INSTALL_DIR], config[DECODER_PATH_KEY])} -f test.hmpg -o testDecoded.hjif",shell=True, capture_output=True, text=True)
153+
comparison = subprocess.run(f"{os.path.join(config[RM_INSTALL_DIR], config[CONFORMANCE_PATH_KEY])} -f {input_file_path} -c testDecoded.hjif",shell=True, capture_output=True, text=True)
154+
expected_output = conversion_check[EXPECTED_OUTPUT_KEY].replace("{main_folder}",config[CONFORMANCE_FILES_KEY][MAIN_FOLDER_KEY])
155+
valid = comparison.stderr.splitlines()==expected_output.splitlines()
156+
if(not valid):
157+
check_fails.append("\n---------------------\n\nConversion #"+str(test_number)+" failed: "+conversion_check[NAME_KEY]+"\n")
158+
check_fails.append("- Output : \n"+comparison.stderr)
159+
check_fails.append("- Expected output: \n"+expected_output)
160+
else:
161+
nb_success+=1
162+
print("Test #",test_number,":\t",valid,"\t|\t",conversion_check[NAME_KEY])
163+
test_number+=1
164+
165+
if(nb_success == test_number-1):
166+
print("\nSUCCESS: ",nb_success,"/",test_number-1," valid tests")
127167
else:
128-
print("FAIL: ",nb_success,"/",nb_tests," valid tests")
168+
print("\nFAIL: ",nb_success,"/",test_number-1," valid tests")
129169
print("The following test failed:")
130170
print("\n".join(check_fails))
131171

0 commit comments

Comments
 (0)