| 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 // Incremental decoding | 10 // Incremental decoding |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 const size_t curr_size = MemDataSize(&idec->mem_); | 522 const size_t curr_size = MemDataSize(&idec->mem_); |
| 523 assert(idec->is_lossless_); | 523 assert(idec->is_lossless_); |
| 524 | 524 |
| 525 // At present Lossless decoder can't decode image incrementally. So wait till | 525 // At present Lossless decoder can't decode image incrementally. So wait till |
| 526 // all the image data is aggregated before image can be decoded. | 526 // all the image data is aggregated before image can be decoded. |
| 527 if (curr_size < idec->chunk_size_) { | 527 if (curr_size < idec->chunk_size_) { |
| 528 return VP8_STATUS_SUSPENDED; | 528 return VP8_STATUS_SUSPENDED; |
| 529 } | 529 } |
| 530 | 530 |
| 531 if (!VP8LDecodeImage(dec)) { | 531 if (!VP8LDecodeImage(dec)) { |
| 532 // The decoding is called after all the data-bytes are aggregated. Change |
| 533 // the error to VP8_BITSTREAM_ERROR in case lossless decoder fails to decode |
| 534 // all the pixels (VP8_STATUS_SUSPENDED). |
| 535 if (dec->status_ == VP8_STATUS_SUSPENDED) { |
| 536 dec->status_ = VP8_STATUS_BITSTREAM_ERROR; |
| 537 } |
| 532 return ErrorStatusLossless(idec, dec->status_); | 538 return ErrorStatusLossless(idec, dec->status_); |
| 533 } | 539 } |
| 534 | 540 |
| 535 return FinishDecoding(idec); | 541 return FinishDecoding(idec); |
| 536 } | 542 } |
| 537 | 543 |
| 538 // Main decoding loop | 544 // Main decoding loop |
| 539 static VP8StatusCode IDecode(WebPIDecoder* idec) { | 545 static VP8StatusCode IDecode(WebPIDecoder* idec) { |
| 540 VP8StatusCode status = VP8_STATUS_SUSPENDED; | 546 VP8StatusCode status = VP8_STATUS_SUSPENDED; |
| 541 | 547 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 848 } |
| 843 | 849 |
| 844 idec->io_.put = put; | 850 idec->io_.put = put; |
| 845 idec->io_.setup = setup; | 851 idec->io_.setup = setup; |
| 846 idec->io_.teardown = teardown; | 852 idec->io_.teardown = teardown; |
| 847 idec->io_.opaque = user_data; | 853 idec->io_.opaque = user_data; |
| 848 | 854 |
| 849 return 1; | 855 return 1; |
| 850 } | 856 } |
| 851 | 857 |
| OLD | NEW |