[Liblas-commits] laszip: alternate coder moves into main branch

liblas-commits at liblas.org liblas-commits at liblas.org
Mon Jan 18 23:57:02 EST 2010


changeset cfed1d96c9b2 in /Volumes/Data/www/liblas.org/laszip
details: http://hg.liblas.orglaszip?cmd=changeset;node=cfed1d96c9b2
summary: alternate coder moves into main branch

diffstat:

 src/alternate_coder_src/Makefile.am                   |   14 -
 src/alternate_coder_src/arithmeticdecoder.cpp         |  306 ---------
 src/alternate_coder_src/arithmeticdecoder.h           |  145 ----
 src/alternate_coder_src/arithmeticencoder.cpp         |  325 ----------
 src/alternate_coder_src/arithmeticencoder.h           |  149 ----
 src/alternate_coder_src/arithmeticmodel.cpp           |  196 ------
 src/alternate_coder_src/arithmeticmodel.h             |  139 ----
 src/alternate_coder_src/integercompressor_newest.cpp  |  585 ------------------
 src/alternate_coder_src/integercompressor_newest.h    |  176 -----
 src/alternate_coder_src/laspointreader0compressed.cpp |  264 --------
 src/alternate_coder_src/laspointreader0compressed.h   |  127 ---
 src/alternate_coder_src/laspointreader1compressed.cpp |  320 ---------
 src/alternate_coder_src/laspointreader1compressed.h   |  133 ----
 src/alternate_coder_src/laspointreader2compressed.cpp |  292 --------
 src/alternate_coder_src/laspointreader2compressed.h   |  130 ----
 src/alternate_coder_src/laspointreader3compressed.cpp |  347 ----------
 src/alternate_coder_src/laspointreader3compressed.h   |  136 ----
 src/alternate_coder_src/laspointwriter0compressed.cpp |  271 --------
 src/alternate_coder_src/laspointwriter0compressed.h   |  128 ---
 src/alternate_coder_src/laspointwriter1compressed.cpp |  339 ----------
 src/alternate_coder_src/laspointwriter1compressed.h   |  132 ----
 src/alternate_coder_src/laspointwriter2compressed.cpp |  299 ---------
 src/alternate_coder_src/laspointwriter2compressed.h   |  130 ----
 src/alternate_coder_src/laspointwriter3compressed.cpp |  366 -----------
 src/alternate_coder_src/laspointwriter3compressed.h   |  135 ----
 src/integercompressor_context.cpp                     |  553 -----------------
 src/integercompressor_context.h                       |  132 ----
 27 files changed, 0 insertions(+), 6269 deletions(-)

diffs (truncated from 6388 to 300 lines):

