def doDecompression( packedDataList, shape, n_threads ):
blosc.set_nthreads( n_threads )
dataList = [None] * len(packedDataList)
for J in np.arange(len(packedDataList) ):
# dataStack[J,:,:] = np.reshape(
# np.frombuffer( blosc.decompress( packedDataList[J] ), dtype='uint8' ),
# shape[1:] )
# Something here Numpy-side is very slow, so let's not include that in our
# benchmark.
dataList[J] = blosc.decompress( packedDataList[J] )
return dataList
#t_half0 = time.time()
#halfimage = dm4image_8bit[:,:,::2] + np.left_shift(dm4image_8bit[:,:,1::2],4)
#t_half1 = time.time()
#restoreimage = np.empty( header['dimensions'], dtype='uint8' )
##image[0::2] = np.left_shift(interlaced_image,4)/16
##image[1::2] = np.right_shift(interlaced_image,4)
## Different interlace option
## TODO: AND array with 15 instead?
#restoreimage[:,:,::2] = (np.left_shift( halfimage, 4 ) & 15 )
#restoreimage[:,:,1::2] = np.right_shift( halfimage, 4 )
#t_half2 = time.time()
#
#print( "4-byte encoding time (s): %f" % (t_half1 - t_half0) )
#print( "4-byte DEcoding time (s): %f" % (t_half2 - t_half1) )
评论列表
文章目录