Code class0 using aom_read() / aom_write().

The av1_mv_class0_tree is a balanced tree with two leafs and can
 simply be coded as a boolean with probability class0[0].
If CLASS0_SIZE is ever changed from 1, this change will need to be
 reverted.

Change-Id: If294dac825a5f945371092c74aa8e3f84cd962b6
This commit is contained in:
Nathan E. Egge
2016-09-08 17:25:49 -04:00
committed by Yaowu Xu
parent 72762a2827
commit 45ea963f0b
2 changed files with 2 additions and 5 deletions

View File

@@ -746,7 +746,7 @@ static int read_mv_component(aom_reader *r, const nmv_component *mvcomp,
// Integer part // Integer part
if (class0) { if (class0) {
d = aom_read_tree(r, av1_mv_class0_tree, mvcomp->class0, ACCT_STR); d = aom_read(r, mvcomp->class0[0], ACCT_STR);
mag = 0; mag = 0;
} else { } else {
int i; int i;

View File

@@ -23,12 +23,10 @@
static struct av1_token mv_joint_encodings[MV_JOINTS]; static struct av1_token mv_joint_encodings[MV_JOINTS];
static struct av1_token mv_class_encodings[MV_CLASSES]; static struct av1_token mv_class_encodings[MV_CLASSES];
static struct av1_token mv_fp_encodings[MV_FP_SIZE]; static struct av1_token mv_fp_encodings[MV_FP_SIZE];
static struct av1_token mv_class0_encodings[CLASS0_SIZE];
void av1_entropy_mv_init(void) { void av1_entropy_mv_init(void) {
av1_tokens_from_tree(mv_joint_encodings, av1_mv_joint_tree); av1_tokens_from_tree(mv_joint_encodings, av1_mv_joint_tree);
av1_tokens_from_tree(mv_class_encodings, av1_mv_class_tree); av1_tokens_from_tree(mv_class_encodings, av1_mv_class_tree);
av1_tokens_from_tree(mv_class0_encodings, av1_mv_class0_tree);
av1_tokens_from_tree(mv_fp_encodings, av1_mv_fp_tree); av1_tokens_from_tree(mv_fp_encodings, av1_mv_fp_tree);
} }
@@ -53,8 +51,7 @@ static void encode_mv_component(aom_writer *w, int comp,
// Integer bits // Integer bits
if (mv_class == MV_CLASS_0) { if (mv_class == MV_CLASS_0) {
av1_write_token(w, av1_mv_class0_tree, mvcomp->class0, aom_write(w, d, mvcomp->class0[0]);
&mv_class0_encodings[d]);
} else { } else {
int i; int i;
const int n = mv_class + CLASS0_BITS - 1; // number of bits const int n = mv_class + CLASS0_BITS - 1; // number of bits