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

Side by Side Diff: third_party/libwebp/dec/quant.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/dec/layer.c ('k') | third_party/libwebp/dec/tree.c » ('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 2010 Google Inc. All Rights Reserved. 1 // Copyright 2010 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 // Quantizer initialization 10 // Quantizer initialization
11 // 11 //
12 // Author: Skal (pascal.massimino@gmail.com) 12 // Author: Skal (pascal.massimino@gmail.com)
13 13
14 #include "./vp8i.h" 14 #include "./vp8i.h"
15 15
16 #if defined(__cplusplus) || defined(c_plusplus)
17 extern "C" {
18 #endif
19
20 static WEBP_INLINE int clip(int v, int M) { 16 static WEBP_INLINE int clip(int v, int M) {
21 return v < 0 ? 0 : v > M ? M : v; 17 return v < 0 ? 0 : v > M ? M : v;
22 } 18 }
23 19
24 // Paragraph 14.1 20 // Paragraph 14.1
25 static const uint8_t kDcTable[128] = { 21 static const uint8_t kDcTable[128] = {
26 4, 5, 6, 7, 8, 9, 10, 10, 22 4, 5, 6, 7, 8, 9, 10, 10,
27 11, 12, 13, 14, 15, 16, 17, 17, 23 11, 12, 13, 14, 15, 16, 17, 17,
28 18, 19, 20, 20, 21, 21, 22, 22, 24 18, 19, 20, 20, 21, 21, 22, 22,
29 23, 23, 24, 25, 25, 26, 27, 28, 25 23, 23, 24, 25, 25, 26, 27, 28,
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 93
98 m->y2_mat_[0] = kDcTable[clip(q + dqy2_dc, 127)] * 2; 94 m->y2_mat_[0] = kDcTable[clip(q + dqy2_dc, 127)] * 2;
99 // For all x in [0..284], x*155/100 is bitwise equal to (x*101581) >> 16. 95 // For all x in [0..284], x*155/100 is bitwise equal to (x*101581) >> 16.
100 // The smallest precision for that is '(x*6349) >> 12' but 16 is a good 96 // The smallest precision for that is '(x*6349) >> 12' but 16 is a good
101 // word size. 97 // word size.
102 m->y2_mat_[1] = (kAcTable[clip(q + dqy2_ac, 127)] * 101581) >> 16; 98 m->y2_mat_[1] = (kAcTable[clip(q + dqy2_ac, 127)] * 101581) >> 16;
103 if (m->y2_mat_[1] < 8) m->y2_mat_[1] = 8; 99 if (m->y2_mat_[1] < 8) m->y2_mat_[1] = 8;
104 100
105 m->uv_mat_[0] = kDcTable[clip(q + dquv_dc, 117)]; 101 m->uv_mat_[0] = kDcTable[clip(q + dquv_dc, 117)];
106 m->uv_mat_[1] = kAcTable[clip(q + dquv_ac, 127)]; 102 m->uv_mat_[1] = kAcTable[clip(q + dquv_ac, 127)];
103
104 m->uv_quant_ = q + dquv_ac; // for dithering strength evaluation
107 } 105 }
108 } 106 }
109 } 107 }
110 108
111 //------------------------------------------------------------------------------ 109 //------------------------------------------------------------------------------
112 110
113 #if defined(__cplusplus) || defined(c_plusplus)
114 } // extern "C"
115 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/dec/layer.c ('k') | third_party/libwebp/dec/tree.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698