[xiph-commits] r14361 - in trunk: theora/lib/dec theora-exp/lib

tterribe at svn.xiph.org tterribe at svn.xiph.org
Fri Jan 4 12:12:47 PST 2008


Author: tterribe
Date: 2008-01-04 12:12:47 -0800 (Fri, 04 Jan 2008)
New Revision: 14361

Modified:
   trunk/theora-exp/lib/decode.c
   trunk/theora/lib/dec/decode.c
Log:
Small code reduction in oc_vlc_mv_comp_unpack().


Modified: trunk/theora/lib/dec/decode.c
===================================================================
--- trunk/theora/lib/dec/decode.c	2008-01-04 20:11:22 UTC (rev 14360)
+++ trunk/theora/lib/dec/decode.c	2008-01-04 20:12:47 UTC (rev 14361)
@@ -651,32 +651,23 @@
   int  mvsigned[2];
   theora_read(_opb,3,&bits);
   switch(bits){
-    case 0:return 0;
-    case 1:return 1;
-    case 2:return -1;
-    case 3:{
-      mvsigned[0]=2;
+    case  0:return 0;
+    case  1:return 1;
+    case  2:return -1;
+    case  3:
+    case  4:{
+      mvsigned[0]=(int)(bits-1);
       theora_read1(_opb,&bits);
     }break;
-    case 4:{
-      mvsigned[0]=3;
-      theora_read1(_opb,&bits);
-    }break;
-    case 5:{
-      theora_read(_opb,3,&bits);
-      mvsigned[0]=4+(bits>>1);
+    /*case  5:
+    case  6:
+    case  7:*/
+    default:{
+      mvsigned[0]=1<<bits-3;
+      theora_read(_opb,bits-2,&bits);
+      mvsigned[0]+=(int)(bits>>1);
       bits&=1;
     }break;
-    case 6:{
-      theora_read(_opb,4,&bits);
-      mvsigned[0]=8+(bits>>1);
-      bits&=1;
-    }break;
-    case 7:{
-      theora_read(_opb,5,&bits);
-      mvsigned[0]=16+(bits>>1);
-      bits&=1;
-    }break;
   }
   mvsigned[1]=-mvsigned[0];
   return mvsigned[bits];

Modified: trunk/theora-exp/lib/decode.c
===================================================================
--- trunk/theora-exp/lib/decode.c	2008-01-04 20:11:22 UTC (rev 14360)
+++ trunk/theora-exp/lib/decode.c	2008-01-04 20:12:47 UTC (rev 14361)
@@ -537,32 +537,23 @@
   int  mvsigned[2];
   theora_read(_opb,3,&bits);
   switch(bits){
-    case 0:return 0;
-    case 1:return 1;
-    case 2:return -1;
-    case 3:{
-      mvsigned[0]=2;
+    case  0:return 0;
+    case  1:return 1;
+    case  2:return -1;
+    case  3:
+    case  4:{
+      mvsigned[0]=(int)(bits-1);
       theora_read1(_opb,&bits);
     }break;
-    case 4:{
-      mvsigned[0]=3;
-      theora_read1(_opb,&bits);
-    }break;
-    case 5:{
-      theora_read(_opb,3,&bits);
-      mvsigned[0]=4+(bits>>1);
+    /*case  5:
+    case  6:
+    case  7:*/
+    default:{
+      mvsigned[0]=1<<bits-3;
+      theora_read(_opb,bits-2,&bits);
+      mvsigned[0]+=(int)(bits>>1);
       bits&=1;
     }break;
-    case 6:{
-      theora_read(_opb,4,&bits);
-      mvsigned[0]=8+(bits>>1);
-      bits&=1;
-    }break;
-    case 7:{
-      theora_read(_opb,5,&bits);
-      mvsigned[0]=16+(bits>>1);
-      bits&=1;
-    }break;
   }
   mvsigned[1]=-mvsigned[0];
   return mvsigned[bits];



More information about the commits mailing list