modecosts.c 1.88 KB
Newer Older
John Koleszar's avatar
John Koleszar committed
1
/*
2
 *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar's avatar
John Koleszar committed
3
 *
4
 *  Use of this source code is governed by a BSD-style license
5 6
 *  that can be found in the LICENSE file in the root of the source
 *  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.
John Koleszar's avatar
John Koleszar committed
9 10 11
 */


12
#include "vp9/common/blockd.h"
John Koleszar's avatar
John Koleszar committed
13 14
#include "onyx_int.h"
#include "treewriter.h"
15
#include "vp9/common/entropymode.h"
John Koleszar's avatar
John Koleszar committed
16 17


18 19
void vp9_init_mode_costs(VP9_COMP *c) {
  VP9_COMMON *x = &c->common;
20
  const vp9_tree_p T = vp9_bmode_tree;
21
  const vp9_tree_p KT = vp9_kf_bmode_tree;
22 23
  int i, j;

24 25
  for (i = 0; i < VP9_KF_BINTRAMODES; i++) {
    for (j = 0; j < VP9_KF_BINTRAMODES; j++) {
26
      vp9_cost_tokens((int *)c->mb.bmode_costs[i][j],
27
                      x->kf_bmode_prob[i][j], KT);
28
    }
John Koleszar's avatar
John Koleszar committed
29
  }
30 31

  vp9_cost_tokens((int *)c->mb.inter_bmode_costs, x->fc.bmode_prob, T);
32
  vp9_cost_tokens((int *)c->mb.inter_bmode_costs,
33
                  x->fc.sub_mv_ref_prob[0], vp9_sub_mv_ref_tree);
John Koleszar's avatar
John Koleszar committed
34

35
  // TODO(rbultje) separate tables for superblock costing?
36
  vp9_cost_tokens(c->mb.mbmode_cost[1], x->fc.ymode_prob, vp9_ymode_tree);
37
  vp9_cost_tokens(c->mb.mbmode_cost[0],
John Koleszar's avatar
John Koleszar committed
38
                  x->kf_ymode_prob[c->common.kf_ymode_probs_index],
39
                  vp9_kf_ymode_tree);
40
  vp9_cost_tokens(c->mb.intra_uv_mode_cost[1],
41
                  x->fc.uv_mode_prob[VP9_YMODES - 1], vp9_uv_mode_tree);
42
  vp9_cost_tokens(c->mb.intra_uv_mode_cost[0],
43
                  x->kf_uv_mode_prob[VP9_YMODES - 1], vp9_uv_mode_tree);
44
  vp9_cost_tokens(c->mb.i8x8_mode_costs,
45
                  x->fc.i8x8_mode_prob, vp9_i8x8_mode_tree);
46

47
  for (i = 0; i <= VP9_SWITCHABLE_FILTERS; ++i)
48 49
    vp9_cost_tokens((int *)c->mb.switchable_interp_costs[i],
                    x->fc.switchable_interp_prob[i],
50
                    vp9_switchable_interp_tree);
John Koleszar's avatar
John Koleszar committed
51
}