| OLD | NEW |
| 1 // Copyright 2011 Google Inc. All Rights Reserved. | 1 // Copyright 2011 Google Inc. All Rights Reserved. |
| 2 // | 2 // |
| 3 // Use of this source code is governed by a BSD-style license | 3 // Use of this source code is governed by a BSD-style license |
| 4 // that can be found in the COPYING file in the root of the source | 4 // that can be found in the COPYING file in the root of the source |
| 5 // tree. An additional intellectual property rights grant can be found | 5 // tree. An additional intellectual property rights grant can be found |
| 6 // in the file PATENTS. All contributing project authors may | 6 // in the file PATENTS. All contributing project authors may |
| 7 // be found in the AUTHORS file in the root of the source tree. | 7 // be found in the AUTHORS file in the root of the source tree. |
| 8 // ----------------------------------------------------------------------------- | 8 // ----------------------------------------------------------------------------- |
| 9 // | 9 // |
| 10 // WebP encoder: main entry point | 10 // WebP encoder: main entry point |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const int limit = 100 - config->partition_limit; | 98 const int limit = 100 - config->partition_limit; |
| 99 enc->method_ = method; | 99 enc->method_ = method; |
| 100 enc->rd_opt_level_ = (method >= 6) ? RD_OPT_TRELLIS_ALL | 100 enc->rd_opt_level_ = (method >= 6) ? RD_OPT_TRELLIS_ALL |
| 101 : (method >= 5) ? RD_OPT_TRELLIS | 101 : (method >= 5) ? RD_OPT_TRELLIS |
| 102 : (method >= 3) ? RD_OPT_BASIC | 102 : (method >= 3) ? RD_OPT_BASIC |
| 103 : RD_OPT_NONE; | 103 : RD_OPT_NONE; |
| 104 enc->max_i4_header_bits_ = | 104 enc->max_i4_header_bits_ = |
| 105 256 * 16 * 16 * // upper bound: up to 16bit per 4x4 block | 105 256 * 16 * 16 * // upper bound: up to 16bit per 4x4 block |
| 106 (limit * limit) / (100 * 100); // ... modulated with a quadratic curve. | 106 (limit * limit) / (100 * 100); // ... modulated with a quadratic curve. |
| 107 | 107 |
| 108 // partition0 = 512k max. |
| 109 enc->mb_header_limit_ = |
| 110 (score_t)256 * 510 * 8 * 1024 / (enc->mb_w_ * enc->mb_h_); |
| 111 |
| 108 enc->thread_level_ = config->thread_level; | 112 enc->thread_level_ = config->thread_level; |
| 109 | 113 |
| 110 enc->do_search_ = (config->target_size > 0 || config->target_PSNR > 0); | 114 enc->do_search_ = (config->target_size > 0 || config->target_PSNR > 0); |
| 111 if (!config->low_memory) { | 115 if (!config->low_memory) { |
| 112 #if !defined(DISABLE_TOKEN_BUFFER) | 116 #if !defined(DISABLE_TOKEN_BUFFER) |
| 113 enc->use_tokens_ = (enc->rd_opt_level_ >= RD_OPT_BASIC); // need rd stats | 117 enc->use_tokens_ = (enc->rd_opt_level_ >= RD_OPT_BASIC); // need rd stats |
| 114 #endif | 118 #endif |
| 115 if (enc->use_tokens_) { | 119 if (enc->use_tokens_) { |
| 116 enc->num_parts_ = 1; // doesn't work with multi-partition | 120 enc->num_parts_ = 1; // doesn't work with multi-partition |
| 117 } | 121 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 386 |
| 383 if (!config->exact) { | 387 if (!config->exact) { |
| 384 WebPCleanupTransparentAreaLossless(pic); | 388 WebPCleanupTransparentAreaLossless(pic); |
| 385 } | 389 } |
| 386 | 390 |
| 387 ok = VP8LEncodeImage(config, pic); // Sets pic->error in case of problem. | 391 ok = VP8LEncodeImage(config, pic); // Sets pic->error in case of problem. |
| 388 } | 392 } |
| 389 | 393 |
| 390 return ok; | 394 return ok; |
| 391 } | 395 } |
| OLD | NEW |