modecosts.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. */
  10. #include "vp8/common/blockd.h"
  11. #include "modecosts.h"
  12. #include "onyx_int.h"
  13. #include "treewriter.h"
  14. #include "vp8/common/entropymode.h"
  15. void vp8_init_mode_costs(VP8_COMP *c) {
  16. VP8_COMMON *x = &c->common;
  17. struct rd_costs_struct *rd_costs = &c->rd_costs;
  18. {
  19. const vp8_tree_p T = vp8_bmode_tree;
  20. int i = 0;
  21. do {
  22. int j = 0;
  23. do {
  24. vp8_cost_tokens(rd_costs->bmode_costs[i][j], vp8_kf_bmode_prob[i][j],
  25. T);
  26. } while (++j < VP8_BINTRAMODES);
  27. } while (++i < VP8_BINTRAMODES);
  28. vp8_cost_tokens(rd_costs->inter_bmode_costs, x->fc.bmode_prob, T);
  29. }
  30. vp8_cost_tokens(rd_costs->inter_bmode_costs, x->fc.sub_mv_ref_prob,
  31. vp8_sub_mv_ref_tree);
  32. vp8_cost_tokens(rd_costs->mbmode_cost[1], x->fc.ymode_prob, vp8_ymode_tree);
  33. vp8_cost_tokens(rd_costs->mbmode_cost[0], vp8_kf_ymode_prob,
  34. vp8_kf_ymode_tree);
  35. vp8_cost_tokens(rd_costs->intra_uv_mode_cost[1], x->fc.uv_mode_prob,
  36. vp8_uv_mode_tree);
  37. vp8_cost_tokens(rd_costs->intra_uv_mode_cost[0], vp8_kf_uv_mode_prob,
  38. vp8_uv_mode_tree);
  39. }