]> granicus.if.org Git - libvpx/commitdiff
vp9_entropymv: remove vp9_get_mv_mag()
authorJames Zern <jzern@google.com>
Tue, 7 Jul 2015 03:49:28 +0000 (20:49 -0700)
committerJames Zern <jzern@google.com>
Tue, 7 Jul 2015 05:30:21 +0000 (22:30 -0700)
inline the code directly in read_mv_component(), the only place where it
was being used; this removes a function call in a hot function

Change-Id: I66f99c0c9ce3bc310101dbca4a470f023cc6fb55

vp9/common/vp9_entropymv.c
vp9/common/vp9_entropymv.h
vp9/decoder/vp9_decodemv.c

index 2477e6ef326ea8782488dc726fae6e10fb4ee141..76cdb05ce66cc937869309ee81546af1557ee94a 100644 (file)
@@ -132,10 +132,6 @@ int vp9_use_mv_hp(const MV *ref) {
          (abs(ref->col) >> 3) < COMPANDED_MVREF_THRESH;
 }
 
-int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset) {
-  return mv_class_base(c) + offset;
-}
-
 static void inc_mv_component(int v, nmv_component_counts *comp_counts,
                              int incr, int usehp) {
   int s, z, c, o, d, e, f;
index 75e6861f4da7e3cdd4d59a6c365f046f6546bb1a..637f4515887c8f88cd5451ce12dfa47a6303e075 100644 (file)
@@ -106,8 +106,6 @@ static INLINE MV_JOINT_TYPE vp9_get_mv_joint(const MV *mv) {
 }
 
 MV_CLASS_TYPE vp9_get_mv_class(int z, int *offset);
-int vp9_get_mv_mag(MV_CLASS_TYPE c, int offset);
-
 
 typedef struct {
   unsigned int sign[2];
index d587c8fa342197c2d20a7c5894c6741c6bbc9eec..0d08f8c8423283659d2e9afad7c5d5bba2d654a2 100644 (file)
@@ -242,6 +242,7 @@ static int read_mv_component(vp9_reader *r,
   // Integer part
   if (class0) {
     d = vp9_read_tree(r, vp9_mv_class0_tree, mvcomp->class0);
+    mag = 0;
   } else {
     int i;
     const int n = mv_class + CLASS0_BITS - 1;  // number of bits
@@ -249,6 +250,7 @@ static int read_mv_component(vp9_reader *r,
     d = 0;
     for (i = 0; i < n; ++i)
       d |= vp9_read(r, mvcomp->bits[i]) << i;
+    mag = CLASS0_SIZE << (mv_class + 2);
   }
 
   // Fractional part
@@ -260,7 +262,7 @@ static int read_mv_component(vp9_reader *r,
              : 1;
 
   // Result
-  mag = vp9_get_mv_mag(mv_class, (d << 3) | (fr << 1) | hp) + 1;
+  mag += ((d << 3) | (fr << 1) | hp) + 1;
   return sign ? -mag : mag;
 }