Code class0 using vpx_read() / vpx_write().
authorNathan E. Egge <negge@mozilla.com>
Thu, 8 Sep 2016 21:25:49 +0000 (17:25 -0400)
committerAlex Converse <aconverse@google.com>
Mon, 19 Sep 2016 17:50:39 +0000 (10:50 -0700)
The vp9_mv_class0_tree is a balanced tree with two leafs and can
simply be coded as a boolean with probability class0[0].

Change-Id: If294dac825a5f945371092c74aa8e3f84cd962b6
(cherry picked from commit be8a8ab62ebdd111c6f2e9a33b15630570671eba)

vp9/decoder/vp9_decodemv.c
vp9/encoder/vp9_encodemv.c

index 7358c9a..cb9fe5f 100644 (file)
@@ -241,7 +241,7 @@ static int read_mv_component(vpx_reader *r, const nmv_component *mvcomp,
 
   // Integer part
   if (class0) {
-    d = vpx_read_tree(r, vp9_mv_class0_tree, mvcomp->class0);
+    d = vpx_read(r, mvcomp->class0[0]);
     mag = 0;
   } else {
     int i;
index 8e76f72..874a8e4 100644 (file)
 static struct vp9_token mv_joint_encodings[MV_JOINTS];
 static struct vp9_token mv_class_encodings[MV_CLASSES];
 static struct vp9_token mv_fp_encodings[MV_FP_SIZE];
-static struct vp9_token mv_class0_encodings[CLASS0_SIZE];
 
 void vp9_entropy_mv_init(void) {
   vp9_tokens_from_tree(mv_joint_encodings, vp9_mv_joint_tree);
   vp9_tokens_from_tree(mv_class_encodings, vp9_mv_class_tree);
-  vp9_tokens_from_tree(mv_class0_encodings, vp9_mv_class0_tree);
   vp9_tokens_from_tree(mv_fp_encodings, vp9_mv_fp_tree);
 }
 
@@ -51,8 +49,7 @@ static void encode_mv_component(vpx_writer *w, int comp,
 
   // Integer bits
   if (mv_class == MV_CLASS_0) {
-    vp9_write_token(w, vp9_mv_class0_tree, mvcomp->class0,
-                    &mv_class0_encodings[d]);
+    vpx_write(w, d, mvcomp->class0[0]);
   } else {
     int i;
     const int n = mv_class + CLASS0_BITS - 1;  // number of bits