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

Method build_cli

Test/testlib/encoder.py:294–333  ·  view source on GitHub ↗
(self, image, block_size='6x6', preset='-thorough',
                  keep_output=True, threads=None)

Source from the content-addressed store, hash-verified

292 super().__init__(name, variant, binary_path)
293
294 def build_cli(self, image, block_size='6x6', preset='-thorough',
295 keep_output=True, threads=None):
296 operation = self.remap_color_switches[image.color_profile]
297
298 src_path = image.file_path
299
300 if keep_output:
301 extension = self.remap_output_types[image.color_profile]
302
303 dst_file = f'{image.file_path_out.stem}{extension}'
304
305 dst_dir = image.file_path_out.parent
306 dst_dir = dst_dir / self.name / preset[1:] / block_size
307 dst_dir.mkdir(parents=True, exist_ok=True)
308
309 dst_path = str(dst_dir / dst_file)
310
311 else:
312 if sys.platform == 'win32':
313 dst_path = 'nul'
314 else:
315 dst_path = '/dev/null'
316
317 command = [
318 str(self.binary_path), operation, str(src_path), str(dst_path),
319 block_size, preset, '-silent'
320 ]
321
322 if image.color_format == 'xy':
323 command.append('-normal')
324
325 if image.is_alpha_scaled:
326 command.append('-a')
327 command.append('1')
328
329 if threads is not None:
330 command.append('-j')
331 command.append(f'{threads}')
332
333 return command
334
335 def get_psnr_pattern(self, image: TestImage) -> re.Pattern:
336 # HDR profile

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected