MCPcopy Create free account
hub / github.com/LASzip/LASzip / IntegerCompressor

Method IntegerCompressor

src/integercompressor.cpp:47–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45#endif
46
47IntegerCompressor::IntegerCompressor(ArithmeticEncoder* enc, U32 bits, U32 contexts, U32 bits_high, U32 range)
48{
49 assert(enc);
50 this->enc = enc;
51 this->dec = 0;
52 this->bits = bits;
53 this->contexts = contexts;
54 this->bits_high = bits_high;
55 this->range = range;
56
57 if (range) // the corrector's significant bits and range
58 {
59 corr_bits = 0;
60 corr_range = range;
61 while (range)
62 {
63 range = range >> 1;
64 corr_bits++;
65 }
66 if (corr_range == (1u << (corr_bits-1)))
67 {
68 corr_bits--;
69 }
70 // the corrector must fall into this interval
71 corr_min = -((I32)(corr_range/2));
72 corr_max = corr_min + corr_range - 1;
73 }
74 else if (bits && bits < 32)
75 {
76 corr_bits = bits;
77 corr_range = 1u << bits;
78 // the corrector must fall into this interval
79 corr_min = -((I32)(corr_range/2));
80 corr_max = corr_min + corr_range - 1;
81 }
82 else
83 {
84 corr_bits = 32;
85 corr_range = 0;
86 // the corrector must fall into this interval
87 corr_min = I32_MIN;
88 corr_max = I32_MAX;
89 }
90
91 k = 0;
92
93 mBits = 0;
94 mCorrector = 0;
95
96#ifdef CREATE_HISTOGRAMS
97 corr_histogram = (int**)malloc_las(sizeof(int*) * (corr_bits + 1));
98 for (int k = 0; k <= corr_bits; k++)
99 {
100 corr_histogram[k] = (int*)malloc_las(sizeof(int) * ((1 << k) + 1));
101 for (int c = 0; c <= (1<<k); c++)
102 {
103 corr_histogram[k][c] = 0;
104 }

Callers

nothing calls this directly

Calls 1

malloc_lasFunction · 0.85

Tested by

no test coverage detected