natix.CompactDS.DiffSetRL2.Build C# (CSharp) Method

Build() public method

build methods
public Build ( IEnumerable orderedList, int n, short b, IIEncoder32 coder = null ) : void
orderedList IEnumerable
n int
b short
coder IIEncoder32
return void
        public void Build(IEnumerable<int> orderedList, int n, short b, IIEncoder32 coder = null)
        {
            this.N = n;
            this.B = b;
            this.M = 0;
            if (coder == null) {
                coder = new EliasDelta ();
            }
            this.Coder = coder;
            int prev = -1;
            var ctx = new BitStreamCtxRL ();

            foreach (var current in orderedList) {
                if (current == 0) {
                    prev = AccStart;
                }
                this.M++;
                int diff = current - prev;
                //Console.WriteLine ("DIFF {0}, num: {1}", diff, num++);
                if (diff == 1) {
                    ++ctx.run_len;
                } else {
                    this.Commit (ctx);
                    // Console.WriteLine ("%%%%%% diff: {0}, prev: {1}, curr: {2}", diff, prev, current);
                    Coder.Encode (this.Stream, diff);
                }
                if (this.M % this.B == 0) {
                    this.Commit (ctx);
                    this.Samples.Add (current);
                    this.Offsets.Add (this.Stream.CountBits);
                }
                if (current >= this.N) {
                    this.N = current + 1;
                }
                prev = current;
            }
            this.Commit (ctx);
            /*for (int i = 0; i < this.Samples.Count; i++) {
                Console.WriteLine ("-- i: {0}, samples: {1}, offset: {2}", i, Samples[i], Offsets[i]);
            }*/
        }

Same methods

DiffSetRL2::Build ( IList orderedList, short b, IIEncoder32 coder = null ) : void

Usage Example

Ejemplo n.º 1
0
 public static BitmapFromList GetDiffSetRL2(short sample_step, IIEncoder32 coder = null)
 {
     return delegate (IList<int> L) {
         var rs = new DiffSetRL2 ();
         rs.Build (L, sample_step, coder);
         return rs;
     };
 }
All Usage Examples Of natix.CompactDS.DiffSetRL2::Build