MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / run_test_set

Function run_test_set

Test/astc_test_image.py:236–286  ·  view source on GitHub ↗

Execute all tests in the test set. Args: encoder: The encoder to test. reference: The reference test results to compare against. test_set: The set of images to test. quality: The quality level to test. block_sizes: The block sizes to test. re

(encoder: te.EncoderBase, reference: Optional[ResultSet],
                 test_set: TestSet, quality: str, block_sizes: list[str],
                 repeats: int, keep_output: bool,
                 threads: Optional[int])

Source from the content-addressed store, hash-verified

234
235
236def run_test_set(encoder: te.EncoderBase, reference: Optional[ResultSet],
237 test_set: TestSet, quality: str, block_sizes: list[str],
238 repeats: int, keep_output: bool,
239 threads: Optional[int]) -> ResultSet:
240 '''
241 Execute all tests in the test set.
242
243 Args:
244 encoder: The encoder to test.
245 reference: The reference test results to compare against.
246 test_set: The set of images to test.
247 quality: The quality level to test.
248 block_sizes: The block sizes to test.
249 repeats: The number of test repeats to run.
250 keep_output: Should the test preserve output images?
251 threads (int or None): The thread count to use, or None to use
252 automatic thread count based on core count of host machine.
253
254 Return:
255 The test results.
256 '''
257 result_set = ResultSet(test_set.name)
258
259 current_test_index = 0
260 max_test_index = count_test_set(test_set, block_sizes)
261
262 title = f'Test Set: {test_set.name} / Encoder: {encoder.name} -{quality}'
263 print(title)
264 print('=' * len(title))
265
266 for block_size in block_sizes:
267 for image in test_set.tests:
268 # 3D block sizes require 3D images
269 if is_3d(block_size) != image.is_3d:
270 continue
271
272 current_test_index += 1
273
274 progress = f'{current_test_index}/{max_test_index}'
275 msg = f'Running {progress} {block_size} {image.file_name} ... '
276 print(msg, end='', flush=True)
277
278 record, report = run_test_image(
279 encoder, reference, image, quality, block_size,
280 repeats, keep_output, threads)
281
282 result_set.add_record(record)
283
284 print(f'\r[{current_test_index:>3}] {report}')
285
286 return result_set
287
288
289def get_encoder_params(encoder_name: str, reference_name: str,

Callers 1

mainFunction · 0.85

Calls 6

add_recordMethod · 0.95
ResultSetClass · 0.90
count_test_setFunction · 0.85
is_3dFunction · 0.85
run_test_imageFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected