media/libvpx/vp9/encoder/vp9_treewriter.c

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

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  */
    11 #include "vp9/encoder/vp9_treewriter.h"
    13 static void cost(int *costs, vp9_tree tree, const vp9_prob *probs,
    14                  int i, int c) {
    15   const vp9_prob prob = probs[i / 2];
    16   int b;
    18   for (b = 0; b <= 1; ++b) {
    19     const int cc = c + vp9_cost_bit(prob, b);
    20     const vp9_tree_index ii = tree[i + b];
    22     if (ii <= 0)
    23       costs[-ii] = cc;
    24     else
    25       cost(costs, tree, probs, ii, cc);
    26   }
    27 }
    29 void vp9_cost_tokens(int *costs, const vp9_prob *probs, vp9_tree tree) {
    30   cost(costs, tree, probs, 0, 0);
    31 }
    33 void vp9_cost_tokens_skip(int *costs, const vp9_prob *probs, vp9_tree tree) {
    34   assert(tree[0] <= 0 && tree[1] > 0);
    36   costs[-tree[0]] = vp9_cost_bit(probs[0], 0);
    37   cost(costs, tree, probs, 2, 0);
    38 }

mercurial