Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license |
michael@0 | 5 | * that can be found in the LICENSE file in the root of the source |
michael@0 | 6 | * tree. An additional intellectual property rights grant can be found |
michael@0 | 7 | * in the file PATENTS. All contributing project authors may |
michael@0 | 8 | * be found in the AUTHORS file in the root of the source tree. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | |
michael@0 | 12 | #include "boolhuff.h" |
michael@0 | 13 | |
michael@0 | 14 | #if defined(SECTIONBITS_OUTPUT) |
michael@0 | 15 | unsigned __int64 Sectionbits[500]; |
michael@0 | 16 | |
michael@0 | 17 | #endif |
michael@0 | 18 | |
michael@0 | 19 | #ifdef VP8_ENTROPY_STATS |
michael@0 | 20 | unsigned int active_section = 0; |
michael@0 | 21 | #endif |
michael@0 | 22 | |
michael@0 | 23 | const unsigned int vp8_prob_cost[256] = |
michael@0 | 24 | { |
michael@0 | 25 | 2047, 2047, 1791, 1641, 1535, 1452, 1385, 1328, 1279, 1235, 1196, 1161, 1129, 1099, 1072, 1046, |
michael@0 | 26 | 1023, 1000, 979, 959, 940, 922, 905, 889, 873, 858, 843, 829, 816, 803, 790, 778, |
michael@0 | 27 | 767, 755, 744, 733, 723, 713, 703, 693, 684, 675, 666, 657, 649, 641, 633, 625, |
michael@0 | 28 | 617, 609, 602, 594, 587, 580, 573, 567, 560, 553, 547, 541, 534, 528, 522, 516, |
michael@0 | 29 | 511, 505, 499, 494, 488, 483, 477, 472, 467, 462, 457, 452, 447, 442, 437, 433, |
michael@0 | 30 | 428, 424, 419, 415, 410, 406, 401, 397, 393, 389, 385, 381, 377, 373, 369, 365, |
michael@0 | 31 | 361, 357, 353, 349, 346, 342, 338, 335, 331, 328, 324, 321, 317, 314, 311, 307, |
michael@0 | 32 | 304, 301, 297, 294, 291, 288, 285, 281, 278, 275, 272, 269, 266, 263, 260, 257, |
michael@0 | 33 | 255, 252, 249, 246, 243, 240, 238, 235, 232, 229, 227, 224, 221, 219, 216, 214, |
michael@0 | 34 | 211, 208, 206, 203, 201, 198, 196, 194, 191, 189, 186, 184, 181, 179, 177, 174, |
michael@0 | 35 | 172, 170, 168, 165, 163, 161, 159, 156, 154, 152, 150, 148, 145, 143, 141, 139, |
michael@0 | 36 | 137, 135, 133, 131, 129, 127, 125, 123, 121, 119, 117, 115, 113, 111, 109, 107, |
michael@0 | 37 | 105, 103, 101, 99, 97, 95, 93, 92, 90, 88, 86, 84, 82, 81, 79, 77, |
michael@0 | 38 | 75, 73, 72, 70, 68, 66, 65, 63, 61, 60, 58, 56, 55, 53, 51, 50, |
michael@0 | 39 | 48, 46, 45, 43, 41, 40, 38, 37, 35, 33, 32, 30, 29, 27, 25, 24, |
michael@0 | 40 | 22, 21, 19, 18, 16, 15, 13, 12, 10, 9, 7, 6, 4, 3, 1, 1 |
michael@0 | 41 | }; |
michael@0 | 42 | |
michael@0 | 43 | void vp8_start_encode(BOOL_CODER *br, unsigned char *source, unsigned char *source_end) |
michael@0 | 44 | { |
michael@0 | 45 | |
michael@0 | 46 | br->lowvalue = 0; |
michael@0 | 47 | br->range = 255; |
michael@0 | 48 | br->count = -24; |
michael@0 | 49 | br->buffer = source; |
michael@0 | 50 | br->buffer_end = source_end; |
michael@0 | 51 | br->pos = 0; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | void vp8_stop_encode(BOOL_CODER *br) |
michael@0 | 55 | { |
michael@0 | 56 | int i; |
michael@0 | 57 | |
michael@0 | 58 | for (i = 0; i < 32; i++) |
michael@0 | 59 | vp8_encode_bool(br, 0, 128); |
michael@0 | 60 | } |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | void vp8_encode_value(BOOL_CODER *br, int data, int bits) |
michael@0 | 64 | { |
michael@0 | 65 | int bit; |
michael@0 | 66 | |
michael@0 | 67 | for (bit = bits - 1; bit >= 0; bit--) |
michael@0 | 68 | vp8_encode_bool(br, (1 & (data >> bit)), 0x80); |
michael@0 | 69 | |
michael@0 | 70 | } |