* @brief Parse the command line. * * @param argc Command line argument count. * @param[in] argv Command line argument vector. * @param[out] operation Codec operation mode. * @param[out] profile Codec color profile. * * @return 0 if everything is okay, 1 if there is some error */
| 462 | * @return 0 if everything is okay, 1 if there is some error |
| 463 | */ |
| 464 | static int parse_commandline_options( |
| 465 | int argc, |
| 466 | char **argv, |
| 467 | astcenc_operation& operation, |
| 468 | astcenc_profile& profile |
| 469 | ) { |
| 470 | assert(argc >= 2); (void)argc; |
| 471 | |
| 472 | profile = ASTCENC_PRF_LDR; |
| 473 | operation = ASTCENC_OP_UNKNOWN; |
| 474 | |
| 475 | int modes_count = sizeof(modes) / sizeof(modes[0]); |
| 476 | for (int i = 0; i < modes_count; i++) |
| 477 | { |
| 478 | if (!strcmp(modes[i].opt, argv[1])) |
| 479 | { |
| 480 | operation = modes[i].operation; |
| 481 | profile = modes[i].decode_mode; |
| 482 | break; |
| 483 | } |
| 484 | } |
| 485 | |
| 486 | if (operation == ASTCENC_OP_UNKNOWN) |
| 487 | { |
| 488 | print_error("ERROR: Unrecognized operation '%s'\n", argv[1]); |
| 489 | return 1; |
| 490 | } |
| 491 | |
| 492 | return 0; |
| 493 | } |
| 494 | |
| 495 | /** |
| 496 | * @brief Initialize the astcenc_config |
no test coverage detected