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 | #ifndef VP9_ENCODER_VP9_VARIANCE_H_ |
michael@0 | 12 | #define VP9_ENCODER_VP9_VARIANCE_H_ |
michael@0 | 13 | |
michael@0 | 14 | #include "vpx/vpx_integer.h" |
michael@0 | 15 | // #include "./vpx_config.h" |
michael@0 | 16 | |
michael@0 | 17 | void variance(const uint8_t *src_ptr, |
michael@0 | 18 | int source_stride, |
michael@0 | 19 | const uint8_t *ref_ptr, |
michael@0 | 20 | int recon_stride, |
michael@0 | 21 | int w, |
michael@0 | 22 | int h, |
michael@0 | 23 | unsigned int *sse, |
michael@0 | 24 | int *sum); |
michael@0 | 25 | |
michael@0 | 26 | typedef unsigned int(*vp9_sad_fn_t)(const uint8_t *src_ptr, |
michael@0 | 27 | int source_stride, |
michael@0 | 28 | const uint8_t *ref_ptr, |
michael@0 | 29 | int ref_stride, |
michael@0 | 30 | unsigned int max_sad); |
michael@0 | 31 | |
michael@0 | 32 | typedef unsigned int(*vp9_sad_avg_fn_t)(const uint8_t *src_ptr, |
michael@0 | 33 | int source_stride, |
michael@0 | 34 | const uint8_t *ref_ptr, |
michael@0 | 35 | int ref_stride, |
michael@0 | 36 | const uint8_t *second_pred, |
michael@0 | 37 | unsigned int max_sad); |
michael@0 | 38 | |
michael@0 | 39 | typedef void (*vp9_sad_multi_fn_t)(const uint8_t *src_ptr, |
michael@0 | 40 | int source_stride, |
michael@0 | 41 | const uint8_t *ref_ptr, |
michael@0 | 42 | int ref_stride, |
michael@0 | 43 | unsigned int *sad_array); |
michael@0 | 44 | |
michael@0 | 45 | typedef void (*vp9_sad_multi1_fn_t)(const uint8_t *src_ptr, |
michael@0 | 46 | int source_stride, |
michael@0 | 47 | const uint8_t *ref_ptr, |
michael@0 | 48 | int ref_stride, |
michael@0 | 49 | unsigned int *sad_array); |
michael@0 | 50 | |
michael@0 | 51 | typedef void (*vp9_sad_multi_d_fn_t)(const uint8_t *src_ptr, |
michael@0 | 52 | int source_stride, |
michael@0 | 53 | const uint8_t* const ref_ptr[], |
michael@0 | 54 | int ref_stride, unsigned int *sad_array); |
michael@0 | 55 | |
michael@0 | 56 | typedef unsigned int (*vp9_variance_fn_t)(const uint8_t *src_ptr, |
michael@0 | 57 | int source_stride, |
michael@0 | 58 | const uint8_t *ref_ptr, |
michael@0 | 59 | int ref_stride, |
michael@0 | 60 | unsigned int *sse); |
michael@0 | 61 | |
michael@0 | 62 | typedef unsigned int (*vp9_subpixvariance_fn_t)(const uint8_t *src_ptr, |
michael@0 | 63 | int source_stride, |
michael@0 | 64 | int xoffset, |
michael@0 | 65 | int yoffset, |
michael@0 | 66 | const uint8_t *ref_ptr, |
michael@0 | 67 | int Refstride, |
michael@0 | 68 | unsigned int *sse); |
michael@0 | 69 | |
michael@0 | 70 | typedef unsigned int (*vp9_subp_avg_variance_fn_t)(const uint8_t *src_ptr, |
michael@0 | 71 | int source_stride, |
michael@0 | 72 | int xoffset, |
michael@0 | 73 | int yoffset, |
michael@0 | 74 | const uint8_t *ref_ptr, |
michael@0 | 75 | int Refstride, |
michael@0 | 76 | unsigned int *sse, |
michael@0 | 77 | const uint8_t *second_pred); |
michael@0 | 78 | |
michael@0 | 79 | typedef unsigned int (*vp9_getmbss_fn_t)(const short *); |
michael@0 | 80 | |
michael@0 | 81 | typedef unsigned int (*vp9_get16x16prederror_fn_t)(const uint8_t *src_ptr, |
michael@0 | 82 | int source_stride, |
michael@0 | 83 | const uint8_t *ref_ptr, |
michael@0 | 84 | int ref_stride); |
michael@0 | 85 | |
michael@0 | 86 | typedef struct vp9_variance_vtable { |
michael@0 | 87 | vp9_sad_fn_t sdf; |
michael@0 | 88 | vp9_sad_avg_fn_t sdaf; |
michael@0 | 89 | vp9_variance_fn_t vf; |
michael@0 | 90 | vp9_subpixvariance_fn_t svf; |
michael@0 | 91 | vp9_subp_avg_variance_fn_t svaf; |
michael@0 | 92 | vp9_variance_fn_t svf_halfpix_h; |
michael@0 | 93 | vp9_variance_fn_t svf_halfpix_v; |
michael@0 | 94 | vp9_variance_fn_t svf_halfpix_hv; |
michael@0 | 95 | vp9_sad_multi_fn_t sdx3f; |
michael@0 | 96 | vp9_sad_multi1_fn_t sdx8f; |
michael@0 | 97 | vp9_sad_multi_d_fn_t sdx4df; |
michael@0 | 98 | } vp9_variance_fn_ptr_t; |
michael@0 | 99 | |
michael@0 | 100 | static void comp_avg_pred(uint8_t *comp_pred, const uint8_t *pred, int width, |
michael@0 | 101 | int height, const uint8_t *ref, int ref_stride) { |
michael@0 | 102 | int i, j; |
michael@0 | 103 | |
michael@0 | 104 | for (i = 0; i < height; i++) { |
michael@0 | 105 | for (j = 0; j < width; j++) { |
michael@0 | 106 | int tmp; |
michael@0 | 107 | tmp = pred[j] + ref[j]; |
michael@0 | 108 | comp_pred[j] = (tmp + 1) >> 1; |
michael@0 | 109 | } |
michael@0 | 110 | comp_pred += width; |
michael@0 | 111 | pred += width; |
michael@0 | 112 | ref += ref_stride; |
michael@0 | 113 | } |
michael@0 | 114 | } |
michael@0 | 115 | #endif // VP9_ENCODER_VP9_VARIANCE_H_ |