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

tterribe at svn.xiph.org tterribe at svn.xiph.org
Fri Jan 4 09:38:41 PST 2008


Author: tterribe
Date: 2008-01-04 09:38:40 -0800 (Fri, 04 Jan 2008)
New Revision: 14342

Modified:
   trunk/theora-exp/lib/decode.c
   trunk/theora-exp/lib/encint.h
   trunk/theora-exp/lib/state.c
   trunk/theora/lib/dec/decode.c
   trunk/theora/lib/dec/state.c
Log:
Port j^'s reduction of the bv array to 256 entries from r12826.


Modified: trunk/theora/lib/dec/decode.c
===================================================================
--- trunk/theora/lib/dec/decode.c	2008-01-04 17:29:00 UTC (rev 14341)
+++ trunk/theora/lib/dec/decode.c	2008-01-04 17:38:40 UTC (rev 14342)
@@ -1484,7 +1484,7 @@
   int  ti[3][64];
   int  ebi[3][64];
   int  eob_runs[3][64];
-  int  bounding_values[512];
+  int  bounding_values[256];
   int *coded_fragis[3];
   int *uncoded_fragis[3];
   int  fragy0[3];

Modified: trunk/theora/lib/dec/state.c
===================================================================
--- trunk/theora/lib/dec/state.c	2008-01-04 17:29:00 UTC (rev 14341)
+++ trunk/theora/lib/dec/state.c	2008-01-04 17:38:40 UTC (rev 14342)
@@ -993,6 +993,9 @@
   for(y=0;y<8;y++){
     int f;
     f=_pix[0]-_pix[3]+3*(_pix[2]-_pix[1]);
+    /*The _bv array is used to compute the function
+      f=OC_CLAMPI(OC_MINI(-_2flimit-f,0),f,OC_MAXI(_2flimit-f,0));
+      where _2flimit=_state->loop_filter_limits[_state->qis[0]]<<1;*/
     f=*(_bv+(f+4>>3));
     _pix[1]=OC_CLAMP255(_pix[1]+f);
     _pix[2]=OC_CLAMP255(_pix[2]-f);
@@ -1006,6 +1009,9 @@
   for(y=0;y<8;y++){
     int f;
     f=_pix[0]-_pix[_ystride*3]+3*(_pix[_ystride*2]-_pix[_ystride]);
+    /*The _bv array is used to compute the function
+      f=OC_CLAMPI(OC_MINI(-_2flimit-f,0),f,OC_MAXI(_2flimit-f,0));
+      where _2flimit=_state->loop_filter_limits[_state->qis[0]]<<1;*/
     f=*(_bv+(f+4>>3));
     _pix[_ystride]=OC_CLAMP255(_pix[_ystride]+f);
     _pix[_ystride*2]=OC_CLAMP255(_pix[_ystride*2]-f);
@@ -1021,12 +1027,12 @@
   int i;
   flimit=_state->loop_filter_limits[_state->qis[0]];
   if(flimit==0)return 1;
-  memset(_bv,0,sizeof(_bv[0])*512);
+  memset(_bv,0,sizeof(_bv[0])*256);
   for(i=0;i<flimit;i++){
-    _bv[256-i-flimit]=i-flimit;
-    _bv[256-i]=-i;
-    _bv[256+i]=i;
-    _bv[256+i+flimit]=flimit-i;
+    if(127-i-flimit>=0)_bv[127-i-flimit]=i-flimit;
+    _bv[127-i]=-i;
+    _bv[127+i]=i;
+    if(127+i+flimit<256)_bv[127+i+flimit]=flimit-i;
   }
   return 0;
 }
@@ -1055,7 +1061,7 @@
   oc_fragment       *frag_end;
   oc_fragment       *frag0_end;
   oc_fragment       *frag_bot;
-  _bv+=256;
+  _bv+=127;
   iplane=_state->ref_frame_bufs[_refi]+_pli;
   fplane=_state->fplanes+_pli;
 

Modified: trunk/theora-exp/lib/decode.c
===================================================================
--- trunk/theora-exp/lib/decode.c	2008-01-04 17:29:00 UTC (rev 14341)
+++ trunk/theora-exp/lib/decode.c	2008-01-04 17:38:40 UTC (rev 14342)
@@ -1318,7 +1318,7 @@
   int  ti[3][64];
   int  ebi[3][64];
   int  eob_runs[3][64];
-  int  bounding_values[512];
+  int  bounding_values[256];
   int *coded_fragis[3];
   int *uncoded_fragis[3];
   int  fragy0[3];

Modified: trunk/theora-exp/lib/encint.h
===================================================================
--- trunk/theora-exp/lib/encint.h	2008-01-04 17:29:00 UTC (rev 14341)
+++ trunk/theora-exp/lib/encint.h	2008-01-04 17:38:40 UTC (rev 14342)
@@ -210,7 +210,7 @@
     This is determined each frame, based on the quantizer it is encoded with.*/
   int                      loop_filter_enabled;
   /*The bounding value array used for the loop filter.*/
-  int                      bounding_values[512];
+  int                      bounding_values[256];
   /*The huffman tables in use.*/
   th_huff_code             huff_codes[TH_NHUFFMAN_TABLES][TH_NDCT_TOKENS];
   /*The quantization parameters in use.*/

Modified: trunk/theora-exp/lib/state.c
===================================================================
--- trunk/theora-exp/lib/state.c	2008-01-04 17:29:00 UTC (rev 14341)
+++ trunk/theora-exp/lib/state.c	2008-01-04 17:38:40 UTC (rev 14342)
@@ -917,6 +917,9 @@
   for(y=0;y<8;y++){
     int f;
     f=_pix[0]-_pix[3]+3*(_pix[2]-_pix[1]);
+    /*The _bv array is used to compute the function
+      f=OC_CLAMPI(OC_MINI(-_2flimit-f,0),f,OC_MAXI(_2flimit-f,0));
+      where _2flimit=_state->loop_filter_limits[_state->qis[0]]<<1;*/
     f=*(_bv+(f+4>>3));
     _pix[1]=OC_CLAMP255(_pix[1]+f);
     _pix[2]=OC_CLAMP255(_pix[2]-f);
@@ -930,6 +933,9 @@
   for(y=0;y<8;y++){
     int f;
     f=_pix[0]-_pix[_ystride*3]+3*(_pix[_ystride*2]-_pix[_ystride]);
+    /*The _bv array is used to compute the function
+      f=OC_CLAMPI(OC_MINI(-_2flimit-f,0),f,OC_MAXI(_2flimit-f,0));
+      where _2flimit=_state->loop_filter_limits[_state->qis[0]]<<1;*/
     f=*(_bv+(f+4>>3));
     _pix[_ystride]=OC_CLAMP255(_pix[_ystride]+f);
     _pix[_ystride*2]=OC_CLAMP255(_pix[_ystride*2]-f);
@@ -945,12 +951,12 @@
   int i;
   flimit=_state->loop_filter_limits[_state->qis[0]];
   if(flimit==0)return 1;
-  memset(_bv,0,sizeof(_bv[0])*512);
+  memset(_bv,0,sizeof(_bv[0])*256);
   for(i=0;i<flimit;i++){
-    _bv[256-i-flimit]=i-flimit;
-    _bv[256-i]=-i;
-    _bv[256+i]=i;
-    _bv[256+i+flimit]=flimit-i;
+    if(127-i-flimit>=0)_bv[127-i-flimit]=i-flimit;
+    _bv[127-i]=-i;
+    _bv[127+i]=i;
+    if(127+i+flimit<256)_bv[127+i+flimit]=flimit-i;
   }
   return 0;
 }
@@ -979,7 +985,7 @@
   oc_fragment       *frag_end;
   oc_fragment       *frag0_end;
   oc_fragment       *frag_bot;
-  _bv+=256;
+  _bv+=127;
   iplane=_state->ref_frame_bufs[_refi]+_pli;
   fplane=_state->fplanes+_pli;
   /*The following loops are constructed somewhat non-intuitively on purpose.



More information about the commits mailing list