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

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

Issue 2651883004: libwebp-0.6.0-rc1 (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/libwebp/utils/random_utils.h ('k') | third_party/libwebp/utils/rescaler.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 2013 Google Inc. All Rights Reserved. 1 // Copyright 2013 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 // Pseudo-random utilities 10 // Pseudo-random utilities
11 // 11 //
12 // Author: Skal (pascal.massimino@gmail.com) 12 // Author: Skal (pascal.massimino@gmail.com)
13 13
14 #include <string.h> 14 #include <string.h>
15 #include "./random.h" 15 #include "./random_utils.h"
16 16
17 //------------------------------------------------------------------------------ 17 //------------------------------------------------------------------------------
18 18
19 // 31b-range values 19 // 31b-range values
20 static const uint32_t kRandomTable[VP8_RANDOM_TABLE_SIZE] = { 20 static const uint32_t kRandomTable[VP8_RANDOM_TABLE_SIZE] = {
21 0x0de15230, 0x03b31886, 0x775faccb, 0x1c88626a, 0x68385c55, 0x14b3b828, 21 0x0de15230, 0x03b31886, 0x775faccb, 0x1c88626a, 0x68385c55, 0x14b3b828,
22 0x4a85fef8, 0x49ddb84b, 0x64fcf397, 0x5c550289, 0x4a290000, 0x0d7ec1da, 22 0x4a85fef8, 0x49ddb84b, 0x64fcf397, 0x5c550289, 0x4a290000, 0x0d7ec1da,
23 0x5940b7ab, 0x5492577d, 0x4e19ca72, 0x38d38c69, 0x0c01ee65, 0x32a1755f, 23 0x5940b7ab, 0x5492577d, 0x4e19ca72, 0x38d38c69, 0x0c01ee65, 0x32a1755f,
24 0x5437f652, 0x5abb2c32, 0x0faa57b1, 0x73f533e7, 0x685feeda, 0x7563cce2, 24 0x5437f652, 0x5abb2c32, 0x0faa57b1, 0x73f533e7, 0x685feeda, 0x7563cce2,
25 0x6e990e83, 0x4730a7ed, 0x4fc0d9c6, 0x496b153c, 0x4f1403fa, 0x541afb0c, 25 0x6e990e83, 0x4730a7ed, 0x4fc0d9c6, 0x496b153c, 0x4f1403fa, 0x541afb0c,
26 0x73990b32, 0x26d7cb1c, 0x6fcc3706, 0x2cbb77d8, 0x75762f2a, 0x6425ccdd, 26 0x73990b32, 0x26d7cb1c, 0x6fcc3706, 0x2cbb77d8, 0x75762f2a, 0x6425ccdd,
27 0x24b35461, 0x0a7d8715, 0x220414a8, 0x141ebf67, 0x56b41583, 0x73e502e3, 27 0x24b35461, 0x0a7d8715, 0x220414a8, 0x141ebf67, 0x56b41583, 0x73e502e3,
28 0x44cab16f, 0x28264d42, 0x73baaefb, 0x0a50ebed, 0x1d6ab6fb, 0x0d3ad40b, 28 0x44cab16f, 0x28264d42, 0x73baaefb, 0x0a50ebed, 0x1d6ab6fb, 0x0d3ad40b,
29 0x35db3b68, 0x2b081e83, 0x77ce6b95, 0x5181e5f0, 0x78853bbc, 0x009f9494, 29 0x35db3b68, 0x2b081e83, 0x77ce6b95, 0x5181e5f0, 0x78853bbc, 0x009f9494,
30 0x27e5ed3c 30 0x27e5ed3c
31 }; 31 };
32 32
33 void VP8InitRandom(VP8Random* const rg, float dithering) { 33 void VP8InitRandom(VP8Random* const rg, float dithering) {
34 memcpy(rg->tab_, kRandomTable, sizeof(rg->tab_)); 34 memcpy(rg->tab_, kRandomTable, sizeof(rg->tab_));
35 rg->index1_ = 0; 35 rg->index1_ = 0;
36 rg->index2_ = 31; 36 rg->index2_ = 31;
37 rg->amp_ = (dithering < 0.0) ? 0 37 rg->amp_ = (dithering < 0.0) ? 0
38 : (dithering > 1.0) ? (1 << VP8_RANDOM_DITHER_FIX) 38 : (dithering > 1.0) ? (1 << VP8_RANDOM_DITHER_FIX)
39 : (uint32_t)((1 << VP8_RANDOM_DITHER_FIX) * dithering); 39 : (uint32_t)((1 << VP8_RANDOM_DITHER_FIX) * dithering);
40 } 40 }
41 41
42 //------------------------------------------------------------------------------ 42 //------------------------------------------------------------------------------
43 43
OLDNEW
« no previous file with comments | « third_party/libwebp/utils/random_utils.h ('k') | third_party/libwebp/utils/rescaler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698