[xiph-commits] r15739 - branches/theora-thusnelda/lib/dec

tterribe at svn.xiph.org tterribe at svn.xiph.org
Wed Mar 4 16:43:29 PST 2009


Author: tterribe
Date: 2009-03-04 16:43:28 -0800 (Wed, 04 Mar 2009)
New Revision: 15739

Modified:
   branches/theora-thusnelda/lib/dec/quant.c
Log:
Don't eat up 8KB of stack when we already have heap storage for it allocated.


Modified: branches/theora-thusnelda/lib/dec/quant.c
===================================================================
--- branches/theora-thusnelda/lib/dec/quant.c	2009-03-03 18:45:12 UTC (rev 15738)
+++ branches/theora-thusnelda/lib/dec/quant.c	2009-03-05 00:43:28 UTC (rev 15739)
@@ -45,17 +45,18 @@
   int          pli;
   for(qti=0;qti<2;qti++){
     for(pli=0;pli<3;pli++){
-      oc_quant_tables stage;
       /*Quality index.*/
       int qi;
       /*Range iterator.*/
       int qri;
       for(qi=0,qri=0; qri<=_qinfo->qi_ranges[qti][pli].nranges;qri++){
-        th_quant_base base;
-        ogg_uint32_t  q;
-        int           qi_start;
-        int           qi_end;
-        int           ci;
+        oc_quant_table *qtables;
+        th_quant_base   base;
+        ogg_uint32_t    q;
+        int             qi_start;
+        int             qi_end;
+        int             ci;
+        qtables=_dequant[qti][pli];
         memcpy(base,_qinfo->qi_ranges[qti][pli].base_matrices[qri],
          sizeof(base));
         qi_start=qi;
@@ -63,7 +64,7 @@
         else qi_end=qi+_qinfo->qi_ranges[qti][pli].sizes[qri];
         /*Iterate over quality indicies in this range.*/
         for(;;){
-          ogg_uint32_t qfac;
+          ogg_uint32_t  qfac;
           /*In the original VP3.2 code, the rounding offset and the size of the
              dead zone around 0 were controlled by a "sharpness" parameter.
             The size of our dead zone is now controlled by the per-coefficient
@@ -79,12 +80,12 @@
           /*Scale DC the coefficient from the proper table.*/
           q=(qfac/100)<<2;
           q=OC_CLAMPI(OC_DC_QUANT_MIN[qti],q,OC_QUANT_MAX);
-          stage[qi][0]=(ogg_uint16_t)q;
+          qtables[qi][0]=(ogg_uint16_t)q;
           /*Now scale AC coefficients from the proper table.*/
           for(ci=1;ci<64;ci++){
             q=((ogg_uint32_t)_qinfo->ac_scale[qi]*base[ci]/100)<<2;
             q=OC_CLAMPI(OC_AC_QUANT_MIN[qti],q,OC_QUANT_MAX);
-            stage[qi][ci]=(ogg_uint16_t)q;
+            qtables[qi][ci]=(ogg_uint16_t)q;
           }
           if(++qi>=qi_end)break;
           /*Interpolate the next base matrix.*/
@@ -107,7 +108,8 @@
         dupe=0;
         for(qtj=0;qtj<=qti;qtj++){
           for(plj=0;plj<(qtj<qti?3:pli);plj++){
-            if(!memcmp(stage,_dequant[qtj][plj],sizeof(stage))){
+            if(!memcmp(_dequant[qti][pli],_dequant[qtj][plj],
+             sizeof(oc_quant_tables))){
               dupe=1;
               break;
             }
@@ -115,7 +117,6 @@
           if(dupe)break;
         }
         if(dupe)_dequant[qti][pli]=_dequant[qtj][plj];
-        else memcpy(_dequant[qti][pli],stage,sizeof(stage));
       }
     }
   }



More information about the commits mailing list