class xf::compression::xfZlib

#include "zlib.hpp"

Overview

xfZlib class.


Methods

compress_buffer

size_t compress_buffer (
    uint8_t* in,
    uint8_t* out,
    size_t input_size,
    uint32_t host_buffer_size = HOST_BUFFER_SIZE,
    int cu = 0
    )

This method does the overlapped execution of compression where data transfers and kernel computation are overlapped.

Parameters:

in input byte sequence
out output byte sequence
input_size input size
host_buffer_size buffer size for kernel
cu comput unit name

deflate_buffer

size_t deflate_buffer (
    uint8_t* in,
    uint8_t* out,
    size_t& input_size,
    bool& last_data,
    bool last_buffer,
    const std::string& cu
    )

This method does the overlapped execution of compression where data transfers and kernel computation are overlapped.

Parameters:

in input byte sequence
out output byte sequence
input_size input size
last_data last compressed output buffer
last_buffer last input buffer
cu comput unit name

inflate_buffer

size_t inflate_buffer (
    uint8_t* in,
    uint8_t* out,
    size_t& input_size,
    size_t& output_size,
    bool& last_data,
    bool last_buffer,
    const std::string& cu_id
    )

This method does the overlapped execution of decompression where data transfers and kernel computation are overlapped.

Parameters:

in input byte sequence
out output byte sequence
input_size input size
last_data last compressed output buffer
last_buffer last input buffer
cu comput unit name

decompress

size_t decompress (
    uint8_t* in,
    uint8_t* out,
    size_t actual_size,
    size_t max_outbuf_size,
    int cu_run = 0
    )

This method does serial execution of decompression where data transfers and kernel execution in serial manner.

Parameters:

in input byte sequence
out output byte sequence
actual_size input size
cu_run compute unit number

compress

size_t compress (
    uint8_t* in,
    uint8_t* out,
    size_t input_size,
    int cu,
    int level = 1,
    int strategy = 0,
    int window_bits = 15
    )

This API does end to end compression in a single call.

Parameters:

in input byte sequence
out output byte sequence
input_size input size

compress_file

uint64_t compress_file (
    std::string& inFile_name,
    std::string& outFile_name,
    uint64_t input_size,
    int cu_run = 0
    )

This method does file operations and invokes compress API which internally does zlib compression on FPGA in overlapped manner.

Parameters:

inFile_name input file name
outFile_name output file name
actual_size input size

decompress_file

uint32_t decompress_file (
    std::string& inFile_name,
    std::string& outFile_name,
    uint64_t input_size,
    int cu_run
    )

This method does file operations and invokes decompress API which internally does zlib decompression on FPGA in overlapped manner.

Parameters:

inFile_name input file name
outFile_name output file name
input_size input size
cu_run compute unit number

xfZlib

xfZlib overload (1)

xfZlib (
    const std::string& binaryFile,
    bool sb_opt,
    uint8_t cd_flow,
    cl::Context* context,
    cl::Program* program,
    const cl::Device& device,
    enum design_flow dflow = XILINX_GZIP,
    const int bank_id = 0
    )

Constructor responsible for creating various host/device buffers. This gets context created already with it so skips ocl platform, device and context creation as part of it.

xfZlib overload (2)

xfZlib (
    const std::string& binaryFile,
    bool sb_opt = false,
    uint8_t c_max_cr = MAX_CR,
    uint8_t cd_flow = BOTH,
    uint8_t device_id = 0,
    uint8_t profile = 0,
    uint8_t d_type = DYNAMIC,
    enum design_flow dflow = XILINX_GZIP,
    uint8_t ccu = 0,
    uint8_t dcu = 0
    )

Constructor responsible for creating various host/device buffers.

init

int init (
    const std::string& binaryFile,
    uint8_t dtype
    )

OpenCL setup initialization.

Parameters:

binaryFile  

release

void release ()

OpenCL setup release.

~xfZlib

~xfZlib ()

Release host/device memory.

error_code

int error_code (void)

error_code of a OpenCL call

get_checksum

uint32_t get_checksum (void)

returns check sum value (CRC32/Adler32)

set_checksum

void set_checksum (uint32_t cval)

set check sum value (CRC32/Adler32)

getCompressKernel

std::string getCompressKernel (int index)

get compress kernel name

getDeCompressKernel

std::string getDeCompressKernel (int index)

get decompress kernel name