diff -r 692c74f8ff3a -r cfed1d96c9b2 src/alternate_coder_src/Makefile.am
--- a/src/alternate_coder_src/Makefile.am	Thu Jan 14 20:19:32 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-
-AM_CPPFLAGS = -I../../include -I..
-
-noinst_LTLIBRARIES = liblaszip_alternate.la
-liblaszip_alternate_la_SOURCES =	arithmeticdecoder.cpp \
-									arithmeticencoder.cpp \
-									arithmeticmodel.cpp \
-									integercompressor_newest.cpp \
-									laspointreader0compressed.cpp \
-									laspointreader1compressed.cpp \
-									laspointreader2compressed.cpp \
-									laspointwriter0compressed.cpp \
-									laspointwriter1compressed.cpp \
-									laspointwriter2compressed.cpp 
\ No newline at end of file
diff -r 692c74f8ff3a -r cfed1d96c9b2 src/alternate_coder_src/arithmeticdecoder.cpp
--- a/src/alternate_coder_src/arithmeticdecoder.cpp	Thu Jan 14 20:19:32 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,306 +0,0 @@
-/******************************************************************************
- *
- * Project:  laszip - http://liblas.org -
- * Purpose:
- * Author:   Martin Isenburg
- *           isenburg at cs.unc.edu
- *
- ******************************************************************************
- * Copyright (c) 2009, Martin Isenburg
- *
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation.
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
-/******************************************************************************
- *
- * Project:  laszip - http://liblas.org - 
- * Purpose:  
- * Author:   Martin Isenburg
- *           martin.isenburg at gmail.com
- *
- ******************************************************************************
- * Copyright (c) 2009, Martin Isenburg
- * 
- * This is free software; you can redistribute and/or modify it under
- * the terms of the GNU Lesser General Licence as published
- * by the Free Software Foundation. 
- *
- * See the COPYING file for more information.
- *
- ****************************************************************************/
-
-
-/*
-===============================================================================
-
-  FILE:  arithmeticdecoder.cpp
-  
-  CONTENTS:
-      
-    see header file
-
-  PROGRAMMERS:
-  
-    martin isenburg at cs.unc.edu
-  
-  COPYRIGHT:
-  
-    copyright (C) 2009 martin isenburg (isenburg at cs.unc.edu)
-    
-    This software is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  
-  CHANGE HISTORY:
-  
-    see header file
-  
-===============================================================================
-*/
-
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-
-
-    
-#include "arithmeticdecoder.h"
-
-
-namespace laszipalternate {
-    
-ArithmeticDecoder::ArithmeticDecoder(unsigned char* bytes, unsigned int number_bytes)
-{
-  inbuffer = bytes;
-  endbuffer = bytes + number_bytes;
-  fp = 0;
-
-  /*
-  if ((value = get_inbyte()) != AC_HEADER_BYTE)
-  {
-    fprintf(stderr, "ArithmeticDecoder: wrong AC_HEADER_BYTE of %d. is should be %d\n", value, AC_HEADER_BYTE);
-    return;
-  }
-  */
-
-  length = AC__MaxLength;
-  value = (get_inbyte() << 24);
-  value |= (get_inbyte() << 16);
-  value |= (get_inbyte() << 8);
-  value |= (get_inbyte());
-}
-
-ArithmeticDecoder::ArithmeticDecoder(FILE* fp)
-{
-  inbuffer = 0;
-  endbuffer = 0;
-  this->fp = fp;
-
-/*
-  if ((value = get_inbyte()) != AC_HEADER_BYTE)
-  {
-    fprintf(stderr, "ArithmeticDecoder: wrong AC_HEADER_BYTE of %d. is should be %d\n", value, AC_HEADER_BYTE);
-    return;
-  }
-*/
-
-  length = AC__MaxLength;
-  value = (get_inbyte() << 24);
-  value |= (get_inbyte() << 16);
-  value |= (get_inbyte() << 8);
-  value |= (get_inbyte());
-}
-
-unsigned int ArithmeticDecoder::decode(ArithmeticBitModel* m)
-{
-  unsigned int x = m->bit_0_prob * (length >> BM__LengthShift); // product l x p0
-  unsigned int sym = (value >= x);                                 // decision
-                                                    // update & shift interval
-  if (sym == 0) {
-    length  = x;
-    ++m->bit_0_count;
-  }
-  else {
-    value  -= x;                                 // shifted interval base = 0
-    length -= x;
-  }
-
-  if (length < AC__MinLength) renorm_dec_interval();        // renormalization
-  if (--m->bits_until_update == 0) m->update();       // periodic model update
-
-  return sym;                                         // return data bit value
-}
-
-unsigned int ArithmeticDecoder::decode(ArithmeticModel* m)
-{
-  unsigned n, sym, x, y = length;
-
-  if (m->decoder_table) {              // use table look-up for faster decoding
-
-    unsigned dv = value / (length >>= DM__LengthShift);
-    unsigned t = dv >> m->table_shift;
-
-    sym = m->decoder_table[t];         // initial decision based on table look-up
-    n = m->decoder_table[t+1] + 1;
-
-    while (n > sym + 1) {                        // finish with bisection search
-      unsigned int k = (sym + n) >> 1;
-      if (m->distribution[k] > dv) n = k; else sym = k;
-    }
-                                                           // compute products
-    x = m->distribution[sym] * length;
-    if (sym != m->last_symbol) y = m->distribution[sym+1] * length;
-  }
-
-  else {                                  // decode using only multiplications
-
-    x = sym = 0;
-    length >>= DM__LengthShift;
-    unsigned int k = (n = m->data_symbols) >> 1;
-                                                // decode via bisection search
-    do {
-      unsigned int z = length * m->distribution[k];
-      if (z > value) {
-        n = k;
-        y = z;                                             // value is smaller
-      }
-      else {
-        sym = k;
-        x = z;                                     // value is larger or equal
-      }
-    } while ((k = (sym + n) >> 1) != sym);
-  }
-
-  value -= x;                                               // update interval
-  length = y - x;
-
-  if (length < AC__MinLength) renorm_dec_interval();        // renormalization
-
-  ++m->symbol_count[sym];
-  if (--m->symbols_until_update == 0) m->update(false); // periodic model update
-
-  return sym;
-}
-
-unsigned int ArithmeticDecoder::readBits(unsigned int bits)
-{
-  assert(bits && (bits <= 32));
-
-  if (bits > 20)
-  {
-    unsigned int tmp = readShort();
-    bits = bits - 16;
-    unsigned int tmp1 = readBits(bits) << 16;
-    return (tmp1|tmp);
-  }
-
-  unsigned int sym = value / (length >>= bits);// decode symbol, change length
-  value -= length * sym;                                    // update interval
-
-  if (length < AC__MinLength) renorm_dec_interval();        // renormalization
-
-  return sym;
-}
-
-unsigned char ArithmeticDecoder::readByte()
-{
-  unsigned int sym = value / (length >>= 8);   // decode symbol, change length
-  value -= length * sym;                                    // update interval
-
-  if (length < AC__MinLength) renorm_dec_interval();        // renormalization
-
-  assert(sym < (1<<8));
-
-  return (unsigned char)sym;
-}
-
-unsigned short ArithmeticDecoder::readShort()
-{
-  unsigned int sym = value / (length >>= 16);  // decode symbol, change length
-  value -= length * sym;                                    // update interval
-
-  if (length < AC__MinLength) renorm_dec_interval();        // renormalization
-
-  assert(sym < (1<<16));
-
-  return (unsigned short)sym;
-}
-
-unsigned int ArithmeticDecoder::readInt()
-{
-  unsigned int lowerInt = readShort();
-  unsigned int upperInt = readShort();
-  return upperInt*65536+lowerInt;
-}
-
-float ArithmeticDecoder::readFloat()
-{
-  float f;
-  *((unsigned int*)(&f)) = readInt();
-  return f;
-}
-
-U64 ArithmeticDecoder::readInt64()
-{
-  U64 lowerInt = readInt();
-  U64 upperInt = readInt();
-  return upperInt*4294967296+lowerInt;
-}
-
-double ArithmeticDecoder::readDouble()
-{
-  double d;
-  *((U64*)(&d)) = readInt64();
-  return d;
-}
-
-void ArithmeticDecoder::done()
-{
-}
-
-ArithmeticDecoder::~ArithmeticDecoder()
-{
-}
-
-inline void ArithmeticDecoder::renorm_dec_interval()
-{
-  do {                                          // read least-significant byte
-    value = (value << 8) | get_inbyte();
-  } while ((length <<= 8) < AC__MinLength);        // length multiplied by 256
-}
-


More information about the Liblas-commits mailing list