[xiph-commits] r8988 - experimental/derf/theora-exp/lib

tterribe at motherfish-iii.xiph.org tterribe at motherfish-iii.xiph.org
Fri Feb 25 19:58:37 PST 2005


Author: tterribe
Date: 2005-02-25 19:58:36 -0800 (Fri, 25 Feb 2005)
New Revision: 8988

Modified:
   experimental/derf/theora-exp/lib/decode.c
   experimental/derf/theora-exp/lib/internal.c
Log:
Some minor changes.

* Add a comment explaining the extra entries in the zig-zag table.
* Eliminate one call to theora_read from oc_block_run_unpack.
* Eliminate a multiply where bit-twiddling will do.
* Fix the pipeline delays so that if both the loop filter and
 post-processing are disabled, no delay is introduced at all.

Modified: experimental/derf/theora-exp/lib/decode.c
===================================================================
--- experimental/derf/theora-exp/lib/decode.c	2005-02-26 03:44:24 UTC (rev 8987)
+++ experimental/derf/theora-exp/lib/decode.c	2005-02-26 03:58:36 UTC (rev 8988)
@@ -147,6 +147,7 @@
 
 static int oc_block_run_unpack(oggpack_buffer *_opb){
   long bits;
+  long bits2;
   /*Coding scheme:
      Codeword             Run Length
      0x                      1-2
@@ -167,13 +168,10 @@
     theora_read(_opb,2,&bits);
     return 7+(int)bits;
   }
-  theora_read1(_opb,&bits);
-  if(!bits){
-    theora_read(_opb,2,&bits);
-    return 11+bits;
-  }
-  theora_read(_opb,4,&bits);
-  return 15+bits;
+  theora_read(_opb,3,&bits);
+  if((bits&4)==0)return 11+bits;
+  theora_read(_opb,2,&bits2);
+  return 15+((bits&3)<<2)+bits2;
 }
 
 
@@ -1583,7 +1581,7 @@
   notstart=_fragy0>0;
   notdone=_fragy_end<fplane->nvfrags;
   /*We want to clear an extra row of variances, except at the end.*/
-  memset(variance+notstart*fplane->nhfrags,0,
+  memset(variance+(fplane->nhfrags&-notstart),0,
    (_fragy_end+notdone-_fragy0-notstart)*fplane->nhfrags*sizeof(variance[0]));
   /*Except for the first time, we want to point to the middle of the row.*/
   y=(_fragy0<<3)+(notstart<<2);
@@ -2008,22 +2006,29 @@
         oc_state_borders_fill_rows(&_dec->state,refi,pli,
          (pipe.fragy0[pli]-sdelay<<3)-(sdelay<<1),
          (pipe.fragy_end[pli]-edelay<<3)-(edelay<<1));
-        sdelay+=notstart;
-        edelay+=notdone;
         /*Out-of-loop post-processing.*/
         pp_offset=3*(pli!=0);
         if(pipe.pp_level>=OC_PP_LEVEL_DEBLOCKY+pp_offset){
-          /*Perform de-blocking in the Y plane.*/
+          /*Perform de-blocking in one plane.*/
+          sdelay+=notstart;
+          edelay+=notdone;
           oc_dec_deblock_frag_rows(_dec,_dec->pp_frame_buf,
            _dec->state.ref_frame_bufs[refi],pli,
            pipe.fragy0[pli]-sdelay,pipe.fragy_end[pli]-edelay);
           if(pipe.pp_level>=OC_PP_LEVEL_DERINGY+pp_offset){
+            /*Perform de-ringing in one plane.*/
             sdelay+=notstart;
             edelay+=notdone;
             oc_dec_dering_frag_rows(_dec,_dec->pp_frame_buf,pli,
              pipe.fragy0[pli]-sdelay,pipe.fragy_end[pli]-edelay);
           }
         }
+        /*If no post-processing is done, we still need to delay a row for the
+           loop filter, thanks to the strange filtering order VP3 chose.*/
+        else if(pipe.loop_filter){
+          sdelay+=notstart;
+          edelay+=notdone;
+        }
         /*Compute the intersection of the available rows in all planes.
           If chroma is sub-sampled, the effect of each of its delays is
            doubled, but luma might have more post-processing filters enabled

Modified: experimental/derf/theora-exp/lib/internal.c
===================================================================
--- experimental/derf/theora-exp/lib/internal.c	2005-02-26 03:44:24 UTC (rev 8987)
+++ experimental/derf/theora-exp/lib/internal.c	2005-02-26 03:58:36 UTC (rev 8988)
@@ -7,7 +7,9 @@
 
 
 /*A map from the index in the zig zag scan to the coefficient number in a
-   block.*/
+   block.
+  All zig zag indices beyond 63 are sent to coefficient 64, so that zero runs
+   past the end of a block in bogus streams get mapped to a known location.*/
 const int OC_FZIG_ZAG[128]={
    0, 1, 8,16, 9, 2, 3,10,
   17,24,32,25,18,11, 4, 5,



More information about the commits mailing list