2
0

vp9_entropymode.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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. #ifndef VP9_COMMON_VP9_ENTROPYMODE_H_
  11. #define VP9_COMMON_VP9_ENTROPYMODE_H_
  12. #include "vp9/common/vp9_entropy.h"
  13. #include "vp9/common/vp9_entropymv.h"
  14. #include "vp9/common/vp9_filter.h"
  15. #include "vpx_dsp/vpx_filter.h"
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #define BLOCK_SIZE_GROUPS 4
  20. #define TX_SIZE_CONTEXTS 2
  21. #define INTER_OFFSET(mode) ((mode) - NEARESTMV)
  22. struct VP9Common;
  23. struct tx_probs {
  24. vpx_prob p32x32[TX_SIZE_CONTEXTS][TX_SIZES - 1];
  25. vpx_prob p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 2];
  26. vpx_prob p8x8[TX_SIZE_CONTEXTS][TX_SIZES - 3];
  27. };
  28. struct tx_counts {
  29. unsigned int p32x32[TX_SIZE_CONTEXTS][TX_SIZES];
  30. unsigned int p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 1];
  31. unsigned int p8x8[TX_SIZE_CONTEXTS][TX_SIZES - 2];
  32. unsigned int tx_totals[TX_SIZES];
  33. };
  34. typedef struct frame_contexts {
  35. vpx_prob y_mode_prob[BLOCK_SIZE_GROUPS][INTRA_MODES - 1];
  36. vpx_prob uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
  37. vpx_prob partition_prob[PARTITION_CONTEXTS][PARTITION_TYPES - 1];
  38. vp9_coeff_probs_model coef_probs[TX_SIZES][PLANE_TYPES];
  39. vpx_prob switchable_interp_prob[SWITCHABLE_FILTER_CONTEXTS]
  40. [SWITCHABLE_FILTERS - 1];
  41. vpx_prob inter_mode_probs[INTER_MODE_CONTEXTS][INTER_MODES - 1];
  42. vpx_prob intra_inter_prob[INTRA_INTER_CONTEXTS];
  43. vpx_prob comp_inter_prob[COMP_INTER_CONTEXTS];
  44. vpx_prob single_ref_prob[REF_CONTEXTS][2];
  45. vpx_prob comp_ref_prob[REF_CONTEXTS];
  46. struct tx_probs tx_probs;
  47. vpx_prob skip_probs[SKIP_CONTEXTS];
  48. nmv_context nmvc;
  49. int initialized;
  50. } FRAME_CONTEXT;
  51. typedef struct FRAME_COUNTS {
  52. unsigned int y_mode[BLOCK_SIZE_GROUPS][INTRA_MODES];
  53. unsigned int uv_mode[INTRA_MODES][INTRA_MODES];
  54. unsigned int partition[PARTITION_CONTEXTS][PARTITION_TYPES];
  55. vp9_coeff_count_model coef[TX_SIZES][PLANE_TYPES];
  56. unsigned int eob_branch[TX_SIZES][PLANE_TYPES][REF_TYPES]
  57. [COEF_BANDS][COEFF_CONTEXTS];
  58. unsigned int switchable_interp[SWITCHABLE_FILTER_CONTEXTS]
  59. [SWITCHABLE_FILTERS];
  60. unsigned int inter_mode[INTER_MODE_CONTEXTS][INTER_MODES];
  61. unsigned int intra_inter[INTRA_INTER_CONTEXTS][2];
  62. unsigned int comp_inter[COMP_INTER_CONTEXTS][2];
  63. unsigned int single_ref[REF_CONTEXTS][2][2];
  64. unsigned int comp_ref[REF_CONTEXTS][2];
  65. struct tx_counts tx;
  66. unsigned int skip[SKIP_CONTEXTS][2];
  67. nmv_context_counts mv;
  68. } FRAME_COUNTS;
  69. extern const vpx_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
  70. extern const vpx_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
  71. [INTRA_MODES - 1];
  72. extern const vpx_prob vp9_kf_partition_probs[PARTITION_CONTEXTS]
  73. [PARTITION_TYPES - 1];
  74. extern const vpx_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
  75. extern const vpx_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)];
  76. extern const vpx_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)];
  77. extern const vpx_tree_index vp9_switchable_interp_tree
  78. [TREE_SIZE(SWITCHABLE_FILTERS)];
  79. void vp9_setup_past_independence(struct VP9Common *cm);
  80. void vp9_adapt_mode_probs(struct VP9Common *cm);
  81. void tx_counts_to_branch_counts_32x32(const unsigned int *tx_count_32x32p,
  82. unsigned int (*ct_32x32p)[2]);
  83. void tx_counts_to_branch_counts_16x16(const unsigned int *tx_count_16x16p,
  84. unsigned int (*ct_16x16p)[2]);
  85. void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
  86. unsigned int (*ct_8x8p)[2]);
  87. #ifdef __cplusplus
  88. } // extern "C"
  89. #endif
  90. #endif // VP9_COMMON_VP9_ENTROPYMODE_H_