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

Function run_test_image

Test/astc_test_image.py:196–233  ·  view source on GitHub ↗

Execute one test image in the test set. Args: encoder: The encoder to test. reference: The reference test results to compare against. image: The single image to test. quality: The quality level to test. block_size: The block size to test. rep

(encoder: te.EncoderBase, reference: Optional[ResultSet],
                   image: TestImage, quality: str, block_size: str,
                   repeats: int, keep_output: bool,
                   threads: Optional[int])

Source from the content-addressed store, hash-verified

194
195
196def run_test_image(encoder: te.EncoderBase, reference: Optional[ResultSet],
197 image: TestImage, quality: str, block_size: str,
198 repeats: int, keep_output: bool,
199 threads: Optional[int]) -> tuple[Record, str]:
200 '''
201 Execute one test image in the test set.
202
203 Args:
204 encoder: The encoder to test.
205 reference: The reference test results to compare against.
206 image: The single image to test.
207 quality: The quality level to test.
208 block_size: The block size to test.
209 repeats: The number of test repeats to run.
210 keep_output: Should the test preserve output images?
211 threads (int or None): The thread count to use, or None to use
212 automatic thread count based on core count of host machine.
213
214 Return:
215 The test results, passed as a test record and a formatted log line
216 to emit.
217 '''
218 res = encoder.run_test(
219 image, block_size, f'-{quality}', repeats,
220 keep_output, threads)
221
222 record = Record(block_size, image.file_name, *res)
223
224 if reference:
225 record_ref = reference.get_matching_record(record)
226 record.set_status(determine_result(image, record_ref, record))
227 record.set_relative_to_reference(record_ref)
228
229 report = format_compare_result(image, record_ref, record)
230 else:
231 report = format_solo_result(image, record)
232
233 return (record, report)
234
235
236def run_test_set(encoder: te.EncoderBase, reference: Optional[ResultSet],

Callers 1

run_test_setFunction · 0.85

Calls 8

set_statusMethod · 0.95
RecordClass · 0.90
determine_resultFunction · 0.85
format_compare_resultFunction · 0.85
format_solo_resultFunction · 0.85
run_testMethod · 0.80
get_matching_recordMethod · 0.80

Tested by

no test coverage detected