| OLD | NEW |
| 1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
| 2 // | 2 // |
| 3 /// \file lz_encoder.c | 3 /// \file lz_encoder.c |
| 4 /// \brief LZ in window | 4 /// \brief LZ in window |
| 5 /// | 5 /// |
| 6 // Authors: Igor Pavlov | 6 // Authors: Igor Pavlov |
| 7 // Lasse Collin | 7 // Lasse Collin |
| 8 // | 8 // |
| 9 // This file has been put into the public domain. | 9 // This file has been put into the public domain. |
| 10 // You can do whatever you want with this file. | 10 // You can do whatever you want with this file. |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // Deallocate the old hash array if it exists and has different size | 342 // Deallocate the old hash array if it exists and has different size |
| 343 // than what is needed now. | 343 // than what is needed now. |
| 344 if (old_count != new_count) { | 344 if (old_count != new_count) { |
| 345 lzma_free(mf->hash, allocator); | 345 lzma_free(mf->hash, allocator); |
| 346 mf->hash = NULL; | 346 mf->hash = NULL; |
| 347 } | 347 } |
| 348 | 348 |
| 349 // Maximum number of match finder cycles | 349 // Maximum number of match finder cycles |
| 350 mf->depth = lz_options->depth; | 350 mf->depth = lz_options->depth; |
| 351 if (mf->depth == 0) { | 351 if (mf->depth == 0) { |
| 352 » » mf->depth = 16 + (mf->nice_len / 2); | 352 » » if (is_bt) |
| 353 » » if (!is_bt) | 353 » » » mf->depth = 16 + mf->nice_len / 2; |
| 354 » » » mf->depth /= 2; | 354 » » else |
| 355 » » » mf->depth = 4 + mf->nice_len / 4; |
| 355 } | 356 } |
| 356 | 357 |
| 357 return false; | 358 return false; |
| 358 } | 359 } |
| 359 | 360 |
| 360 | 361 |
| 361 static bool | 362 static bool |
| 362 lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, | 363 lz_encoder_init(lzma_mf *mf, lzma_allocator *allocator, |
| 363 const lzma_lz_options *lz_options) | 364 const lzma_lz_options *lz_options) |
| 364 { | 365 { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 else | 473 else |
| 473 lzma_free(coder->lz.coder, allocator); | 474 lzma_free(coder->lz.coder, allocator); |
| 474 | 475 |
| 475 lzma_free(coder, allocator); | 476 lzma_free(coder, allocator); |
| 476 return; | 477 return; |
| 477 } | 478 } |
| 478 | 479 |
| 479 | 480 |
| 480 static lzma_ret | 481 static lzma_ret |
| 481 lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator, | 482 lz_encoder_update(lzma_coder *coder, lzma_allocator *allocator, |
| 482 » » const lzma_filter *filters_null lzma_attribute((unused)), | 483 » » const lzma_filter *filters_null lzma_attribute((__unused__)), |
| 483 const lzma_filter *reversed_filters) | 484 const lzma_filter *reversed_filters) |
| 484 { | 485 { |
| 485 if (coder->lz.options_update == NULL) | 486 if (coder->lz.options_update == NULL) |
| 486 return LZMA_PROG_ERROR; | 487 return LZMA_PROG_ERROR; |
| 487 | 488 |
| 488 return_if_error(coder->lz.options_update( | 489 return_if_error(coder->lz.options_update( |
| 489 coder->lz.coder, reversed_filters)); | 490 coder->lz.coder, reversed_filters)); |
| 490 | 491 |
| 491 return lzma_next_filter_update( | 492 return lzma_next_filter_update( |
| 492 &coder->next, allocator, reversed_filters + 1); | 493 &coder->next, allocator, reversed_filters + 1); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 ret = true; | 574 ret = true; |
| 574 #endif | 575 #endif |
| 575 | 576 |
| 576 #ifdef HAVE_MF_BT4 | 577 #ifdef HAVE_MF_BT4 |
| 577 if (mf == LZMA_MF_BT4) | 578 if (mf == LZMA_MF_BT4) |
| 578 ret = true; | 579 ret = true; |
| 579 #endif | 580 #endif |
| 580 | 581 |
| 581 return ret; | 582 return ret; |
| 582 } | 583 } |
| OLD | NEW |