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

Side by Side Diff: third_party/libwebp/utils/quant_levels.c

Issue 116213006: Update libwebp to 0.4.0 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: After Blink Roll Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « third_party/libwebp/utils/quant_levels.h ('k') | third_party/libwebp/utils/quant_levels_dec.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Quantize levels for specified number of quantization-levels ([2, 256]). 10 // Quantize levels for specified number of quantization-levels ([2, 256]).
11 // Min and max values are preserved (usual 0 and 255 for alpha plane). 11 // Min and max values are preserved (usual 0 and 255 for alpha plane).
12 // 12 //
13 // Author: Skal (pascal.massimino@gmail.com) 13 // Author: Skal (pascal.massimino@gmail.com)
14 14
15 #include <assert.h> 15 #include <assert.h>
16 16
17 #include "./quant_levels.h" 17 #include "./quant_levels.h"
18 18
19 #if defined(__cplusplus) || defined(c_plusplus)
20 extern "C" {
21 #endif
22
23 #define NUM_SYMBOLS 256 19 #define NUM_SYMBOLS 256
24 20
25 #define MAX_ITER 6 // Maximum number of convergence steps. 21 #define MAX_ITER 6 // Maximum number of convergence steps.
26 #define ERROR_THRESHOLD 1e-4 // MSE stopping criterion. 22 #define ERROR_THRESHOLD 1e-4 // MSE stopping criterion.
27 23
28 // ----------------------------------------------------------------------------- 24 // -----------------------------------------------------------------------------
29 // Quantize levels. 25 // Quantize levels.
30 26
31 int QuantizeLevels(uint8_t* const data, int width, int height, 27 int QuantizeLevels(uint8_t* const data, int width, int height,
32 int num_levels, uint64_t* const sse) { 28 int num_levels, uint64_t* const sse) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 data[n] = map[data[n]]; 131 data[n] = map[data[n]];
136 } 132 }
137 } 133 }
138 End: 134 End:
139 // Store sum of squared error if needed. 135 // Store sum of squared error if needed.
140 if (sse != NULL) *sse = (uint64_t)err; 136 if (sse != NULL) *sse = (uint64_t)err;
141 137
142 return 1; 138 return 1;
143 } 139 }
144 140
145 #if defined(__cplusplus) || defined(c_plusplus)
146 } // extern "C"
147 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/utils/quant_levels.h ('k') | third_party/libwebp/utils/quant_levels_dec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698