From 8f52cdbbd3e91f16a8fa9c764c2e25623d7be632 Mon Sep 17 00:00:00 2001 From: tterribe Date: Fri, 4 Jan 2008 20:12:47 +0000 Subject: [PATCH] Small code reduction in oc_vlc_mv_comp_unpack(). git-svn-id: http://svn.xiph.org/trunk@14361 0101bb08-14d6-0310-b084-bc0e0c8e3800 --- theora-exp/lib/decode.c | 35 +++++++++++++---------------------- theora/lib/dec/decode.c | 35 +++++++++++++---------------------- 2 files changed, 26 insertions(+), 44 deletions(-) diff --git a/theora-exp/lib/decode.c b/theora-exp/lib/decode.c index e3291a4ad..e1bfa96a5 100644 --- a/theora-exp/lib/decode.c +++ b/theora-exp/lib/decode.c @@ -537,30 +537,21 @@ static int oc_vlc_mv_comp_unpack(oggpack_buffer *_opb){ 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); - 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); + /*case 5: + case 6: + case 7:*/ + default:{ + mvsigned[0]=1<>1); bits&=1; }break; } diff --git a/theora/lib/dec/decode.c b/theora/lib/dec/decode.c index d34b602fa..2ae5cfc89 100644 --- a/theora/lib/dec/decode.c +++ b/theora/lib/dec/decode.c @@ -651,30 +651,21 @@ static int oc_vlc_mv_comp_unpack(oggpack_buffer *_opb){ 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); - 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); + /*case 5: + case 6: + case 7:*/ + default:{ + mvsigned[0]=1<>1); bits&=1; }break; } -- 2.11.4.GIT