[xiph-commits] r15117 - branches/theora-thusnelda/lib/enc

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Jul 17 11:34:39 PDT 2008


Author: xiphmont
Date: 2008-07-17 11:34:38 -0700 (Thu, 17 Jul 2008)
New Revision: 15117

Modified:
   branches/theora-thusnelda/lib/enc/mode.c
Log:
Add a dead zone to DC quant as a hysteresis measure as we can't
currently directly optimize DC tokens.



Modified: branches/theora-thusnelda/lib/enc/mode.c
===================================================================
--- branches/theora-thusnelda/lib/enc/mode.c	2008-07-17 00:08:38 UTC (rev 15116)
+++ branches/theora-thusnelda/lib/enc/mode.c	2008-07-17 18:34:38 UTC (rev 15117)
@@ -642,7 +642,20 @@
     int i;
     quant_tables *qq = ps->qq[mode != CODE_INTRA];
     
-    for(i=0;i<64;i++){
+    {
+      int d;
+      if(abs(buffer[0])>=dequant[0]){
+	int val = (((iq[0]>>15)*buffer[0]) + (1<<15) + (((iq[0]&0x7fff)*buffer[0])>>15)) >>16;
+	val = (val>511?511:(val<-511?-511:val));
+	
+	d = val*dequant[0]-buffer[0];
+	coded_partial_ssd += d*d;
+	data[0] = val;
+      }else
+	data[0] = 0;
+    }
+    
+    for(i=1;i<64;i++){
       int ii = dezigzag_index[i];
       //int pos;
       //int val = abs(buffer[ii])<<1;
@@ -657,11 +670,14 @@
       //data[i] = 0;
       //coded_partial_ssd += buffer[ii]*buffer[ii];
       //}else
+
+
       {
 	int d;
 	int val = (((iq[ii]>>15)*buffer[ii]) + (1<<15) + (((iq[ii]&0x7fff)*buffer[ii])>>15)) >>16;
 	val = (val>511?511:(val<-511?-511:val));
 
+
 	d = val*dequant[i]-buffer[ii];
 	coded_partial_ssd += d*d;
 	data[i] = val;



More information about the commits mailing list