summaryrefslogtreecommitdiff
path: root/vp8
diff options
context:
space:
mode:
authorAttila Nagy <attilanagy@google.com>2012-04-19 15:14:28 +0300
committerAttila Nagy <attilanagy@google.com>2012-04-19 15:46:02 +0300
commit441cac8ea6128d55bf973a60169a0e5f61202ee4 (patch)
treecc422da0cea16872edafc0b1e792155de011ad5f /vp8
parent97495c5c5ced0ab5839a3026e0e528fa22c15d5a (diff)
downloadlibvpx-441cac8ea6128d55bf973a60169a0e5f61202ee4.tar
libvpx-441cac8ea6128d55bf973a60169a0e5f61202ee4.tar.gz
libvpx-441cac8ea6128d55bf973a60169a0e5f61202ee4.tar.bz2
libvpx-441cac8ea6128d55bf973a60169a0e5f61202ee4.zip
Makes all mode token tables const
Mode token tabels precalculated in entropymode.c. Removes vp8_initialize_common()as all common global data is precalculated const now. Change-Id: I9b2ccc883e4f618069e1bc180dad3a823394eb73
Diffstat (limited to 'vp8')
-rw-r--r--vp8/common/alloccommon.c5
-rw-r--r--vp8/common/entropymode.c128
-rw-r--r--vp8/common/entropymode.h18
-rw-r--r--vp8/common/onyxc_int.h4
-rw-r--r--vp8/decoder/onyxd_if.c1
-rw-r--r--vp8/encoder/onyx_if.c1
6 files changed, 105 insertions, 52 deletions
diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c
index 082058433..d58e49c34 100644
--- a/vp8/common/alloccommon.c
+++ b/vp8/common/alloccommon.c
@@ -220,8 +220,3 @@ void vp8_remove_common(VP8_COMMON *oci)
{
vp8_de_alloc_frame_buffers(oci);
}
-
-void vp8_initialize_common()
-{
- vp8_entropy_mode_init();
-}
diff --git a/vp8/common/entropymode.c b/vp8/common/entropymode.c
index a723ec030..89a6e1901 100644
--- a/vp8/common/entropymode.c
+++ b/vp8/common/entropymode.c
@@ -59,7 +59,7 @@ const vp8_prob vp8_sub_mv_ref_prob2 [SUBMVREF_COUNT][VP8_SUBMVREFS-1] =
-vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
+const vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
{
{
0, 0, 0, 0,
@@ -84,7 +84,7 @@ vp8_mbsplit vp8_mbsplits [VP8_NUMMBSPLITS] =
4, 5, 6, 7,
8, 9, 10, 11,
12, 13, 14, 15,
- },
+ }
};
const int vp8_mbsplit_count [VP8_NUMMBSPLITS] = { 2, 2, 4, 16};
@@ -155,17 +155,6 @@ const vp8_tree_index vp8_sub_mv_ref_tree[6] =
-ZERO4X4, -NEW4X4
};
-
-struct vp8_token_struct vp8_bmode_encodings [VP8_BINTRAMODES];
-struct vp8_token_struct vp8_ymode_encodings [VP8_YMODES];
-struct vp8_token_struct vp8_kf_ymode_encodings [VP8_YMODES];
-struct vp8_token_struct vp8_uv_mode_encodings [VP8_UV_MODES];
-struct vp8_token_struct vp8_mbsplit_encodings [VP8_NUMMBSPLITS];
-
-struct vp8_token_struct vp8_mv_ref_encoding_array [VP8_MVREFS];
-struct vp8_token_struct vp8_sub_mv_ref_encoding_array [VP8_SUBMVREFS];
-
-
const vp8_tree_index vp8_small_mvtree [14] =
{
2, 8,
@@ -177,7 +166,101 @@ const vp8_tree_index vp8_small_mvtree [14] =
-6, -7
};
-struct vp8_token_struct vp8_small_mvencodings [8];
+/* Function used to generate the token tables below */
+/*
+void vp8_entropy_mode_init()
+{
+ vp8_tokens_from_tree(vp8_bmode_encodings, vp8_bmode_tree);
+ vp8_tokens_from_tree(vp8_ymode_encodings, vp8_ymode_tree);
+ vp8_tokens_from_tree(vp8_kf_ymode_encodings, vp8_kf_ymode_tree);
+ vp8_tokens_from_tree(vp8_uv_mode_encodings, vp8_uv_mode_tree);
+ vp8_tokens_from_tree(vp8_mbsplit_encodings, vp8_mbsplit_tree);
+
+ vp8_tokens_from_tree_offset(vp8_mv_ref_encoding_array,
+ vp8_mv_ref_tree, NEARESTMV);
+ vp8_tokens_from_tree_offset(vp8_sub_mv_ref_encoding_array,
+ vp8_sub_mv_ref_tree, LEFT4X4);
+
+ vp8_tokens_from_tree(vp8_small_mvencodings, vp8_small_mvtree);
+}
+*/
+
+const struct vp8_token_struct vp8_bmode_encodings[VP8_BINTRAMODES] =
+{
+ {0, 1},
+ {2, 2},
+ {6, 3},
+ {28, 5},
+ {30, 5},
+ {58, 6},
+ {59, 6},
+ {62, 6},
+ {126, 7},
+ {127, 7}
+};
+
+const struct vp8_token_struct vp8_ymode_encodings[VP8_YMODES] =
+{
+ {0, 1},
+ {4, 3},
+ {5, 3},
+ {6, 3},
+ {7, 3}
+};
+
+const struct vp8_token_struct vp8_kf_ymode_encodings[VP8_YMODES] =
+{
+ {4, 3},
+ {5, 3},
+ {6, 3},
+ {7, 3},
+ {0, 1}
+};
+
+const struct vp8_token_struct vp8_uv_mode_encodings[VP8_UV_MODES] =
+{
+ {0, 1},
+ {2, 2},
+ {6, 3},
+ {7, 3}
+};
+
+const struct vp8_token_struct vp8_mbsplit_encodings[VP8_NUMMBSPLITS] =
+{
+ {6, 3},
+ {7, 3},
+ {2, 2},
+ {0, 1}
+};
+
+const struct vp8_token_struct vp8_mv_ref_encoding_array[VP8_MVREFS] =
+{
+ {2, 2},
+ {6, 3},
+ {0, 1},
+ {14, 4},
+ {15, 4}
+};
+
+const struct vp8_token_struct vp8_sub_mv_ref_encoding_array[VP8_SUBMVREFS] =
+{
+ {0, 1},
+ {2, 2},
+ {6, 3},
+ {7, 3}
+};
+
+const struct vp8_token_struct vp8_small_mvencodings[8] =
+{
+ {0, 3},
+ {1, 3},
+ {2, 3},
+ {3, 3},
+ {4, 3},
+ {5, 3},
+ {6, 3},
+ {7, 3}
+};
void vp8_init_mbmode_probs(VP8_COMMON *x)
{
@@ -246,20 +329,3 @@ void vp8_kf_default_bmode_probs(vp8_prob p [VP8_BINTRAMODES] [VP8_BINTRAMODES] [
}
while (++i < VP8_BINTRAMODES);
}
-
-
-void vp8_entropy_mode_init()
-{
- vp8_tokens_from_tree(vp8_bmode_encodings, vp8_bmode_tree);
- vp8_tokens_from_tree(vp8_ymode_encodings, vp8_ymode_tree);
- vp8_tokens_from_tree(vp8_kf_ymode_encodings, vp8_kf_ymode_tree);
- vp8_tokens_from_tree(vp8_uv_mode_encodings, vp8_uv_mode_tree);
- vp8_tokens_from_tree(vp8_mbsplit_encodings, vp8_mbsplit_tree);
-
- vp8_tokens_from_tree_offset(vp8_mv_ref_encoding_array,
- vp8_mv_ref_tree, NEARESTMV);
- vp8_tokens_from_tree_offset(vp8_sub_mv_ref_encoding_array,
- vp8_sub_mv_ref_tree, LEFT4X4);
-
- vp8_tokens_from_tree(vp8_small_mvencodings, vp8_small_mvtree);
-}
diff --git a/vp8/common/entropymode.h b/vp8/common/entropymode.h
index f4b48ff43..70200cb5f 100644
--- a/vp8/common/entropymode.h
+++ b/vp8/common/entropymode.h
@@ -52,22 +52,20 @@ extern const vp8_tree_index vp8_mbsplit_tree[];
extern const vp8_tree_index vp8_mv_ref_tree[];
extern const vp8_tree_index vp8_sub_mv_ref_tree[];
-extern struct vp8_token_struct vp8_bmode_encodings [VP8_BINTRAMODES];
-extern struct vp8_token_struct vp8_ymode_encodings [VP8_YMODES];
-extern struct vp8_token_struct vp8_kf_ymode_encodings [VP8_YMODES];
-extern struct vp8_token_struct vp8_uv_mode_encodings [VP8_UV_MODES];
-extern struct vp8_token_struct vp8_mbsplit_encodings [VP8_NUMMBSPLITS];
+extern const struct vp8_token_struct vp8_bmode_encodings[VP8_BINTRAMODES];
+extern const struct vp8_token_struct vp8_ymode_encodings[VP8_YMODES];
+extern const struct vp8_token_struct vp8_kf_ymode_encodings[VP8_YMODES];
+extern const struct vp8_token_struct vp8_uv_mode_encodings[VP8_UV_MODES];
+extern const struct vp8_token_struct vp8_mbsplit_encodings[VP8_NUMMBSPLITS];
/* Inter mode values do not start at zero */
-extern struct vp8_token_struct vp8_mv_ref_encoding_array [VP8_MVREFS];
-extern struct vp8_token_struct vp8_sub_mv_ref_encoding_array [VP8_SUBMVREFS];
+extern const struct vp8_token_struct vp8_mv_ref_encoding_array[VP8_MVREFS];
+extern const struct vp8_token_struct vp8_sub_mv_ref_encoding_array[VP8_SUBMVREFS];
extern const vp8_tree_index vp8_small_mvtree[];
-extern struct vp8_token_struct vp8_small_mvencodings [8];
-
-void vp8_entropy_mode_init(void);
+extern const struct vp8_token_struct vp8_small_mvencodings[8];
void vp8_init_mbmode_probs(VP8_COMMON *x);
diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h
index 7743ed5c5..c3215c0ef 100644
--- a/vp8/common/onyxc_int.h
+++ b/vp8/common/onyxc_int.h
@@ -26,10 +26,6 @@
#include "header.h"
/*#endif*/
-/* Create/destroy static data structures. */
-
-void vp8_initialize_common(void);
-
#define MINQ 0
#define MAXQ 127
#define QINDEX_RANGE (MAXQ + 1)
diff --git a/vp8/decoder/onyxd_if.c b/vp8/decoder/onyxd_if.c
index 353290dd4..94993572c 100644
--- a/vp8/decoder/onyxd_if.c
+++ b/vp8/decoder/onyxd_if.c
@@ -49,7 +49,6 @@ void vp8dx_initialize()
if (!init_done)
{
- vp8_initialize_common();
vp8_scale_machine_specific_config();
init_done = 1;
}
diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c
index ac80fabcd..7e56f8e53 100644
--- a/vp8/encoder/onyx_if.c
+++ b/vp8/encoder/onyx_if.c
@@ -218,7 +218,6 @@ void vp8_initialize()
if (!init_done)
{
vp8_scale_machine_specific_config();
- vp8_initialize_common();
init_done = 1;
}