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 "vp9/common/vp9_blockd.h" |
michael@0 | 13 | #include "vp9/common/vp9_common_data.h" |
michael@0 | 14 | |
michael@0 | 15 | // Log 2 conversion lookup tables for block width and height |
michael@0 | 16 | const int b_width_log2_lookup[BLOCK_SIZES] = |
michael@0 | 17 | {0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4}; |
michael@0 | 18 | const int b_height_log2_lookup[BLOCK_SIZES] = |
michael@0 | 19 | {0, 1, 0, 1, 2, 1, 2, 3, 2, 3, 4, 3, 4}; |
michael@0 | 20 | const int num_4x4_blocks_wide_lookup[BLOCK_SIZES] = |
michael@0 | 21 | {1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16}; |
michael@0 | 22 | const int num_4x4_blocks_high_lookup[BLOCK_SIZES] = |
michael@0 | 23 | {1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16}; |
michael@0 | 24 | // Log 2 conversion lookup tables for modeinfo width and height |
michael@0 | 25 | const int mi_width_log2_lookup[BLOCK_SIZES] = |
michael@0 | 26 | {0, 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3}; |
michael@0 | 27 | const int num_8x8_blocks_wide_lookup[BLOCK_SIZES] = |
michael@0 | 28 | {1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8}; |
michael@0 | 29 | const int mi_height_log2_lookup[BLOCK_SIZES] = |
michael@0 | 30 | {0, 0, 0, 0, 1, 0, 1, 2, 1, 2, 3, 2, 3}; |
michael@0 | 31 | const int num_8x8_blocks_high_lookup[BLOCK_SIZES] = |
michael@0 | 32 | {1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8}; |
michael@0 | 33 | |
michael@0 | 34 | // MIN(3, MIN(b_width_log2(bsize), b_height_log2(bsize))) |
michael@0 | 35 | const int size_group_lookup[BLOCK_SIZES] = |
michael@0 | 36 | {0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3}; |
michael@0 | 37 | |
michael@0 | 38 | const int num_pels_log2_lookup[BLOCK_SIZES] = |
michael@0 | 39 | {4, 5, 5, 6, 7, 7, 8, 9, 9, 10, 11, 11, 12}; |
michael@0 | 40 | |
michael@0 | 41 | |
michael@0 | 42 | const PARTITION_TYPE partition_lookup[][BLOCK_SIZES] = { |
michael@0 | 43 | { // 4X4 |
michael@0 | 44 | // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64 |
michael@0 | 45 | PARTITION_NONE, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 46 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 47 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 48 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 49 | PARTITION_INVALID |
michael@0 | 50 | }, { // 8X8 |
michael@0 | 51 | // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64 |
michael@0 | 52 | PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, |
michael@0 | 53 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 54 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 55 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID |
michael@0 | 56 | }, { // 16X16 |
michael@0 | 57 | // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64 |
michael@0 | 58 | PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, |
michael@0 | 59 | PARTITION_VERT, PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID, |
michael@0 | 60 | PARTITION_INVALID, PARTITION_INVALID, PARTITION_INVALID, |
michael@0 | 61 | PARTITION_INVALID, PARTITION_INVALID |
michael@0 | 62 | }, { // 32X32 |
michael@0 | 63 | // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64 |
michael@0 | 64 | PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, |
michael@0 | 65 | PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT, |
michael@0 | 66 | PARTITION_HORZ, PARTITION_NONE, PARTITION_INVALID, |
michael@0 | 67 | PARTITION_INVALID, PARTITION_INVALID |
michael@0 | 68 | }, { // 64X64 |
michael@0 | 69 | // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64 |
michael@0 | 70 | PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, |
michael@0 | 71 | PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_SPLIT, |
michael@0 | 72 | PARTITION_SPLIT, PARTITION_SPLIT, PARTITION_VERT, PARTITION_HORZ, |
michael@0 | 73 | PARTITION_NONE |
michael@0 | 74 | } |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES] = { |
michael@0 | 78 | { // PARTITION_NONE |
michael@0 | 79 | BLOCK_4X4, BLOCK_4X8, BLOCK_8X4, |
michael@0 | 80 | BLOCK_8X8, BLOCK_8X16, BLOCK_16X8, |
michael@0 | 81 | BLOCK_16X16, BLOCK_16X32, BLOCK_32X16, |
michael@0 | 82 | BLOCK_32X32, BLOCK_32X64, BLOCK_64X32, |
michael@0 | 83 | BLOCK_64X64, |
michael@0 | 84 | }, { // PARTITION_HORZ |
michael@0 | 85 | BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 86 | BLOCK_8X4, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 87 | BLOCK_16X8, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 88 | BLOCK_32X16, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 89 | BLOCK_64X32, |
michael@0 | 90 | }, { // PARTITION_VERT |
michael@0 | 91 | BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 92 | BLOCK_4X8, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 93 | BLOCK_8X16, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 94 | BLOCK_16X32, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 95 | BLOCK_32X64, |
michael@0 | 96 | }, { // PARTITION_SPLIT |
michael@0 | 97 | BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 98 | BLOCK_4X4, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 99 | BLOCK_8X8, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 100 | BLOCK_16X16, BLOCK_INVALID, BLOCK_INVALID, |
michael@0 | 101 | BLOCK_32X32, |
michael@0 | 102 | } |
michael@0 | 103 | }; |
michael@0 | 104 | |
michael@0 | 105 | const TX_SIZE max_txsize_lookup[BLOCK_SIZES] = { |
michael@0 | 106 | TX_4X4, TX_4X4, TX_4X4, |
michael@0 | 107 | TX_8X8, TX_8X8, TX_8X8, |
michael@0 | 108 | TX_16X16, TX_16X16, TX_16X16, |
michael@0 | 109 | TX_32X32, TX_32X32, TX_32X32, TX_32X32 |
michael@0 | 110 | }; |
michael@0 | 111 | const TX_SIZE max_uv_txsize_lookup[BLOCK_SIZES] = { |
michael@0 | 112 | TX_4X4, TX_4X4, TX_4X4, |
michael@0 | 113 | TX_4X4, TX_4X4, TX_4X4, |
michael@0 | 114 | TX_8X8, TX_8X8, TX_8X8, |
michael@0 | 115 | TX_16X16, TX_16X16, TX_16X16, TX_32X32 |
michael@0 | 116 | }; |
michael@0 | 117 | |
michael@0 | 118 | const TX_SIZE tx_mode_to_biggest_tx_size[TX_MODES] = { |
michael@0 | 119 | TX_4X4, // ONLY_4X4 |
michael@0 | 120 | TX_8X8, // ALLOW_8X8 |
michael@0 | 121 | TX_16X16, // ALLOW_16X16 |
michael@0 | 122 | TX_32X32, // ALLOW_32X32 |
michael@0 | 123 | TX_32X32, // TX_MODE_SELECT |
michael@0 | 124 | }; |
michael@0 | 125 | |
michael@0 | 126 | |
michael@0 | 127 | |
michael@0 | 128 | const BLOCK_SIZE ss_size_lookup[BLOCK_SIZES][2][2] = { |
michael@0 | 129 | // ss_x == 0 ss_x == 0 ss_x == 1 ss_x == 1 |
michael@0 | 130 | // ss_y == 0 ss_y == 1 ss_y == 0 ss_y == 1 |
michael@0 | 131 | {{BLOCK_4X4, BLOCK_INVALID}, {BLOCK_INVALID, BLOCK_INVALID}}, |
michael@0 | 132 | {{BLOCK_4X8, BLOCK_4X4}, {BLOCK_INVALID, BLOCK_INVALID}}, |
michael@0 | 133 | {{BLOCK_8X4, BLOCK_INVALID}, {BLOCK_4X4, BLOCK_INVALID}}, |
michael@0 | 134 | {{BLOCK_8X8, BLOCK_8X4}, {BLOCK_4X8, BLOCK_4X4}}, |
michael@0 | 135 | {{BLOCK_8X16, BLOCK_8X8}, {BLOCK_INVALID, BLOCK_4X8}}, |
michael@0 | 136 | {{BLOCK_16X8, BLOCK_INVALID}, {BLOCK_8X8, BLOCK_8X4}}, |
michael@0 | 137 | {{BLOCK_16X16, BLOCK_16X8}, {BLOCK_8X16, BLOCK_8X8}}, |
michael@0 | 138 | {{BLOCK_16X32, BLOCK_16X16}, {BLOCK_INVALID, BLOCK_8X16}}, |
michael@0 | 139 | {{BLOCK_32X16, BLOCK_INVALID}, {BLOCK_16X16, BLOCK_16X8}}, |
michael@0 | 140 | {{BLOCK_32X32, BLOCK_32X16}, {BLOCK_16X32, BLOCK_16X16}}, |
michael@0 | 141 | {{BLOCK_32X64, BLOCK_32X32}, {BLOCK_INVALID, BLOCK_16X32}}, |
michael@0 | 142 | {{BLOCK_64X32, BLOCK_INVALID}, {BLOCK_32X32, BLOCK_32X16}}, |
michael@0 | 143 | {{BLOCK_64X64, BLOCK_64X32}, {BLOCK_32X64, BLOCK_32X32}}, |
michael@0 | 144 | }; |
michael@0 | 145 | |
michael@0 | 146 |