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 | #include "vpx_config.h" |
michael@0 | 12 | #include "vp8_rtcd.h" |
michael@0 | 13 | #include "vpx_mem/vpx_mem.h" |
michael@0 | 14 | #include "vp8/common/blockd.h" |
michael@0 | 15 | |
michael@0 | 16 | #define build_intra_predictors_mbuv_prototype(sym) \ |
michael@0 | 17 | void sym(unsigned char *dst, int dst_stride, \ |
michael@0 | 18 | const unsigned char *above, \ |
michael@0 | 19 | const unsigned char *left, int left_stride) |
michael@0 | 20 | typedef build_intra_predictors_mbuv_prototype((*build_intra_predictors_mbuv_fn_t)); |
michael@0 | 21 | |
michael@0 | 22 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc_mmx2); |
michael@0 | 23 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dctop_mmx2); |
michael@0 | 24 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dcleft_mmx2); |
michael@0 | 25 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_dc128_mmx); |
michael@0 | 26 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_mmx2); |
michael@0 | 27 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ho_ssse3); |
michael@0 | 28 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_ve_mmx); |
michael@0 | 29 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_sse2); |
michael@0 | 30 | extern build_intra_predictors_mbuv_prototype(vp8_intra_pred_uv_tm_ssse3); |
michael@0 | 31 | |
michael@0 | 32 | static void vp8_build_intra_predictors_mbuv_x86(MACROBLOCKD *x, |
michael@0 | 33 | unsigned char * uabove_row, |
michael@0 | 34 | unsigned char * vabove_row, |
michael@0 | 35 | unsigned char *dst_u, |
michael@0 | 36 | unsigned char *dst_v, |
michael@0 | 37 | int dst_stride, |
michael@0 | 38 | unsigned char * uleft, |
michael@0 | 39 | unsigned char * vleft, |
michael@0 | 40 | int left_stride, |
michael@0 | 41 | build_intra_predictors_mbuv_fn_t tm_func, |
michael@0 | 42 | build_intra_predictors_mbuv_fn_t ho_func) |
michael@0 | 43 | { |
michael@0 | 44 | int mode = x->mode_info_context->mbmi.uv_mode; |
michael@0 | 45 | build_intra_predictors_mbuv_fn_t fn; |
michael@0 | 46 | |
michael@0 | 47 | switch (mode) { |
michael@0 | 48 | case V_PRED: fn = vp8_intra_pred_uv_ve_mmx; break; |
michael@0 | 49 | case H_PRED: fn = ho_func; break; |
michael@0 | 50 | case TM_PRED: fn = tm_func; break; |
michael@0 | 51 | case DC_PRED: |
michael@0 | 52 | if (x->up_available) { |
michael@0 | 53 | if (x->left_available) { |
michael@0 | 54 | fn = vp8_intra_pred_uv_dc_mmx2; break; |
michael@0 | 55 | } else { |
michael@0 | 56 | fn = vp8_intra_pred_uv_dctop_mmx2; break; |
michael@0 | 57 | } |
michael@0 | 58 | } else if (x->left_available) { |
michael@0 | 59 | fn = vp8_intra_pred_uv_dcleft_mmx2; break; |
michael@0 | 60 | } else { |
michael@0 | 61 | fn = vp8_intra_pred_uv_dc128_mmx; break; |
michael@0 | 62 | } |
michael@0 | 63 | break; |
michael@0 | 64 | default: return; |
michael@0 | 65 | } |
michael@0 | 66 | |
michael@0 | 67 | fn(dst_u, dst_stride, uabove_row, uleft, left_stride); |
michael@0 | 68 | fn(dst_v, dst_stride, vabove_row, vleft, left_stride); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | void vp8_build_intra_predictors_mbuv_s_sse2(MACROBLOCKD *x, |
michael@0 | 72 | unsigned char * uabove_row, |
michael@0 | 73 | unsigned char * vabove_row, |
michael@0 | 74 | unsigned char * uleft, |
michael@0 | 75 | unsigned char * vleft, |
michael@0 | 76 | int left_stride, |
michael@0 | 77 | unsigned char * upred_ptr, |
michael@0 | 78 | unsigned char * vpred_ptr, |
michael@0 | 79 | int pred_stride) |
michael@0 | 80 | { |
michael@0 | 81 | vp8_build_intra_predictors_mbuv_x86(x, |
michael@0 | 82 | uabove_row, vabove_row, |
michael@0 | 83 | upred_ptr, |
michael@0 | 84 | vpred_ptr, pred_stride, |
michael@0 | 85 | uleft, |
michael@0 | 86 | vleft, |
michael@0 | 87 | left_stride, |
michael@0 | 88 | vp8_intra_pred_uv_tm_sse2, |
michael@0 | 89 | vp8_intra_pred_uv_ho_mmx2); |
michael@0 | 90 | } |
michael@0 | 91 | |
michael@0 | 92 | void vp8_build_intra_predictors_mbuv_s_ssse3(MACROBLOCKD *x, |
michael@0 | 93 | unsigned char * uabove_row, |
michael@0 | 94 | unsigned char * vabove_row, |
michael@0 | 95 | unsigned char * uleft, |
michael@0 | 96 | unsigned char * vleft, |
michael@0 | 97 | int left_stride, |
michael@0 | 98 | unsigned char * upred_ptr, |
michael@0 | 99 | unsigned char * vpred_ptr, |
michael@0 | 100 | int pred_stride) |
michael@0 | 101 | { |
michael@0 | 102 | vp8_build_intra_predictors_mbuv_x86(x, |
michael@0 | 103 | uabove_row, vabove_row, |
michael@0 | 104 | upred_ptr, |
michael@0 | 105 | vpred_ptr, pred_stride, |
michael@0 | 106 | uleft, |
michael@0 | 107 | vleft, |
michael@0 | 108 | left_stride, |
michael@0 | 109 | vp8_intra_pred_uv_tm_ssse3, |
michael@0 | 110 | vp8_intra_pred_uv_ho_ssse3); |
michael@0 | 111 | } |
michael@0 | 112 | |
michael@0 | 113 | #define build_intra_predictors_mby_prototype(sym) \ |
michael@0 | 114 | void sym(unsigned char *dst, int dst_stride, \ |
michael@0 | 115 | const unsigned char *above, \ |
michael@0 | 116 | const unsigned char *left, int left_stride) |
michael@0 | 117 | typedef build_intra_predictors_mby_prototype((*build_intra_predictors_mby_fn_t)); |
michael@0 | 118 | |
michael@0 | 119 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc_sse2); |
michael@0 | 120 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dctop_sse2); |
michael@0 | 121 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dcleft_sse2); |
michael@0 | 122 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_dc128_sse2); |
michael@0 | 123 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ho_sse2); |
michael@0 | 124 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_ve_sse2); |
michael@0 | 125 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_sse2); |
michael@0 | 126 | extern build_intra_predictors_mby_prototype(vp8_intra_pred_y_tm_ssse3); |
michael@0 | 127 | |
michael@0 | 128 | static void vp8_build_intra_predictors_mby_x86(MACROBLOCKD *x, |
michael@0 | 129 | unsigned char * yabove_row, |
michael@0 | 130 | unsigned char *dst_y, |
michael@0 | 131 | int dst_stride, |
michael@0 | 132 | unsigned char * yleft, |
michael@0 | 133 | int left_stride, |
michael@0 | 134 | build_intra_predictors_mby_fn_t tm_func) |
michael@0 | 135 | { |
michael@0 | 136 | int mode = x->mode_info_context->mbmi.mode; |
michael@0 | 137 | build_intra_predictors_mbuv_fn_t fn; |
michael@0 | 138 | |
michael@0 | 139 | switch (mode) { |
michael@0 | 140 | case V_PRED: fn = vp8_intra_pred_y_ve_sse2; break; |
michael@0 | 141 | case H_PRED: fn = vp8_intra_pred_y_ho_sse2; break; |
michael@0 | 142 | case TM_PRED: fn = tm_func; break; |
michael@0 | 143 | case DC_PRED: |
michael@0 | 144 | if (x->up_available) { |
michael@0 | 145 | if (x->left_available) { |
michael@0 | 146 | fn = vp8_intra_pred_y_dc_sse2; break; |
michael@0 | 147 | } else { |
michael@0 | 148 | fn = vp8_intra_pred_y_dctop_sse2; break; |
michael@0 | 149 | } |
michael@0 | 150 | } else if (x->left_available) { |
michael@0 | 151 | fn = vp8_intra_pred_y_dcleft_sse2; break; |
michael@0 | 152 | } else { |
michael@0 | 153 | fn = vp8_intra_pred_y_dc128_sse2; break; |
michael@0 | 154 | } |
michael@0 | 155 | break; |
michael@0 | 156 | default: return; |
michael@0 | 157 | } |
michael@0 | 158 | |
michael@0 | 159 | fn(dst_y, dst_stride, yabove_row, yleft, left_stride); |
michael@0 | 160 | return; |
michael@0 | 161 | } |
michael@0 | 162 | |
michael@0 | 163 | void vp8_build_intra_predictors_mby_s_sse2(MACROBLOCKD *x, |
michael@0 | 164 | unsigned char * yabove_row, |
michael@0 | 165 | unsigned char * yleft, |
michael@0 | 166 | int left_stride, |
michael@0 | 167 | unsigned char * ypred_ptr, |
michael@0 | 168 | int y_stride) |
michael@0 | 169 | { |
michael@0 | 170 | vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr, |
michael@0 | 171 | y_stride, yleft, left_stride, |
michael@0 | 172 | vp8_intra_pred_y_tm_sse2); |
michael@0 | 173 | } |
michael@0 | 174 | |
michael@0 | 175 | void vp8_build_intra_predictors_mby_s_ssse3(MACROBLOCKD *x, |
michael@0 | 176 | unsigned char * yabove_row, |
michael@0 | 177 | unsigned char * yleft, |
michael@0 | 178 | int left_stride, |
michael@0 | 179 | unsigned char * ypred_ptr, |
michael@0 | 180 | int y_stride) |
michael@0 | 181 | { |
michael@0 | 182 | vp8_build_intra_predictors_mby_x86(x, yabove_row, ypred_ptr, |
michael@0 | 183 | y_stride, yleft, left_stride, |
michael@0 | 184 | vp8_intra_pred_y_tm_ssse3); |
michael@0 | 185 | |
michael@0 | 186 | } |