| 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 // Alpha-plane decompression. | 10 // Alpha-plane decompression. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 dec->output_ = output; | 60 dec->output_ = output; |
| 61 dec->width_ = src_io->width; | 61 dec->width_ = src_io->width; |
| 62 dec->height_ = src_io->height; | 62 dec->height_ = src_io->height; |
| 63 assert(dec->width_ > 0 && dec->height_ > 0); | 63 assert(dec->width_ > 0 && dec->height_ > 0); |
| 64 | 64 |
| 65 if (data_size <= ALPHA_HEADER_LEN) { | 65 if (data_size <= ALPHA_HEADER_LEN) { |
| 66 return 0; | 66 return 0; |
| 67 } | 67 } |
| 68 | 68 |
| 69 dec->method_ = (data[0] >> 0) & 0x03; | 69 dec->method_ = (data[0] >> 0) & 0x03; |
| 70 dec->filter_ = (data[0] >> 2) & 0x03; | 70 dec->filter_ = (WEBP_FILTER_TYPE)((data[0] >> 2) & 0x03); |
| 71 dec->pre_processing_ = (data[0] >> 4) & 0x03; | 71 dec->pre_processing_ = (data[0] >> 4) & 0x03; |
| 72 rsrv = (data[0] >> 6) & 0x03; | 72 rsrv = (data[0] >> 6) & 0x03; |
| 73 if (dec->method_ < ALPHA_NO_COMPRESSION || | 73 if (dec->method_ < ALPHA_NO_COMPRESSION || |
| 74 dec->method_ > ALPHA_LOSSLESS_COMPRESSION || | 74 dec->method_ > ALPHA_LOSSLESS_COMPRESSION || |
| 75 dec->filter_ >= WEBP_FILTER_LAST || | 75 dec->filter_ >= WEBP_FILTER_LAST || |
| 76 dec->pre_processing_ > ALPHA_PREPROCESSED_LEVELS || | 76 dec->pre_processing_ > ALPHA_PREPROCESSED_LEVELS || |
| 77 rsrv != 0) { | 77 rsrv != 0) { |
| 78 return 0; | 78 return 0; |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Return a pointer to the current decoded row. | 226 // Return a pointer to the current decoded row. |
| 227 return dec->alpha_plane_ + row * width; | 227 return dec->alpha_plane_ + row * width; |
| 228 | 228 |
| 229 Error: | 229 Error: |
| 230 WebPDeallocateAlphaMemory(dec); | 230 WebPDeallocateAlphaMemory(dec); |
| 231 return NULL; | 231 return NULL; |
| 232 } | 232 } |
| OLD | NEW |