[xiph-commits] r15081 - branches/theora-thusnelda/lib/enc
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Sat Jun 28 13:18:43 PDT 2008
Author: xiphmont
Date: 2008-06-28 13:18:42 -0700 (Sat, 28 Jun 2008)
New Revision: 15081
Modified:
branches/theora-thusnelda/lib/enc/mode.c
Log:
Correct an mv choice correctness bug in 4mv->1mv mode demotion
Correct MV bit counting for partially-coded 4mv macroblocks
Modified: branches/theora-thusnelda/lib/enc/mode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mode.c 2008-06-28 03:25:28 UTC (rev 15080)
+++ branches/theora-thusnelda/lib/enc/mode.c 2008-06-28 20:18:42 UTC (rev 15081)
@@ -996,8 +996,6 @@
switch(mode){
case CODE_INTER_PLUS_MV:
- cpi->MVBits_0 += mb_mv_bits_0;
- cpi->MVBits_1 += 12;
mb->mv[0] = mb->mv[1] = mb->mv[2] = mb->mv[3] = mb->analysis_mv[0][0];
break;
case CODE_INTER_LAST_MV:
@@ -1007,12 +1005,8 @@
mb->mv[0] = mb->mv[1] = mb->mv[2] = mb->mv[3] = prior_mv;
break;
case CODE_INTER_FOURMV:
- cpi->MVBits_0 += mb_4mv_bits_0;
- cpi->MVBits_1 += mb_4mv_bits_1;
break;
case CODE_GOLDEN_MV:
- cpi->MVBits_0 += mb_gmv_bits_0;
- cpi->MVBits_1 += 12;
mb->mv[0] = mb->mv[1] = mb->mv[2] = mb->mv[3] = mb->analysis_mv[0][1];
break;
default:
@@ -1027,7 +1021,11 @@
switch(mb->mode){
case CODE_INTER_PLUS_MV:
prior_mv = last_mv;
- last_mv = mb->analysis_mv[0][0];
+ last_mv = mb->mv[0]; /* not the same as analysis_mv[0][0]
+ if we're backing out from a 4mv */
+
+ cpi->MVBits_0 += mb_mv_bits_0;
+ cpi->MVBits_1 += 12;
break;
case CODE_INTER_PRIOR_LAST:
{
@@ -1036,21 +1034,24 @@
last_mv = temp;
}
break;
+ case CODE_GOLDEN_MV:
+ cpi->MVBits_0 += mb_gmv_bits_0;
+ cpi->MVBits_1 += 12;
+ break;
case CODE_INTER_FOURMV:
prior_mv = last_mv;
- if(mb->coded & 0x8)
- last_mv = mb->mv[3];
- else if(mb->coded & 0x4)
- last_mv = mb->mv[2];
- else if(mb->coded & 0x2)
- last_mv = mb->mv[1];
- else
- last_mv = mb->mv[0];
+
+ for(i=0;i<4;i++)
+ if(mb->coded & (1<<i){
+ cpi->MVBits_0 +=
+ MvBits[mb->mv[i].x + MAX_MV_EXTENT] +
+ MvBits[mb->mv[i].y + MAX_MV_EXTENT];
+ cpi->MV_Bits_1 += 12;
+ last_mv = mb->mv[i];
+ }
break;
- default:
- break;
}
-
+
oc_mode_set(cpi,mb,mb->mode);
interbits += cost[mb->mode];
More information about the commits
mailing list