| OLD | NEW |
| 1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // This code is licensed under the same terms as WebM: | 3 // This code is licensed under the same terms as WebM: |
| 4 // Software License Agreement: http://www.webmproject.org/license/software/ | 4 // Software License Agreement: http://www.webmproject.org/license/software/ |
| 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ | 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ |
| 6 // ----------------------------------------------------------------------------- | 6 // ----------------------------------------------------------------------------- |
| 7 // | 7 // |
| 8 // Coding tools configuration | 8 // Coding tools configuration |
| 9 // | 9 // |
| 10 // Author: Skal (pascal.massimino@gmail.com) | 10 // Author: Skal (pascal.massimino@gmail.com) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_ENCODER_ABI_VERSION)) { | 24 if (WEBP_ABI_IS_INCOMPATIBLE(version, WEBP_ENCODER_ABI_VERSION)) { |
| 25 return 0; // caller/system version mismatch! | 25 return 0; // caller/system version mismatch! |
| 26 } | 26 } |
| 27 if (config == NULL) return 0; | 27 if (config == NULL) return 0; |
| 28 | 28 |
| 29 config->quality = quality; | 29 config->quality = quality; |
| 30 config->target_size = 0; | 30 config->target_size = 0; |
| 31 config->target_PSNR = 0.; | 31 config->target_PSNR = 0.; |
| 32 config->method = 4; | 32 config->method = 4; |
| 33 config->sns_strength = 50; | 33 config->sns_strength = 50; |
| 34 config->filter_strength = 20; // default: light filtering | 34 config->filter_strength = 60; // rather high filtering, helps w/ gradients. |
| 35 config->filter_sharpness = 0; | 35 config->filter_sharpness = 0; |
| 36 config->filter_type = 0; // default: simple | 36 config->filter_type = 1; // default: strong (so U/V is filtered too) |
| 37 config->partitions = 0; | 37 config->partitions = 0; |
| 38 config->segments = 4; | 38 config->segments = 4; |
| 39 config->pass = 1; | 39 config->pass = 1; |
| 40 config->show_compressed = 0; | 40 config->show_compressed = 0; |
| 41 config->preprocessing = 0; | 41 config->preprocessing = 0; |
| 42 config->autofilter = 0; | 42 config->autofilter = 0; |
| 43 config->partition_limit = 0; | 43 config->partition_limit = 0; |
| 44 config->alpha_compression = 1; | 44 config->alpha_compression = 1; |
| 45 config->alpha_filtering = 1; | 45 config->alpha_filtering = 1; |
| 46 config->alpha_quality = 100; | 46 config->alpha_quality = 100; |
| 47 config->lossless = 0; | 47 config->lossless = 0; |
| 48 config->image_hint = WEBP_HINT_DEFAULT; | 48 config->image_hint = WEBP_HINT_DEFAULT; |
| 49 config->emulate_jpeg_size = 0; |
| 50 config->thread_level = 0; |
| 51 config->low_memory = 0; |
| 49 | 52 |
| 50 // TODO(skal): tune. | 53 // TODO(skal): tune. |
| 51 switch (preset) { | 54 switch (preset) { |
| 52 case WEBP_PRESET_PICTURE: | 55 case WEBP_PRESET_PICTURE: |
| 53 config->sns_strength = 80; | 56 config->sns_strength = 80; |
| 54 config->filter_sharpness = 4; | 57 config->filter_sharpness = 4; |
| 55 config->filter_strength = 35; | 58 config->filter_strength = 35; |
| 56 break; | 59 break; |
| 57 case WEBP_PRESET_PHOTO: | 60 case WEBP_PRESET_PHOTO: |
| 58 config->sns_strength = 80; | 61 config->sns_strength = 80; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 if (config->alpha_compression < 0) | 118 if (config->alpha_compression < 0) |
| 116 return 0; | 119 return 0; |
| 117 if (config->alpha_filtering < 0) | 120 if (config->alpha_filtering < 0) |
| 118 return 0; | 121 return 0; |
| 119 if (config->alpha_quality < 0 || config->alpha_quality > 100) | 122 if (config->alpha_quality < 0 || config->alpha_quality > 100) |
| 120 return 0; | 123 return 0; |
| 121 if (config->lossless < 0 || config->lossless > 1) | 124 if (config->lossless < 0 || config->lossless > 1) |
| 122 return 0; | 125 return 0; |
| 123 if (config->image_hint >= WEBP_HINT_LAST) | 126 if (config->image_hint >= WEBP_HINT_LAST) |
| 124 return 0; | 127 return 0; |
| 128 if (config->emulate_jpeg_size < 0 || config->emulate_jpeg_size > 1) |
| 129 return 0; |
| 130 if (config->thread_level < 0 || config->thread_level > 1) |
| 131 return 0; |
| 132 if (config->low_memory < 0 || config->low_memory > 1) |
| 133 return 0; |
| 125 return 1; | 134 return 1; |
| 126 } | 135 } |
| 127 | 136 |
| 128 //------------------------------------------------------------------------------ | 137 //------------------------------------------------------------------------------ |
| 129 | 138 |
| 130 #if defined(__cplusplus) || defined(c_plusplus) | 139 #if defined(__cplusplus) || defined(c_plusplus) |
| 131 } // extern "C" | 140 } // extern "C" |
| 132 #endif | 141 #endif |
| OLD | NEW |