Lines Matching defs:of

6  * under the terms of the GNU General Public License version 2 only, as
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * You should have received a copy of the GNU General Public License version
35 * Define the conversions between sequences of small integers and raw bytes.
36 * This is a schema of encodings which incorporates varying lengths,
37 * varying degrees of length variability, and varying amounts of signed-ness.
57 Therefore, if L==0, the code always has the full length of B bytes.
59 (Also, if L==128, the high bit of each byte acts signals the presence
60 of a following byte, up to the maximum length.)
63 in the ordering of byte sequences defined by appending zero bytes
67 Therefore, the unsigned value of a byte sequence may be defined as:
95 If S>0, the unsigned value of a byte sequence is regarded as a binary
96 integer. If any of the S low-order bits are zero, the corresponding
97 signed value will be non-negative. If all of the S low-order bits
101 (from 0) in the ordering of the corresponding unsigned values.
104 (from -1) in the ordering of the corresponding unsigned values.
117 Finally, the value of a byte sequence, given the coding parameters
124 of unsigned values may be found by sign-encoding the largest unsigned
128 of codings. For optimal compression, it is necessary to adaptively
131 For example, if a sequence of values happens never to be negative,
137 the largest 32-bit value, and if the number R of values it does
141 A delta version of a given (B,H,S) coding encodes an array of integers
144 running accumulation of sum of the differences as they are read.
147 version will only encode arrays of numbers in the coding's unsigned
148 range, [0..R-1]. The coding of deltas is still in the normal signed
150 reduced to the signed range, by adding multiples of R. Likewise,
152 This special case for subranges allows the benefits of wraparound
153 when encoding correlated sequences of very small positive numbers.
166 // Code range for a all (B,H) codes of length <=nMax (<=B).
172 if (nMax == 0) return 0; // no codes of zero length
191 return -1; // degenerate max value for empty set of codes
227 // Some of the arithmetic below is on unsigned 32-bit integers.
238 assert(ux >= -1); // can be out of 32-bit range; who cares
266 // Assert special case of S==1:
291 // Top-level coding of single integers:
309 // Report number of bytes written by updating outpos[0]:
327 // Report number of bytes read by updating inpos[0]:
358 private final int del; /*0..2*/ // type of delta encoding (0 == none)
404 private static synchronized Coding of(int B, int H, int S, int del) {
412 public static Coding of(int B, int H) {
413 return of(B, H, 0, 0);
416 public static Coding of(int B, int H, int S) {
417 return of(B, H, S, 0);
428 * this tests whether a delta value of 'x' can be coded.
494 // The following code is a buffered version of this loop:
510 /** Tell if the range of this coding (number of distinct
526 /** Return the number of values this coding (a subrange) can represent. */
532 Coding setB(int B) { return Coding.of(B, H, S, del); }
533 Coding setH(int H) { return Coding.of(B, H, S, del); }
534 Coding setS(int S) { return Coding.of(B, H, S, del); }
536 Coding setD(int del) { return Coding.of(B, H, S, del); }
542 return Coding.of(B, H, 0, del-1);
548 * by adding or subtracting a multiple of (max-min+1).
620 /** Heuristic measure of the difference between two codings. */
632 // Distance in log space of H (<=128) and L (<128).
635 // Double the accuracy of the log:
648 // Follow H in log space by the multiplicative inverse of L.
676 /** Number of significant bits in i, not counting sign bits.
701 /** Create an array of successive differences.
705 * multiples of the range cardinality (max-min+1).
772 /** How many bytes are in the coding of this value?
805 //return Coding.of(B, H, S).getLength(deltas, 0, len);
815 int longer = 0; // count of guys longer than n bytes
865 res[0] = Coding.of(B, H, S, del);