Git Product home page Git Product logo

enhanced-run-length-encoding's Introduction

Enhanced Run Length Encoding

A parallel data compression algorithm for store or transmission purposes based on run length encoding and elegant pairing function. To achieve higher compression ratios, the proposed method encodes the run length encoding matrix through a pairing function. Because a pairing function is a unique and a bijective function, it is possible to recover the data without losing information. This implementation is really fast using vectors with high sizes.

CUDA

This implementation uses the template library of CUDA and lambdas of C++. Also, we implemented a struct for RLE.

    thrusth::

    #include <thrust/device_vector.h>
    #include <thrust/host_vector.h>
    #include <thrust/transform.h>
    struct RLE {
        int x; // Value
        int y; // Number of repetitions
    };

Example of use

  1. Compile
    nvcc main.cu -std=c++11 --expt-extended-lambda
  1. Generate CPU array of size 'SIZE'
    #define SIZE 10000

    thrust::host_vector<RLE> rle(SIZE);
  1. Initialize host_vector. Import your RLE vectors. For example purposes the rle vector is filled with rand values.
  for (int i = 0; i < SIZE; i++) {
    rle[i].x = rand() % 100;
    rle[i].y = rand() % 100;
  }
  1. Define a device_vector containing the run length encoder
    thrust::device_vector<RLE> d_rle = rle;
  1. Compress on GPU
    thrust::device_vector<int> arrayCompressedDevice =  gpuEncoding(d_rle);

  1. Copy the GPU to CPU for store or transmission purposes.
    thrust::host_vector<int> arrayCompressedHost = arrayCompressedDevice;
  1. Decompression on GPU
    thrust::device_vector<RLE> res_rle_gpu = gpuDecoding(arrayCompressedDevice);

  1. Copy the GPU vector to CPU. Since, this algorithm is a lossless compression algorithm, the decoded vector must be similar to the original vector.
    thrust::host_vector<RLE> arrayDecompressedHost = res_rle_gpu;

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Authors and References

  • Article "An Enhanced Run Length Encoding for Image Compression based on Discrete Wavelet Transform" *

  • Proposed Enhanced Run Length Encoding:

  • Elegant Pairing Function

enhanced-run-length-encoding's People

Contributors

adolfos94 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

rohinighare

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.