Parse the command line. Return: Namespace: The parsed command line container.
()
| 334 | |
| 335 | |
| 336 | def parse_command_line(): |
| 337 | ''' |
| 338 | Parse the command line. |
| 339 | |
| 340 | Return: |
| 341 | Namespace: The parsed command line container. |
| 342 | ''' |
| 343 | parser = argparse.ArgumentParser() |
| 344 | |
| 345 | # All reference encoders |
| 346 | reference_encoders = [ |
| 347 | 'ref-5.0-neon', |
| 348 | 'ref-5.0-sse2', 'ref-5.0-sse4.1', 'ref-5.0-avx2', |
| 349 | |
| 350 | 'ref-main-neon', 'ref-main-sve_256', 'ref-main-sve_128', |
| 351 | 'ref-main-sse2', 'ref-main-sse4.1', 'ref-main-avx2' |
| 352 | ] |
| 353 | |
| 354 | # All test encoders |
| 355 | test_encoders = [ |
| 356 | 'none', 'native', 'universal', |
| 357 | 'neon', 'sve_256', 'sve_128', |
| 358 | 'sse2', 'sse4.1', 'avx2' |
| 359 | ] |
| 360 | |
| 361 | test_encoders_arm64 = [ |
| 362 | 'neon', 'sve_256', 'sve_128' |
| 363 | ] |
| 364 | |
| 365 | test_encoders_x86 = [ |
| 366 | 'sse2', 'sse4.1', 'avx2' |
| 367 | ] |
| 368 | |
| 369 | encoder_choices = reference_encoders + test_encoders |
| 370 | encoder_choices.append('all-aarch64') |
| 371 | encoder_choices.append('all-x86') |
| 372 | |
| 373 | parser.add_argument('--encoder', dest='encoders', default='avx2', |
| 374 | choices=encoder_choices, help='test encoder variant') |
| 375 | |
| 376 | parser.add_argument('--reference', default='ref-main-avx2', |
| 377 | choices=reference_encoders, |
| 378 | help='reference encoder variant') |
| 379 | |
| 380 | profile_choices = ['ldr', 'ldrs', 'hdr', 'all'] |
| 381 | parser.add_argument('--color-profile', dest='profiles', default='all', |
| 382 | choices=profile_choices, help='test color profile') |
| 383 | |
| 384 | format_choices = ['l', 'xy', 'rgb', 'rgba', 'all'] |
| 385 | parser.add_argument('--color-format', dest='formats', default='all', |
| 386 | choices=format_choices, help='test color format') |
| 387 | |
| 388 | block_size_choices = list(TEST_BLOCK_SIZES) + ['all'] |
| 389 | parser.add_argument('--block-size', dest='block_sizes', action='append', |
| 390 | choices=block_size_choices, help='test block size') |
| 391 | |
| 392 | test_dir = Path(__file__).parent / 'Images' |
| 393 |