Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/libwebp/dec/alpha.c

Issue 1546003002: libwebp: update to 0.5.0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase around clang-cl fix Created 4 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.
11 // 11 //
12 // Author: Skal (pascal.massimino@gmail.com) 12 // Author: Skal (pascal.massimino@gmail.com)
13 13
14 #include <stdlib.h> 14 #include <stdlib.h>
15 #include "./alphai.h" 15 #include "./alphai.h"
16 #include "./vp8i.h" 16 #include "./vp8i.h"
17 #include "./vp8li.h" 17 #include "./vp8li.h"
18 #include "../dsp/dsp.h"
18 #include "../utils/quant_levels_dec.h" 19 #include "../utils/quant_levels_dec.h"
19 #include "../utils/utils.h" 20 #include "../utils/utils.h"
20 #include "../webp/format_constants.h" 21 #include "../webp/format_constants.h"
21 22
22 //------------------------------------------------------------------------------ 23 //------------------------------------------------------------------------------
23 // ALPHDecoder object. 24 // ALPHDecoder object.
24 25
25 ALPHDecoder* ALPHNew(void) { 26 ALPHDecoder* ALPHNew(void) {
26 ALPHDecoder* const dec = (ALPHDecoder*)WebPSafeCalloc(1ULL, sizeof(*dec)); 27 ALPHDecoder* const dec = (ALPHDecoder*)WebPSafeCalloc(1ULL, sizeof(*dec));
27 return dec; 28 return dec;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return 0; 72 return 0;
72 } 73 }
73 74
74 if (dec->method_ == ALPHA_NO_COMPRESSION) { 75 if (dec->method_ == ALPHA_NO_COMPRESSION) {
75 const size_t alpha_decoded_size = dec->width_ * dec->height_; 76 const size_t alpha_decoded_size = dec->width_ * dec->height_;
76 ok = (alpha_data_size >= alpha_decoded_size); 77 ok = (alpha_data_size >= alpha_decoded_size);
77 } else { 78 } else {
78 assert(dec->method_ == ALPHA_LOSSLESS_COMPRESSION); 79 assert(dec->method_ == ALPHA_LOSSLESS_COMPRESSION);
79 ok = VP8LDecodeAlphaHeader(dec, alpha_data, alpha_data_size, output); 80 ok = VP8LDecodeAlphaHeader(dec, alpha_data, alpha_data_size, output);
80 } 81 }
82 VP8FiltersInit();
81 return ok; 83 return ok;
82 } 84 }
83 85
84 // Decodes, unfilters and dequantizes *at least* 'num_rows' rows of alpha 86 // Decodes, unfilters and dequantizes *at least* 'num_rows' rows of alpha
85 // starting from row number 'row'. It assumes that rows up to (row - 1) have 87 // starting from row number 'row'. It assumes that rows up to (row - 1) have
86 // already been decoded. 88 // already been decoded.
87 // Returns false in case of bitstream error. 89 // Returns false in case of bitstream error.
88 static int ALPHDecode(VP8Decoder* const dec, int row, int num_rows) { 90 static int ALPHDecode(VP8Decoder* const dec, int row, int num_rows) {
89 ALPHDecoder* const alph_dec = dec->alph_dec_; 91 ALPHDecoder* const alph_dec = dec->alph_dec_;
90 const int width = alph_dec->width_; 92 const int width = alph_dec->width_;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (!ok || dec->is_alpha_decoded_) { 158 if (!ok || dec->is_alpha_decoded_) {
157 ALPHDelete(dec->alph_dec_); 159 ALPHDelete(dec->alph_dec_);
158 dec->alph_dec_ = NULL; 160 dec->alph_dec_ = NULL;
159 } 161 }
160 if (!ok) return NULL; // Error. 162 if (!ok) return NULL; // Error.
161 } 163 }
162 164
163 // Return a pointer to the current decoded row. 165 // Return a pointer to the current decoded row.
164 return dec->alpha_plane_ + row * width; 166 return dec->alpha_plane_ + row * width;
165 } 167 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698