コード例 #1
0
ファイル: vp9_tokenize.c プロジェクト: Laknot/libvpx
static void tokenize_init_one(const vp9_extra_bit *const e,
                              int16_t *value_cost, int max_value) {
  int i = -max_value;

  TOKENVALUE t;
  do {

    vp9_get_token_extra(i, &t.token, &t.extra);
    // initialize the cost for extra bits for all possible coefficient value.
    {
      int cost = 0;
      const vp9_extra_bit *p = &e[t.token];

      if (p->base_val) {
        const int extra = t.extra;
        const int length = p->len;

        if (length)
          cost += treed_cost(p->tree, p->prob, extra >> 1, length);

        cost += vp9_cost_bit(vp9_prob_half, extra & 1); /* sign */
        value_cost[i] = cost;
      }
    }
  } while (++i < max_value);
}
コード例 #2
0
static void fill_value_tokens() {

  TOKENVALUE *const t = dct_value_tokens + DCT_MAX_VALUE;
  const vp9_extra_bit *const e = vp9_extra_bits;

  int i = -DCT_MAX_VALUE;
  int sign = 1;

  do {
    if (!i)
      sign = 0;

    {
      const int a = sign ? -i : i;
      int eb = sign;

      if (a > 4) {
        int j = 4;

        while (++j < 11  &&  e[j].base_val <= a) {}

        t[i].token = --j;
        eb |= (a - e[j].base_val) << 1;
      } else
        t[i].token = a;

      t[i].extra = eb;
    }

    // initialize the cost for extra bits for all possible coefficient value.
    {
      int cost = 0;
      const vp9_extra_bit *p = vp9_extra_bits + t[i].token;

      if (p->base_val) {
        const int extra = t[i].extra;
        const int length = p->len;

        if (length)
          cost += treed_cost(p->tree, p->prob, extra >> 1, length);

        cost += vp9_cost_bit(vp9_prob_half, extra & 1); /* sign */
        dct_value_cost[i + DCT_MAX_VALUE] = cost;
      }

    }

  } while (++i < DCT_MAX_VALUE);

  vp9_dct_value_tokens_ptr = dct_value_tokens + DCT_MAX_VALUE;
  vp9_dct_value_cost_ptr   = dct_value_cost + DCT_MAX_VALUE;
}
コード例 #3
0
ファイル: vp9_cost.c プロジェクト: Nazi-Nigger/gecko-dev
static void cost(int *costs, vp9_tree tree, const vp9_prob *probs,
                 int i, int c) {
    const vp9_prob prob = probs[i / 2];
    int b;

    for (b = 0; b <= 1; ++b) {
        const int cc = c + vp9_cost_bit(prob, b);
        const vp9_tree_index ii = tree[i + b];

        if (ii <= 0)
            costs[-ii] = cc;
        else
            cost(costs, tree, probs, ii, cc);
    }
}
コード例 #4
0
ファイル: vp9_tokenize.c プロジェクト: RobinWuDev/Qt
static void tokenize_init_one(TOKENVALUE *t, const vp9_extra_bit *const e,
                              int16_t *value_cost, int max_value) {
  int i = -max_value;
  int sign = 1;

  do {
    if (!i)
      sign = 0;

    {
      const int a = sign ? -i : i;
      int eb = sign;

      if (a > 4) {
        int j = 4;

        while (++j < 11  &&  e[j].base_val <= a) {}

        t[i].token = --j;
        eb |= (a - e[j].base_val) << 1;
      } else {
        t[i].token = a;
      }
      t[i].extra = eb;
    }

    // initialize the cost for extra bits for all possible coefficient value.
    {
      int cost = 0;
      const vp9_extra_bit *p = &e[t[i].token];

      if (p->base_val) {
        const int extra = t[i].extra;
        const int length = p->len;

        if (length)
          cost += treed_cost(p->tree, p->prob, extra >> 1, length);

        cost += vp9_cost_bit(vp9_prob_half, extra & 1); /* sign */
        value_cost[i] = cost;
      }
    }
  } while (++i < max_value);
}
コード例 #5
0
static void cost(
  int *const C,
  vp9_tree T,
  const vp9_prob *const P,
  int i,
  int c
) {
  const vp9_prob p = P [i >> 1];

  do {
    const vp9_tree_index j = T[i];
    const int d = c + vp9_cost_bit(p, i & 1);

    if (j <= 0)
      C[-j] = d;
    else
      cost(C, T, P, j, d);
  } while (++i & 1);
}
コード例 #6
0
ファイル: vp9_cost.c プロジェクト: Nazi-Nigger/gecko-dev
void vp9_cost_tokens_skip(int *costs, const vp9_prob *probs, vp9_tree tree) {
    assert(tree[0] <= 0 && tree[1] > 0);

    costs[-tree[0]] = vp9_cost_bit(probs[0], 0);
    cost(costs, tree, probs, 2, 0);
}
コード例 #7
0
void vp9_cost_tokens_skip(int *c, const vp9_prob *p, vp9_tree t) {
  assert(t[1] > 0 && t[0] <= 0);
  c[-t[0]] = vp9_cost_bit(p[0], 0);
  cost(c, t, p, 2, 0);
}