/src/c-blosc2/plugins/codecs/zfp/src/template/revdecodef.c
Line | Count | Source |
1 | | #include <string.h> |
2 | | |
3 | | /* private functions ------------------------------------------------------- */ |
4 | | |
5 | | /* reinterpret two's complement integers as floating values */ |
6 | | static void |
7 | | _t1(rev_inv_reinterpret, Scalar)(Int* iblock, Scalar* fblock, uint n) |
8 | 0 | { |
9 | | /* convert two's complement integers to sign-magnitude integers */ |
10 | 0 | uint i; |
11 | 0 | for (i = 0; i < n; i++) { |
12 | 0 | Int x = iblock[i]; |
13 | 0 | if (x < 0) |
14 | 0 | iblock[i] = (Int)((UInt)x ^ TCMASK); |
15 | 0 | } |
16 | | /* reinterpret sign-magnitude integers as floating values */ |
17 | 0 | memcpy(fblock, iblock, n * sizeof(*fblock)); |
18 | 0 | } Unexecuted instantiation: decode1d.c:rev_inv_reinterpret_double Unexecuted instantiation: decode1f.c:rev_inv_reinterpret_float Unexecuted instantiation: decode2d.c:rev_inv_reinterpret_double Unexecuted instantiation: decode2f.c:rev_inv_reinterpret_float Unexecuted instantiation: decode3d.c:rev_inv_reinterpret_double Unexecuted instantiation: decode3f.c:rev_inv_reinterpret_float Unexecuted instantiation: decode4d.c:rev_inv_reinterpret_double Unexecuted instantiation: decode4f.c:rev_inv_reinterpret_float |
19 | | |
20 | | /* decode contiguous floating-point block using reversible algorithm */ |
21 | | static uint |
22 | | _t2(rev_decode_block, Scalar, DIMS)(zfp_stream* zfp, Scalar* fblock) |
23 | 0 | { |
24 | 0 | uint bits = 0; |
25 | 0 | cache_align_(Int iblock[BLOCK_SIZE]); |
26 | | /* test whether block is all-zero */ |
27 | 0 | bits++; |
28 | 0 | if (stream_read_bit(zfp->stream)) { |
29 | | /* non-zero block; test whether to use block-floating-point transform */ |
30 | 0 | bits++; |
31 | 0 | if (stream_read_bit(zfp->stream)) { |
32 | | /* decode integer block */ |
33 | 0 | bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); |
34 | | /* reinterpret integers as floating values */ |
35 | 0 | _t1(rev_inv_reinterpret, Scalar)(iblock, fblock, BLOCK_SIZE); |
36 | 0 | } |
37 | 0 | else { |
38 | | /* decode common exponent */ |
39 | 0 | int emax; |
40 | 0 | bits += EBITS; |
41 | 0 | emax = (int)stream_read_bits(zfp->stream, EBITS) - EBIAS; |
42 | | /* decode integer block */ |
43 | 0 | bits += _t2(rev_decode_block, Int, DIMS)(zfp->stream, zfp->minbits - bits, zfp->maxbits - bits, iblock); |
44 | | /* perform inverse block-floating-point transform */ |
45 | 0 | _t1(rev_inv_cast, Scalar)(iblock, fblock, BLOCK_SIZE, emax); |
46 | 0 | } |
47 | 0 | } |
48 | 0 | else { |
49 | | /* all-zero block; set all values to zero */ |
50 | 0 | uint i; |
51 | 0 | for (i = 0; i < BLOCK_SIZE; i++) |
52 | 0 | *fblock++ = 0; |
53 | 0 | if (zfp->minbits > bits) { |
54 | 0 | stream_skip(zfp->stream, zfp->minbits - bits); |
55 | 0 | bits = zfp->minbits; |
56 | 0 | } |
57 | 0 | } |
58 | 0 | return bits; |
59 | 0 | } Unexecuted instantiation: decode1d.c:rev_decode_block_double_1 Unexecuted instantiation: decode1f.c:rev_decode_block_float_1 Unexecuted instantiation: decode2d.c:rev_decode_block_double_2 Unexecuted instantiation: decode2f.c:rev_decode_block_float_2 Unexecuted instantiation: decode3d.c:rev_decode_block_double_3 Unexecuted instantiation: decode3f.c:rev_decode_block_float_3 Unexecuted instantiation: decode4d.c:rev_decode_block_double_4 Unexecuted instantiation: decode4f.c:rev_decode_block_float_4 |