// Decode side is specced and easier, because we don't need to find // matches using different criteria; we simply read and map. There are // two things we need to do 'depending': // // We may need to support interleave. We don't really, but it's // convenient to do it here rather than rebuild the vector later. // // Cascades may be additive or multiplicitive; this is not inherent in // the codebook, but set in the code using the codebook. Like // interleaving, it's easiest to do it here. // stage==0 -> declarative (set the value) // stage==1 -> additive // stage==2 -> multiplicitive // returns the entry number or -1 on eof internal int decode(csBuffer b) { int ptr=0; DecodeAux t=decode_tree; int lok=b.Look(t.tabn); //System.err.println(this+" "+t+" lok="+lok+", tabn="+t.tabn); if(lok>=0) { ptr=t.tab[lok]; b.Adv(t.tabl[lok]); if(ptr<=0) { return -ptr; } } do { switch(b.Read1()) { case 0: ptr=t.ptr0[ptr]; break; case 1: ptr=t.ptr1[ptr]; break; case -1: default: return(-1); } } while(ptr>0); return(-ptr); }