Lines Matching +full:- +full:- +full:preset +full:- +full:default
3 // Use of this source code is governed by a BSD-style license
8 // -----------------------------------------------------------------------------
45 //------------------------------------------------------------------------------
51 const int use_argb = pic->use_argb; in ReadYUV()
52 const int uv_width = (pic->width + 1) / 2; in ReadYUV()
53 const int uv_height = (pic->height + 1) / 2; in ReadYUV()
54 const int y_plane_size = pic->width * pic->height; in ReadYUV()
65 pic->use_argb = 0; in ReadYUV()
67 ImgIoUtilCopyPlane(data, pic->width, pic->y, pic->y_stride, in ReadYUV()
68 pic->width, pic->height); in ReadYUV()
70 pic->u, pic->uv_stride, uv_width, uv_height); in ReadYUV()
72 pic->v, pic->uv_stride, uv_width, uv_height); in ReadYUV()
83 if (pic->width != 0 && pic->height != 0) { in ReadPicture()
113 if (pic->width == 0 || pic->height == 0) { in ReadPicture()
132 const int mb_w = (pic->width + 15) / 16; in AllocExtraInfo()
133 const int mb_h = (pic->height + 15) / 16; in AllocExtraInfo()
134 pic->extra_info = in AllocExtraInfo()
135 (uint8_t*)WebPMalloc(mb_w * mb_h * sizeof(*pic->extra_info)); in AllocExtraInfo()
169 fprintf(stderr, "Lossless-%s compressed size: %d bytes\n", in PrintFullLosslessInfo()
170 description, stats->lossless_size); in PrintFullLosslessInfo()
172 stats->lossless_hdr_size, stats->lossless_data_size); in PrintFullLosslessInfo()
173 if (stats->lossless_features) { in PrintFullLosslessInfo()
175 if (stats->lossless_features & 1) fprintf(stderr, " PREDICTION"); in PrintFullLosslessInfo()
176 if (stats->lossless_features & 2) fprintf(stderr, " CROSS-COLOR-TRANSFORM"); in PrintFullLosslessInfo()
177 if (stats->lossless_features & 4) fprintf(stderr, " SUBTRACT-GREEN"); in PrintFullLosslessInfo()
178 if (stats->lossless_features & 8) fprintf(stderr, " PALETTE"); in PrintFullLosslessInfo()
182 stats->histogram_bits, stats->transform_bits, stats->cache_bits); in PrintFullLosslessInfo()
183 if (stats->palette_size > 0) { in PrintFullLosslessInfo()
184 fprintf(stderr, " * Palette size: %d\n", stats->palette_size); in PrintFullLosslessInfo()
191 const WebPAuxStats* const stats = pic->stats; in PrintExtraInfoLossless()
193 fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]); in PrintExtraInfoLossless()
196 fprintf(stderr, "Dimension: %d x %d\n", pic->width, pic->height); in PrintExtraInfoLossless()
197 fprintf(stderr, "Output: %d bytes (%.2f bpp)\n", stats->coded_size, in PrintExtraInfoLossless()
198 8.f * stats->coded_size / pic->width / pic->height); in PrintExtraInfoLossless()
206 const WebPAuxStats* const stats = pic->stats; in PrintExtraInfoLossy()
208 fprintf(stderr, "%7d %2.2f\n", stats->coded_size, stats->PSNR[3]); in PrintExtraInfoLossy()
210 const int num_i4 = stats->block_count[0]; in PrintExtraInfoLossy()
211 const int num_i16 = stats->block_count[1]; in PrintExtraInfoLossy()
212 const int num_skip = stats->block_count[2]; in PrintExtraInfoLossy()
216 pic->width, pic->height, in PrintExtraInfoLossy()
217 stats->alpha_data_size ? " (with alpha)" : ""); in PrintExtraInfoLossy()
219 "%d bytes Y-U-V-All-PSNR %2.2f %2.2f %2.2f %2.2f dB\n" in PrintExtraInfoLossy()
221 stats->coded_size, in PrintExtraInfoLossy()
222 stats->PSNR[0], stats->PSNR[1], stats->PSNR[2], stats->PSNR[3], in PrintExtraInfoLossy()
223 8.f * stats->coded_size / pic->width / pic->height); in PrintExtraInfoLossy()
233 " mode-partition: %6d (%.1f%%)\n", in PrintExtraInfoLossy()
234 stats->header_bytes[0], in PrintExtraInfoLossy()
235 100.f * stats->header_bytes[0] / stats->coded_size, in PrintExtraInfoLossy()
236 stats->header_bytes[1], in PrintExtraInfoLossy()
237 100.f * stats->header_bytes[1] / stats->coded_size); in PrintExtraInfoLossy()
238 if (stats->alpha_data_size > 0) { in PrintExtraInfoLossy()
240 stats->alpha_data_size, stats->PSNR[4]); in PrintExtraInfoLossy()
246 fprintf(stderr, " intra4-coeffs: "); in PrintExtraInfoLossy()
247 PrintByteCount(stats->residual_bytes[0], stats->coded_size, totals); in PrintExtraInfoLossy()
248 fprintf(stderr, " intra16-coeffs: "); in PrintExtraInfoLossy()
249 PrintByteCount(stats->residual_bytes[1], stats->coded_size, totals); in PrintExtraInfoLossy()
251 PrintByteCount(stats->residual_bytes[2], stats->coded_size, totals); in PrintExtraInfoLossy()
254 PrintPercents(stats->segment_size); in PrintExtraInfoLossy()
256 PrintValues(stats->segment_quant); in PrintExtraInfoLossy()
258 PrintValues(stats->segment_level); in PrintExtraInfoLossy()
260 fprintf(stderr, "------------------+---------"); in PrintExtraInfoLossy()
261 fprintf(stderr, "+---------+---------+---------+-----------------\n"); in PrintExtraInfoLossy()
263 PrintByteCount(totals, stats->coded_size, NULL); in PrintExtraInfoLossy()
266 if (stats->lossless_size > 0) { in PrintExtraInfoLossy()
273 if (pic->extra_info != NULL) { in PrintMapInfo()
274 const int mb_w = (pic->width + 15) / 16; in PrintMapInfo()
275 const int mb_h = (pic->height + 15) / 16; in PrintMapInfo()
276 const int type = pic->extra_info_type; in PrintMapInfo()
280 const int c = pic->extra_info[x + y * mb_w]; in PrintMapInfo()
284 fprintf(stderr, "%c", ".-*X"[c]); in PrintMapInfo()
298 //------------------------------------------------------------------------------
302 FILE* const out = (FILE*)pic->custom_ptr; in MyWriter()
310 const int uv_width = (picture->width + 1) / 2; in DumpPicture()
311 const int uv_height = (picture->height + 1) / 2; in DumpPicture()
312 const int stride = (picture->width + 1) & ~1; in DumpPicture()
313 const uint8_t* src_y = picture->y; in DumpPicture()
314 const uint8_t* src_u = picture->u; in DumpPicture()
315 const uint8_t* src_v = picture->v; in DumpPicture()
316 const uint8_t* src_a = picture->a; in DumpPicture()
318 WebPPictureHasTransparency(picture) ? picture->height : 0; in DumpPicture()
319 const int height = picture->height + uv_height + alpha_height; in DumpPicture()
323 for (y = 0; y < picture->height; ++y) { in DumpPicture()
324 if (fwrite(src_y, picture->width, 1, f) != 1) goto Error; in DumpPicture()
325 if (picture->width & 1) fputc(0, f); // pad in DumpPicture()
326 src_y += picture->y_stride; in DumpPicture()
331 src_u += picture->uv_stride; in DumpPicture()
332 src_v += picture->uv_stride; in DumpPicture()
335 if (fwrite(src_a, picture->width, 1, f) != 1) goto Error; in DumpPicture()
336 if (picture->width & 1) fputc(0, f); // pad in DumpPicture()
337 src_a += picture->a_stride; in DumpPicture()
346 // -----------------------------------------------------------------------------
365 fprintf(stderr, " * ICC profile: %6d bytes\n", (int)metadata->iccp.size); in PrintMetadataInfo()
368 fprintf(stderr, " * EXIF data: %6d bytes\n", (int)metadata->exif.size); in PrintMetadataInfo()
371 fprintf(stderr, " * XMP data: %6d bytes\n", (int)metadata->xmp.size); in PrintMetadataInfo()
397 const size_t need_padding = payload->size & 1; in WriteMetadataChunk()
399 ok = ok && WriteLE32(out, (uint32_t)payload->size); in WriteMetadataChunk()
400 ok = ok && (fwrite(payload->bytes, payload->size, 1, out) == 1); in WriteMetadataChunk()
409 if (keep && payload->bytes != NULL && payload->size > 0) { in UpdateFlagsAndSize()
411 *metadata_size += kChunkHeaderSize + payload->size + (payload->size & 1); in UpdateFlagsAndSize()
420 // For details see doc/webp-container-spec.txt#extended-file-format.
433 const size_t kMaxChunkPayload = ~0 - kChunkHeaderSize - 1; in WriteWebPWithMetadata()
437 const int write_exif = UpdateFlagsAndSize(&metadata->exif, in WriteWebPWithMetadata()
440 const int write_iccp = UpdateFlagsAndSize(&metadata->iccp, in WriteWebPWithMetadata()
443 const int write_xmp = UpdateFlagsAndSize(&metadata->xmp, in WriteWebPWithMetadata()
446 uint8_t* webp = memory_writer->mem; in WriteWebPWithMetadata()
447 size_t webp_size = memory_writer->size; in WriteWebPWithMetadata()
452 if (webp_size - kChunkHeaderSize + metadata_size > kMaxChunkPayload) { in WriteWebPWithMetadata()
461 const uint32_t riff_size = (uint32_t)(webp_size - kChunkHeaderSize + in WriteWebPWithMetadata()
469 webp_size -= kChunkHeaderSize; in WriteWebPWithMetadata()
473 webp_size -= kTagSize; in WriteWebPWithMetadata()
478 webp_size -= kVP8XChunkSize; in WriteWebPWithMetadata()
488 ok = ok && WriteLE24(out, picture->width - 1); in WriteWebPWithMetadata()
489 ok = ok && WriteLE24(out, picture->height - 1); in WriteWebPWithMetadata()
492 ok = ok && WriteMetadataChunk(out, "ICCP", &metadata->iccp); in WriteWebPWithMetadata()
498 ok = ok && WriteMetadataChunk(out, "EXIF", &metadata->exif); in WriteWebPWithMetadata()
502 ok = ok && WriteMetadataChunk(out, "XMP ", &metadata->xmp); in WriteWebPWithMetadata()
512 //------------------------------------------------------------------------------
516 (char*)picture->user_data, percent); in ProgressReport()
520 //------------------------------------------------------------------------------
524 printf(" cwebp [options] -q quality input.png -o output.webp\n\n"); in HelpShort()
527 printf("Try -longhelp for an exhaustive list of advanced options.\n"); in HelpShort()
532 printf(" cwebp [-preset <...>] [options] in_file [-o out_file]\n\n"); in HelpLong()
533 printf("If input size (-s) for an image is not specified, it is\n" in HelpLong()
540 printf(" -h / -help ............. short help\n"); in HelpLong()
541 printf(" -H / -longhelp ......... long help\n"); in HelpLong()
542 printf(" -q <float> ............. quality factor (0:small..100:big), " in HelpLong()
543 "default=75\n"); in HelpLong()
544 printf(" -alpha_q <int> ......... transparency-compression quality (0..100)," in HelpLong()
545 "\n default=100\n"); in HelpLong()
546 printf(" -preset <string> ....... preset setting, one of:\n"); in HelpLong()
547 printf(" default, photo, picture,\n"); in HelpLong()
549 printf(" -preset must come first, as it overwrites other parameters\n"); in HelpLong()
550 printf(" -z <int> ............... activates lossless preset with given\n" in HelpLong()
553 printf(" -m <int> ............... compression method (0=fast, 6=slowest), " in HelpLong()
554 "default=4\n"); in HelpLong()
555 printf(" -segments <int> ........ number of segments to use (1..4), " in HelpLong()
556 "default=4\n"); in HelpLong()
557 printf(" -size <int> ............ target size (in bytes)\n"); in HelpLong()
558 printf(" -psnr <float> .......... target PSNR (in dB. typically: 42)\n"); in HelpLong()
560 printf(" -s <int> <int> ......... input size (width x height) for YUV\n"); in HelpLong()
561 printf(" -sns <int> ............. spatial noise shaping (0:off, 100:max), " in HelpLong()
562 "default=50\n"); in HelpLong()
563 printf(" -f <int> ............... filter strength (0=off..100), " in HelpLong()
564 "default=60\n"); in HelpLong()
565 printf(" -sharpness <int> ....... " in HelpLong()
566 "filter sharpness (0:most .. 7:least sharp), default=0\n"); in HelpLong()
567 printf(" -strong ................ use strong filter instead " in HelpLong()
568 "of simple (default)\n"); in HelpLong()
569 printf(" -nostrong .............. use simple filter instead of strong\n"); in HelpLong()
570 printf(" -sharp_yuv ............. use sharper (and slower) RGB->YUV " in HelpLong()
572 printf(" -partition_limit <int> . limit quality to fit the 512k limit on\n"); in HelpLong()
575 printf(" -pass <int> ............ analysis pass number (1..10)\n"); in HelpLong()
576 printf(" -qrange <min> <max> .... specifies the permissible quality range\n" in HelpLong()
577 " (default: 0 100)\n"); in HelpLong()
578 printf(" -crop <x> <y> <w> <h> .. crop picture with the given rectangle\n"); in HelpLong()
579 printf(" -resize <w> <h> ........ resize picture (*after* any cropping)\n"); in HelpLong()
580 printf(" -mt .................... use multi-threading if available\n"); in HelpLong()
581 printf(" -low_memory ............ reduce memory usage (slower encoding)\n"); in HelpLong()
582 printf(" -map <int> ............. print map of extra info\n"); in HelpLong()
583 printf(" -print_psnr ............ prints averaged PSNR distortion\n"); in HelpLong()
584 printf(" -print_ssim ............ prints averaged SSIM distortion\n"); in HelpLong()
585 printf(" -print_lsim ............ prints local-similarity distortion\n"); in HelpLong()
586 printf(" -d <file.pgm> .......... dump the compressed output (PGM file)\n"); in HelpLong()
587 printf(" -alpha_method <int> .... transparency-compression method (0..1), " in HelpLong()
588 "default=1\n"); in HelpLong()
589 printf(" -alpha_filter <string> . predictive filtering for alpha plane,\n"); in HelpLong()
590 printf(" one of: none, fast (default) or best\n"); in HelpLong()
591 printf(" -exact ................. preserve RGB values in transparent area, " in HelpLong()
592 "default=off\n"); in HelpLong()
593 printf(" -blend_alpha <hex> ..... blend colors against background color\n" in HelpLong()
597 printf(" -noalpha ............... discard any transparency information\n"); in HelpLong()
598 printf(" -lossless .............. encode image losslessly, default=off\n"); in HelpLong()
599 printf(" -near_lossless <int> ... use near-lossless image preprocessing\n" in HelpLong()
600 " (0..100=off), default=100\n"); in HelpLong()
601 printf(" -hint <string> ......... specify image characteristics hint,\n"); in HelpLong()
605 printf(" -metadata <string> ..... comma separated list of metadata to\n"); in HelpLong()
609 "Valid values: all, none (default), exif, icc, xmp\n"); in HelpLong()
612 printf(" -short ................. condense printed message\n"); in HelpLong()
613 printf(" -quiet ................. don't print anything\n"); in HelpLong()
614 printf(" -version ............... print version number and exit\n"); in HelpLong()
616 printf(" -noasm ................. disable all assembly optimizations\n"); in HelpLong()
618 printf(" -v ..................... verbose, e.g. print encoding/decoding " in HelpLong()
620 printf(" -progress .............. report encoding progress\n"); in HelpLong()
623 printf(" -jpeg_like ............. roughly match expected JPEG size\n"); in HelpLong()
624 printf(" -af .................... auto-adjust filter strength\n"); in HelpLong()
625 printf(" -pre <int> ............. pre-processing filter\n"); in HelpLong()
630 //------------------------------------------------------------------------------
636 "BITSTREAM_OUT_OF_MEMORY: Out of memory re-allocating byte buffer",
643 "with the -segments option, and eventually reduce the number of "
644 "header bits using -partition_limit. More details are available "
652 //------------------------------------------------------------------------------
655 int return_value = -1; in main()
667 int use_lossless_preset = -1; // -1=unset, 0=don't use, 1=use it in main()
672 int print_distortion = -1; // -1=off, 0=PSNR, 1=SSIM, 2=LSIM in main()
689 FREE_WARGV_AND_RETURN(-1); in main()
699 if (!strcmp(argv[c], "-h") || !strcmp(argv[c], "-help")) { in main()
702 } else if (!strcmp(argv[c], "-H") || !strcmp(argv[c], "-longhelp")) { in main()
705 } else if (!strcmp(argv[c], "-o") && c + 1 < argc) { in main()
707 } else if (!strcmp(argv[c], "-d") && c + 1 < argc) { in main()
710 } else if (!strcmp(argv[c], "-print_psnr")) { in main()
713 } else if (!strcmp(argv[c], "-print_ssim")) { in main()
716 } else if (!strcmp(argv[c], "-print_lsim")) { in main()
719 } else if (!strcmp(argv[c], "-short")) { in main()
721 } else if (!strcmp(argv[c], "-s") && c + 2 < argc) { in main()
731 } else if (!strcmp(argv[c], "-m") && c + 1 < argc) { in main()
733 use_lossless_preset = 0; // disable -z option in main()
734 } else if (!strcmp(argv[c], "-q") && c + 1 < argc) { in main()
736 use_lossless_preset = 0; // disable -z option in main()
737 } else if (!strcmp(argv[c], "-z") && c + 1 < argc) { in main()
740 } else if (!strcmp(argv[c], "-alpha_q") && c + 1 < argc) { in main()
742 } else if (!strcmp(argv[c], "-alpha_method") && c + 1 < argc) { in main()
744 } else if (!strcmp(argv[c], "-alpha_cleanup")) { in main()
745 // This flag is obsolete, does opposite of -exact. in main()
747 } else if (!strcmp(argv[c], "-exact")) { in main()
749 } else if (!strcmp(argv[c], "-blend_alpha") && c + 1 < argc) { in main()
754 } else if (!strcmp(argv[c], "-alpha_filter") && c + 1 < argc) { in main()
766 } else if (!strcmp(argv[c], "-noalpha")) { in main()
768 } else if (!strcmp(argv[c], "-lossless")) { in main()
770 } else if (!strcmp(argv[c], "-near_lossless") && c + 1 < argc) { in main()
772 config.lossless = 1; // use near-lossless only with lossless in main()
773 } else if (!strcmp(argv[c], "-hint") && c + 1 < argc) { in main()
785 } else if (!strcmp(argv[c], "-size") && c + 1 < argc) { in main()
787 } else if (!strcmp(argv[c], "-psnr") && c + 1 < argc) { in main()
789 } else if (!strcmp(argv[c], "-sns") && c + 1 < argc) { in main()
791 } else if (!strcmp(argv[c], "-f") && c + 1 < argc) { in main()
793 } else if (!strcmp(argv[c], "-af")) { in main()
795 } else if (!strcmp(argv[c], "-jpeg_like")) { in main()
797 } else if (!strcmp(argv[c], "-mt")) { in main()
799 } else if (!strcmp(argv[c], "-low_memory")) { in main()
801 } else if (!strcmp(argv[c], "-strong")) { in main()
803 } else if (!strcmp(argv[c], "-nostrong")) { in main()
805 } else if (!strcmp(argv[c], "-sharpness") && c + 1 < argc) { in main()
807 } else if (!strcmp(argv[c], "-sharp_yuv")) { in main()
809 } else if (!strcmp(argv[c], "-pass") && c + 1 < argc) { in main()
811 } else if (!strcmp(argv[c], "-qrange") && c + 2 < argc) { in main()
816 } else if (!strcmp(argv[c], "-pre") && c + 1 < argc) { in main()
818 } else if (!strcmp(argv[c], "-segments") && c + 1 < argc) { in main()
820 } else if (!strcmp(argv[c], "-partition_limit") && c + 1 < argc) { in main()
822 } else if (!strcmp(argv[c], "-map") && c + 1 < argc) { in main()
824 } else if (!strcmp(argv[c], "-crop") && c + 4 < argc) { in main()
830 } else if (!strcmp(argv[c], "-resize") && c + 2 < argc) { in main()
834 } else if (!strcmp(argv[c], "-noasm")) { in main()
837 } else if (!strcmp(argv[c], "-version")) { in main()
846 } else if (!strcmp(argv[c], "-progress")) { in main()
848 } else if (!strcmp(argv[c], "-quiet")) { in main()
850 } else if (!strcmp(argv[c], "-preset") && c + 1 < argc) { in main()
851 WebPPreset preset; in main() local
853 if (!strcmp(argv[c], "default")) { in main()
854 preset = WEBP_PRESET_DEFAULT; in main()
856 preset = WEBP_PRESET_PHOTO; in main()
858 preset = WEBP_PRESET_PICTURE; in main()
860 preset = WEBP_PRESET_DRAWING; in main()
862 preset = WEBP_PRESET_ICON; in main()
864 preset = WEBP_PRESET_TEXT; in main()
866 fprintf(stderr, "Error! Unrecognized preset: %s\n", argv[c]); in main()
869 if (!WebPConfigPreset(&config, preset, config.quality)) { in main()
870 fprintf(stderr, "Error! Could initialize configuration with preset.\n"); in main()
873 } else if (!strcmp(argv[c], "-metadata") && c + 1 < argc) { in main()
894 if ((size_t)(token - start) == strlen(kTokens[i].option) && in main()
906 (int)(token - start), start); in main()
907 FREE_WARGV_AND_RETURN(-1); in main()
913 // TODO(jzern): remove when -metadata is supported on all platforms. in main()
918 } else if (!strcmp(argv[c], "-v")) { in main()
920 } else if (!strcmp(argv[c], "--")) { in main()
923 } else if (argv[c][0] == '-') { in main()
926 FREE_WARGV_AND_RETURN(-1); in main()
933 FREE_WARGV_AND_RETURN(-1); in main()
944 fprintf(stderr, "Invalid lossless preset (-z %d)\n", lossless_preset); in main()
961 // If a target size or PSNR was given, but somehow the -pass option was in main()
998 // before writing it to a file/stream, and/or when the near-losslessly encoded in main()
1008 const int use_stdout = !WSTRCMP(out_file, "-"); in main()
1033 fprintf(stderr, "No output file specified (no -o flag). Encoding will\n"); in main()
1047 // We use self-cropping using a view. in main()
1056 // If -exact, we can't premultiply RGB by A otherwise RGB is lost if A=0. in main()
1057 // We rescale an opaque copy and assemble scaled A and non-premultiplied in main()
1111 // not modify 'picture' (even near-lossless). in main()
1168 fprintf(stderr, "Warning: can't dump file (-d option) " in main()
1195 for (iter = info; iter->payload != NULL; ++iter) { in main()
1196 if (UpdateFlagsAndSize(iter->payload, !!(keep_metadata & iter->flag), in main()
1198 metadata_written |= iter->flag; in main()
1227 fprintf(stderr, "%7d %.4f\n", picture.stats->coded_size, values[4]); in main()
1249 //------------------------------------------------------------------------------