int main(int argc, char *argv[]) { int c; WebPDecoderConfig* const config = &kParams.config; WebPIterator* const curr = &kParams.curr_frame; WebPIterator* const prev = &kParams.prev_frame; if (!WebPInitDecoderConfig(config)) { fprintf(stderr, "Library version mismatch!\n"); return -1; } config->options.dithering_strength = 50; config->options.alpha_dithering_strength = 100; kParams.use_color_profile = 1; for (c = 1; c < argc; ++c) { int parse_error = 0; if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); return 0; } else if (!strcmp(argv[c], "-noicc")) { kParams.use_color_profile = 0; } else if (!strcmp(argv[c], "-nofancy")) { config->options.no_fancy_upsampling = 1; } else if (!strcmp(argv[c], "-nofilter")) { config->options.bypass_filtering = 1; } else if (!strcmp(argv[c], "-noalphadither")) { config->options.alpha_dithering_strength = 0; } else if (!strcmp(argv[c], "-dither") && c + 1 < argc) { config->options.dithering_strength = ExUtilGetInt(argv[++c], 0, &parse_error); } else if (!strcmp(argv[c], "-info")) { kParams.print_info = 1; } else if (!strcmp(argv[c], "-version")) { const int dec_version = WebPGetDecoderVersion(); const int dmux_version = WebPGetDemuxVersion(); printf("WebP Decoder version: %d.%d.%d\nWebP Demux version: %d.%d.%d\n", (dec_version >> 16) & 0xff, (dec_version >> 8) & 0xff, dec_version & 0xff, (dmux_version >> 16) & 0xff, (dmux_version >> 8) & 0xff, dmux_version & 0xff); return 0; } else if (!strcmp(argv[c], "-mt")) { config->options.use_threads = 1; } else if (!strcmp(argv[c], "--")) { if (c < argc - 1) kParams.file_name = argv[++c]; break; } else if (argv[c][0] == '-') { printf("Unknown option '%s'\n", argv[c]); Help(); return -1; } else { kParams.file_name = argv[c]; } if (parse_error) { Help(); return -1; } }
int main(int argc, char *argv[]) { WebPDecoderConfig config; int c; if (!WebPInitDecoderConfig(&config)) { fprintf(stderr, "Library version mismatch!\n"); return -1; } kParams.config = &config; kParams.use_color_profile = 1; for (c = 1; c < argc; ++c) { if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { Help(); return 0; } else if (!strcmp(argv[c], "-noicc")) { kParams.use_color_profile = 0; } else if (!strcmp(argv[c], "-nofancy")) { config.options.no_fancy_upsampling = 1; } else if (!strcmp(argv[c], "-nofilter")) { config.options.bypass_filtering = 1; } else if (!strcmp(argv[c], "-info")) { kParams.print_info = 1; } else if (!strcmp(argv[c], "-version")) { const int dec_version = WebPGetDecoderVersion(); const int dmux_version = WebPGetDemuxVersion(); printf("WebP Decoder version: %d.%d.%d\nWebP Demux version: %d.%d.%d\n", (dec_version >> 16) & 0xff, (dec_version >> 8) & 0xff, dec_version & 0xff, (dmux_version >> 16) & 0xff, (dmux_version >> 8) & 0xff, dmux_version & 0xff); return 0; } else if (!strcmp(argv[c], "-mt")) { config.options.use_threads = 1; } else if (argv[c][0] == '-') { printf("Unknown option '%s'\n", argv[c]); Help(); return -1; } else { kParams.file_name = argv[c]; } }