Repository navigation
Expand file tree
/
Copy pathdecodef.c
More file actions
43 lines (39 loc) · 1.46 KB
/
Copy pathdecodef.c
File metadata and controls
43 lines (39 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
static uint _t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock);
/* private functions ------------------------------------------------------- */
/* decode contiguous floating-point block using lossy algorithm */
static uint
_t2(decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock)
{
uint bits = 1;
/* test if block has nonzero values */
if (stream_read_bit(zfp->stream)) {
cache_align_(Int iblock[BLOCK_SIZE]);
int emax, maxprec;
/* decode common exponent */
bits += EBITS;
emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS;
maxprec = precision(emax, zfp->maxprec, zfp->minexp, DIMS);
/* decode integer block */
bits += _t2(decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, maxprec, iblock);
/* perform inverse block-floating-point transform */
_t1(inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax);
}
else {
/* set all values to zero */
uint i;
for (i = 0; i < BLOCK_SIZE; i++)
*fblock++ = 0;
if (zfp->minbits > bits) {
stream_skip(zfp->stream, zfp->minbits - bits);
bits = zfp->minbits;
}
}
return bits;
}
/* public functions -------------------------------------------------------- */
/* decode contiguous floating-point block */
size_t
_t2(zfp_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock)
{
return REVERSIBLE(zfp) ? _t2(rev_decode_block, Scalar, DIMS)(zfp, fblock) : _t2(decode_block, Scalar, DIMS)(zfp, fblock);
}