OLD | NEW |
1 /////////////////////////////////////////////////////////////////////////////// | 1 /////////////////////////////////////////////////////////////////////////////// |
2 // | 2 // |
3 /// \file lzma_encoder.c | 3 /// \file lzma_encoder.c |
4 /// \brief LZMA encoder | 4 /// \brief LZMA encoder |
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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // everything out from the range encoder. For the same reason, | 327 // everything out from the range encoder. For the same reason, |
328 // rc_encode() never returns true when this function is used | 328 // rc_encode() never returns true when this function is used |
329 // as part of LZMA2 encoder. | 329 // as part of LZMA2 encoder. |
330 if (rc_encode(&coder->rc, out, out_pos, out_size)) { | 330 if (rc_encode(&coder->rc, out, out_pos, out_size)) { |
331 assert(limit == UINT32_MAX); | 331 assert(limit == UINT32_MAX); |
332 return LZMA_OK; | 332 return LZMA_OK; |
333 } | 333 } |
334 | 334 |
335 // With LZMA2 we need to take care that compressed size of | 335 // With LZMA2 we need to take care that compressed size of |
336 // a chunk doesn't get too big. | 336 // a chunk doesn't get too big. |
337 » » // TODO | 337 » » // FIXME? Check if this could be improved. |
338 if (limit != UINT32_MAX | 338 if (limit != UINT32_MAX |
339 && (mf->read_pos - mf->read_ahead >= limit | 339 && (mf->read_pos - mf->read_ahead >= limit |
340 || *out_pos + rc_pending(&coder->rc) | 340 || *out_pos + rc_pending(&coder->rc) |
341 >= LZMA2_CHUNK_MAX | 341 >= LZMA2_CHUNK_MAX |
342 - LOOP_INPUT_MAX)) | 342 - LOOP_INPUT_MAX)) |
343 break; | 343 break; |
344 | 344 |
345 // Check that there is some input to process. | 345 // Check that there is some input to process. |
346 if (mf->read_pos >= mf->read_limit) { | 346 if (mf->read_pos >= mf->read_limit) { |
347 if (mf->action == LZMA_RUN) | 347 if (mf->action == LZMA_RUN) |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 return LZMA_OK; | 666 return LZMA_OK; |
667 } | 667 } |
668 #endif | 668 #endif |
669 | 669 |
670 | 670 |
671 extern LZMA_API(lzma_bool) | 671 extern LZMA_API(lzma_bool) |
672 lzma_mode_is_supported(lzma_mode mode) | 672 lzma_mode_is_supported(lzma_mode mode) |
673 { | 673 { |
674 return mode == LZMA_MODE_FAST || mode == LZMA_MODE_NORMAL; | 674 return mode == LZMA_MODE_FAST || mode == LZMA_MODE_NORMAL; |
675 } | 675 } |
OLD | NEW |