10 #ifndef vtk_m_worklet_zfp_decode_h
11 #define vtk_m_worklet_zfp_decode_h
27 template <
typename Int,
typename Scalar>
52 inline VTKM_EXEC vtkm::Int64 dequantize<vtkm::Int64, vtkm::Int64>(
const vtkm::Int64&,
58 template <
class Int, vtkm::UInt32 s>
101 template <vtkm::Int64 BlockSize>
107 template <
typename Int>
110 unsigned int x, y, z;
112 for (y = 0; y < 4; y++)
113 for (x = 0; x < 4; x++)
114 inv_lift<Int, 16>(p + 1 * x + 4 * y);
116 for (x = 0; x < 4; x++)
117 for (z = 0; z < 4; z++)
118 inv_lift<Int, 4>(p + 16 * z + 1 * x);
120 for (z = 0; z < 4; z++)
121 for (y = 0; y < 4; y++)
122 inv_lift<Int, 1>(p + 4 * y + 16 * z);
129 template <
typename Int>
133 for (
int x = 0; x < 4; ++x)
135 inv_lift<Int, 4>(p + 1 * x);
137 for (
int y = 0; y < 4; ++y)
139 inv_lift<Int, 1>(p + 4 * y);
147 template <
typename Int>
158 return static_cast<vtkm::Int64
>((x ^ 0xaaaaaaaaaaaaaaaaull) - 0xaaaaaaaaaaaaaaaaull);
164 return static_cast<vtkm::Int32>((x ^ 0xaaaaaaaau) - 0xaaaaaaaau);
170 template <
int Size,
typename Portal>
192 for (; n < BlockSize && bits && (bits--, reader.read_bit()); x += (
Word)1 << n++)
193 for (; n < (BlockSize - 1) && bits && (bits--, !reader.read_bit()); n++)
197 for (
int i = 0; x; i++, x >>= 1)
199 data[i] += (UInt)(x & 1u) << k;
204 template <vtkm::Int32 BlockSize,
typename Scalar,
typename PortalType>
216 if (!zfp::is_int<Scalar>())
226 if (!zfp::is_int<Scalar>())
229 emax -=
static_cast<vtkm::UInt32>(zfp::get_ebias<Scalar>());
238 UInt ublock[BlockSize];
239 decode_ints<BlockSize>(reader, maxbits, ublock, zfp::get_precision<Scalar>());
241 Int iblock[BlockSize];
250 trans.inv_xform(iblock);
252 Scalar inv_w = dequantize<Int, Scalar>(1,
static_cast<vtkm::Int32>(emax));
256 fblock[i] = inv_w * (Scalar)iblock[i];