blob: ea9655577be431bc311a03577b31413a5c17eda6 [file] [log] [blame]
John Koleszar0ea50ce2010-05-18 11:58:33 -04001/*
John Koleszarc2140b82010-09-09 08:16:39 -04002 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
John Koleszar0ea50ce2010-05-18 11:58:33 -04003 *
John Koleszar94c52e42010-06-18 12:39:21 -04004 * Use of this source code is governed by a BSD-style license
John Koleszar09202d82010-06-04 16:19:40 -04005 * 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
John Koleszar94c52e42010-06-18 12:39:21 -04007 * in the file PATENTS. All contributing project authors may
John Koleszar09202d82010-06-04 16:19:40 -04008 * be found in the AUTHORS file in the root of the source tree.
John Koleszar0ea50ce2010-05-18 11:58:33 -04009 */
10
Jim Bankoski2b8dc062012-11-29 16:36:10 -080011#ifndef VP9_COMMON_VP9_ENTROPYMODE_H_
12#define VP9_COMMON_VP9_ENTROPYMODE_H_
John Koleszar0ea50ce2010-05-18 11:58:33 -040013
Jim Bankoskic6787392012-11-28 10:41:40 -080014#include "vp9/common/vp9_blockd.h"
15#include "vp9/common/vp9_treecoder.h"
John Koleszar0ea50ce2010-05-18 11:58:33 -040016
Deb Mukherjee17da2ca2013-06-08 00:09:44 -070017#define TX_SIZE_CONTEXTS 2
James Zernc8ba8c52013-08-22 18:40:34 -070018#define SWITCHABLE_FILTERS 3 // number of switchable filters
Dmitry Kovalev67618722013-10-30 14:40:34 -070019#define SWITCHABLE_FILTER_CONTEXTS (SWITCHABLE_FILTERS + 1)
Deb Mukherjeea43ff152013-06-10 12:00:43 -070020
Deb Mukherjee21401942013-06-06 11:14:04 -070021// #define MODE_STATS
22
Dmitry Kovalevf9f453e2013-07-17 16:50:52 -070023struct VP9Common;
24
Dmitry Kovalevcc662dd2013-07-10 17:36:06 -070025struct tx_probs {
Dmitry Kovalev23391ea2013-07-26 17:15:37 -070026 vp9_prob p32x32[TX_SIZE_CONTEXTS][TX_SIZES - 1];
27 vp9_prob p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 2];
28 vp9_prob p8x8[TX_SIZE_CONTEXTS][TX_SIZES - 3];
Dmitry Kovalevcc662dd2013-07-10 17:36:06 -070029};
30
31struct tx_counts {
Dmitry Kovalev23391ea2013-07-26 17:15:37 -070032 unsigned int p32x32[TX_SIZE_CONTEXTS][TX_SIZES];
33 unsigned int p16x16[TX_SIZE_CONTEXTS][TX_SIZES - 1];
34 unsigned int p8x8[TX_SIZE_CONTEXTS][TX_SIZES - 2];
Dmitry Kovalevcc662dd2013-07-10 17:36:06 -070035};
36
James Zernc8ba8c52013-08-22 18:40:34 -070037extern const vp9_prob vp9_kf_uv_mode_prob[INTRA_MODES][INTRA_MODES - 1];
38extern const vp9_prob vp9_kf_y_mode_prob[INTRA_MODES][INTRA_MODES]
39 [INTRA_MODES - 1];
John Koleszar0ea50ce2010-05-18 11:58:33 -040040
Dmitry Kovalev860e4672013-10-11 16:25:50 -070041extern const vp9_tree_index vp9_intra_mode_tree[TREE_SIZE(INTRA_MODES)];
James Zernc8ba8c52013-08-22 18:40:34 -070042extern struct vp9_token vp9_intra_mode_encodings[INTRA_MODES];
Dmitry Kovalev860e4672013-10-11 16:25:50 -070043
44extern const vp9_tree_index vp9_inter_mode_tree[TREE_SIZE(INTER_MODES)];
James Zernc8ba8c52013-08-22 18:40:34 -070045extern struct vp9_token vp9_inter_mode_encodings[INTER_MODES];
John Koleszar0ea50ce2010-05-18 11:58:33 -040046
Dmitry Kovalev860e4672013-10-11 16:25:50 -070047extern const vp9_tree_index vp9_partition_tree[TREE_SIZE(PARTITION_TYPES)];
Jingning Han90a91cc2013-04-16 00:18:02 -070048extern struct vp9_token vp9_partition_encodings[PARTITION_TYPES];
49
Dmitry Kovalevf9f453e2013-07-17 16:50:52 -070050extern const vp9_tree_index vp9_switchable_interp_tree
Dmitry Kovalev860e4672013-10-11 16:25:50 -070051 [TREE_SIZE(SWITCHABLE_FILTERS)];
James Zernc8ba8c52013-08-22 18:40:34 -070052extern struct vp9_token vp9_switchable_interp_encodings[SWITCHABLE_FILTERS];
Dmitry Kovalevf9f453e2013-07-17 16:50:52 -070053
54void vp9_entropy_mode_init();
55
Dmitry Kovalevb7616e32013-08-14 11:20:33 -070056void vp9_setup_past_independence(struct VP9Common *cm);
Deb Mukherjee01cafaa2013-01-15 06:43:35 -080057
James Zernd765df22013-08-23 19:30:33 -070058void vp9_init_mbmode_probs(struct VP9Common *cm);
Ronald S. Bultje6c280c22012-10-31 16:09:17 -070059
James Zernd765df22013-08-23 19:30:33 -070060void vp9_adapt_mode_probs(struct VP9Common *cm);
Deb Mukherjee52597442012-07-18 13:43:01 -070061
Dmitry Kovalevc64e2382013-09-30 14:50:15 -070062void tx_counts_to_branch_counts_32x32(const unsigned int *tx_count_32x32p,
Dmitry Kovalevf9f453e2013-07-17 16:50:52 -070063 unsigned int (*ct_32x32p)[2]);
Dmitry Kovalevc64e2382013-09-30 14:50:15 -070064void tx_counts_to_branch_counts_16x16(const unsigned int *tx_count_16x16p,
Dmitry Kovalevf9f453e2013-07-17 16:50:52 -070065 unsigned int (*ct_16x16p)[2]);
Dmitry Kovalevc64e2382013-09-30 14:50:15 -070066void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
Dmitry Kovalevf9f453e2013-07-17 16:50:52 -070067 unsigned int (*ct_8x8p)[2]);
Ronald S. Bultje6c280c22012-10-31 16:09:17 -070068
Ronald S. Bultje4cca47b2012-12-18 15:31:19 -080069#endif // VP9_COMMON_VP9_ENTROPYMODE_H_