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) 2006-2011, Skype Limited. All rights reserved. |
michael@0 | 3 | Redistribution and use in source and binary forms, with or without |
michael@0 | 4 | modification, are permitted provided that the following conditions |
michael@0 | 5 | are met: |
michael@0 | 6 | - Redistributions of source code must retain the above copyright notice, |
michael@0 | 7 | this list of conditions and the following disclaimer. |
michael@0 | 8 | - Redistributions in binary form must reproduce the above copyright |
michael@0 | 9 | notice, this list of conditions and the following disclaimer in the |
michael@0 | 10 | documentation and/or other materials provided with the distribution. |
michael@0 | 11 | - Neither the name of Internet Society, IETF or IETF Trust, nor the |
michael@0 | 12 | names of specific contributors, may be used to endorse or promote |
michael@0 | 13 | products derived from this software without specific prior written |
michael@0 | 14 | permission. |
michael@0 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
michael@0 | 16 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
michael@0 | 17 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
michael@0 | 18 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
michael@0 | 19 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
michael@0 | 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
michael@0 | 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
michael@0 | 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
michael@0 | 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
michael@0 | 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
michael@0 | 25 | POSSIBILITY OF SUCH DAMAGE. |
michael@0 | 26 | ***********************************************************************/ |
michael@0 | 27 | |
michael@0 | 28 | #ifdef HAVE_CONFIG_H |
michael@0 | 29 | #include "config.h" |
michael@0 | 30 | #endif |
michael@0 | 31 | |
michael@0 | 32 | /* Filter coefficients for IIR/FIR polyphase resampling * |
michael@0 | 33 | * Total size: 179 Words (358 Bytes) */ |
michael@0 | 34 | |
michael@0 | 35 | #include "resampler_private.h" |
michael@0 | 36 | |
michael@0 | 37 | /* Matlab code for the notch filter coefficients: */ |
michael@0 | 38 | /* B = [1, 0.147, 1]; A = [1, 0.107, 0.89]; G = 0.93; freqz(G * B, A, 2^14, 16e3); axis([0, 8000, -10, 1]) */ |
michael@0 | 39 | /* fprintf('\t%6d, %6d, %6d, %6d\n', round(B(2)*2^16), round(-A(2)*2^16), round((1-A(3))*2^16), round(G*2^15)) */ |
michael@0 | 40 | /* const opus_int16 silk_resampler_up2_hq_notch[ 4 ] = { 9634, -7012, 7209, 30474 }; */ |
michael@0 | 41 | |
michael@0 | 42 | /* Tables with IIR and FIR coefficients for fractional downsamplers (123 Words) */ |
michael@0 | 43 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_3_4_COEFS[ 2 + 3 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = { |
michael@0 | 44 | -20694, -13867, |
michael@0 | 45 | -49, 64, 17, -157, 353, -496, 163, 11047, 22205, |
michael@0 | 46 | -39, 6, 91, -170, 186, 23, -896, 6336, 19928, |
michael@0 | 47 | -19, -36, 102, -89, -24, 328, -951, 2568, 15909, |
michael@0 | 48 | }; |
michael@0 | 49 | |
michael@0 | 50 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS[ 2 + 2 * RESAMPLER_DOWN_ORDER_FIR0 / 2 ] = { |
michael@0 | 51 | -14457, -14019, |
michael@0 | 52 | 64, 128, -122, 36, 310, -768, 584, 9267, 17733, |
michael@0 | 53 | 12, 128, 18, -142, 288, -117, -865, 4123, 14459, |
michael@0 | 54 | }; |
michael@0 | 55 | |
michael@0 | 56 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_2_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR1 / 2 ] = { |
michael@0 | 57 | 616, -14323, |
michael@0 | 58 | -10, 39, 58, -46, -84, 120, 184, -315, -541, 1284, 5380, 9024, |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_3_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = { |
michael@0 | 62 | 16102, -15162, |
michael@0 | 63 | -13, 0, 20, 26, 5, -31, -43, -4, 65, 90, 7, -157, -248, -44, 593, 1583, 2612, 3271, |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_4_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = { |
michael@0 | 67 | 22500, -15099, |
michael@0 | 68 | 3, -14, -20, -15, 2, 25, 37, 25, -16, -71, -107, -79, 50, 292, 623, 982, 1288, 1464, |
michael@0 | 69 | }; |
michael@0 | 70 | |
michael@0 | 71 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_1_6_COEFS[ 2 + RESAMPLER_DOWN_ORDER_FIR2 / 2 ] = { |
michael@0 | 72 | 27540, -15257, |
michael@0 | 73 | 17, 12, 8, 1, -10, -22, -30, -32, -22, 3, 44, 100, 168, 243, 317, 381, 429, 455, |
michael@0 | 74 | }; |
michael@0 | 75 | |
michael@0 | 76 | silk_DWORD_ALIGN const opus_int16 silk_Resampler_2_3_COEFS_LQ[ 2 + 2 * 2 ] = { |
michael@0 | 77 | -2797, -6507, |
michael@0 | 78 | 4697, 10739, |
michael@0 | 79 | 1567, 8276, |
michael@0 | 80 | }; |
michael@0 | 81 | |
michael@0 | 82 | /* Table with interplation fractions of 1/24, 3/24, 5/24, ... , 23/24 : 23/24 (46 Words) */ |
michael@0 | 83 | silk_DWORD_ALIGN const opus_int16 silk_resampler_frac_FIR_12[ 12 ][ RESAMPLER_ORDER_FIR_12 / 2 ] = { |
michael@0 | 84 | { 189, -600, 617, 30567 }, |
michael@0 | 85 | { 117, -159, -1070, 29704 }, |
michael@0 | 86 | { 52, 221, -2392, 28276 }, |
michael@0 | 87 | { -4, 529, -3350, 26341 }, |
michael@0 | 88 | { -48, 758, -3956, 23973 }, |
michael@0 | 89 | { -80, 905, -4235, 21254 }, |
michael@0 | 90 | { -99, 972, -4222, 18278 }, |
michael@0 | 91 | { -107, 967, -3957, 15143 }, |
michael@0 | 92 | { -103, 896, -3487, 11950 }, |
michael@0 | 93 | { -91, 773, -2865, 8798 }, |
michael@0 | 94 | { -71, 611, -2143, 5784 }, |
michael@0 | 95 | { -46, 425, -1375, 2996 }, |
michael@0 | 96 | }; |