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.
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
12 #include "segmentation.h"
13 #include "vpx_mem/vpx_mem.h"
15 void vp8_update_gf_useage_maps(VP8_COMP *cpi, VP8_COMMON *cm, MACROBLOCK *x)
16 {
17 int mb_row, mb_col;
19 MODE_INFO *this_mb_mode_info = cm->mi;
21 x->gf_active_ptr = (signed char *)cpi->gf_active_flags;
23 if ((cm->frame_type == KEY_FRAME) || (cm->refresh_golden_frame))
24 {
25 /* Reset Gf useage monitors */
26 vpx_memset(cpi->gf_active_flags, 1, (cm->mb_rows * cm->mb_cols));
27 cpi->gf_active_count = cm->mb_rows * cm->mb_cols;
28 }
29 else
30 {
31 /* for each macroblock row in image */
32 for (mb_row = 0; mb_row < cm->mb_rows; mb_row++)
33 {
34 /* for each macroblock col in image */
35 for (mb_col = 0; mb_col < cm->mb_cols; mb_col++)
36 {
38 /* If using golden then set GF active flag if not already set.
39 * If using last frame 0,0 mode then leave flag as it is
40 * else if using non 0,0 motion or intra modes then clear
41 * flag if it is currently set
42 */
43 if ((this_mb_mode_info->mbmi.ref_frame == GOLDEN_FRAME) || (this_mb_mode_info->mbmi.ref_frame == ALTREF_FRAME))
44 {
45 if (*(x->gf_active_ptr) == 0)
46 {
47 *(x->gf_active_ptr) = 1;
48 cpi->gf_active_count ++;
49 }
50 }
51 else if ((this_mb_mode_info->mbmi.mode != ZEROMV) && *(x->gf_active_ptr))
52 {
53 *(x->gf_active_ptr) = 0;
54 cpi->gf_active_count--;
55 }
57 x->gf_active_ptr++; /* Step onto next entry */
58 this_mb_mode_info++; /* skip to next mb */
60 }
62 /* this is to account for the border */
63 this_mb_mode_info++;
64 }
65 }
66 }