Git Product home page Git Product logo

dct_cuda's People

Contributors

jeremiemelo avatar scopex-asu avatar zixuanjiang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

dct_cuda's Issues

Enhancement on the project

Generality

  • The 2d implementation should also support 1d input.
  • What if input is not a power of 2

Specificity

  • Optimization for cases where M = N = 2^x

FFT implementation

Documentation

  • Add comments and documentations

Building on Colab

Hi, I'm quite new to using Torch with CUDA kernels. I'm struggling to build it on Colab, do you have any advice or resources you can point me to?

Thank you so much!

Result is different with opencv

Thanks for your great work!
I cloned your project ,and try to use it to do something . Then I try to generate a dct result by opencv , I used cv2.dct,then ,write the result to harddrive ad you did in script "src/dct_pytorch.py" ,but the results are quite different ,see below ,it's produced by your bin file bin/dct2d_cuda

[I] Error! Results are incorrect.
index: 0, result: 20.012664, GT: 5123.242097, scale: 0.003906
index: 1, result: -0.013377, GT: -4.842896, scale: 0.002762
index: 2, result: 0.011195, GT: 4.052967, scale: 0.002762
index: 3, result: -0.001353, GT: -0.489889, scale: 0.002762
index: 4, result: 0.001098, GT: 0.397660, scale: 0.002762
index: 5, result: 0.001302, GT: 0.471319, scale: 0.002762
index: 6, result: -0.001707, GT: -0.617927, scale: 0.002762
index: 7, result: 0.002289, GT: 0.828868, scale: 0.002762
index: 8, result: 0.009278, GT: 3.359035, scale: 0.002762
index: 9, result: -0.000801, GT: -0.289940, scale: 0.002762
index: 10, result: 0.005129, GT: 1.856900, scale: 0.002762
index: 11, result: 0.009032, GT: 3.269778, scale: 0.002762
index: 12, result: -0.000099, GT: -0.035807, scale: 0.002762
index: 13, result: 0.001421, GT: 0.514459, scale: 0.002762
index: 14, result: 0.010225, GT: 3.701966, scale: 0.002762
index: 15, result: -0.007186, GT: -2.601680, scale: 0.002762
index: 16, result: 0.000024, GT: 0.008796, scale: 0.002762
index: 17, result: -0.011907, GT: -4.310903, scale: 0.002762
index: 18, result: -0.010924, GT: -3.954782, scale: 0.002762
index: 19, result: -0.010288, GT: -3.724749, scale: 0.002762
index: 20, result: -0.005418, GT: -1.961669, scale: 0.002762
index: 21, result: 0.010174, GT: 3.683218, scale: 0.002762
index: 22, result: -0.002510, GT: -0.908892, scale: 0.002762
index: 23, result: -0.002990, GT: -1.082518, scale: 0.002762
index: 24, result: -0.010692, GT: -3.870906, scale: 0.002762
index: 25, result: -0.001337, GT: -0.483995, scale: 0.002762
index: 26, result: -0.002254, GT: -0.816180, scale: 0.002762
index: 27, result: 0.008054, GT: 2.916009, scale: 0.002762
index: 28, result: -0.003147, GT: -1.139196, scale: 0.002762
index: 29, result: 0.000077, GT: 0.027921, scale: 0.002762
index: 30, result: -0.008187, GT: -2.964190, scale: 0.002762
index: 31, result: 0.012992, GT: 4.703643, scale: 0.002762
index: 32, result: 0.006220, GT: 2.251814, scale: 0.002762
index: 33, result: 0.006298, GT: 2.280054, scale: 0.002762
index: 34, result: 0.008639, GT: 3.127580, scale: 0.002762
index: 35, result: 0.018885, GT: 6.837267, scale: 0.002762
index: 36, result: 0.001276, GT: 0.462017, scale: 0.002762
index: 37, result: -0.004175, GT: -1.511421, scale: 0.002762
index: 38, result: 0.001766, GT: 0.639508, scale: 0.002762
index: 39, result: 0.016754, GT: 6.065430, scale: 0.002762
index: 40, result: 0.008063, GT: 2.919008, scale: 0.002762
index: 41, result: -0.015651, GT: -5.666278, scale: 0.002762
index: 42, result: -0.001663, GT: -0.602239, scale: 0.002762
index: 43, result: 0.006152, GT: 2.227197, scale: 0.002762
index: 44, result: -0.001554, GT: -0.562456, scale: 0.002762
index: 45, result: 0.010431, GT: 3.776602, scale: 0.002762
index: 46, result: 0.002027, GT: 0.733966, scale: 0.002762
index: 47, result: 0.003972, GT: 1.438157, scale: 0.002762
index: 48, result: -0.007528, GT: -2.725495, scale: 0.002762
index: 49, result: -0.005630, GT: -2.038441, scale: 0.002762
index: 50, result: -0.007534, GT: -2.727680, scale: 0.002762
index: 51, result: 0.005743, GT: 2.079118, scale: 0.002762
index: 52, result: 0.004871, GT: 1.763623, scale: 0.002762
index: 53, result: -0.019159, GT: -6.936130, scale: 0.002762
index: 54, result: 0.002538, GT: 0.918893, scale: 0.002762
index: 55, result: 0.001079, GT: 0.390727, scale: 0.002762
index: 56, result: -0.004035, GT: -1.460880, scale: 0.002762
index: 57, result: -0.002547, GT: -0.922088, scale: 0.002762
index: 58, result: -0.003600, GT: -1.303184, scale: 0.002762
index: 59, result: -0.005225, GT: -1.891828, scale: 0.002762
index: 60, result: 0.001384, GT: 0.501159, scale: 0.002762
index: 61, result: 0.015481, GT: 5.604717, scale: 0.002762
index: 62, result: 0.003500, GT: 1.267265, scale: 0.002762
index: 63, result: -0.004546, GT: -1.645787, scale: 0.002762
[D] dct 2D takes 220.885 ms
[D] dct 2D (1024 * 1024) takes average 220.897 ms

I want to know the reson ,and how can I produce the same result as OpenCV do ?
Looking forward to your answers !
THX !!!!

Some ideas of improvement on dct and idct

  • multiplying scale in precomputeExpk

  • zero paddings to avoid branch divergence

  • in-place or out-of-place cufft, especially in idct

  • number of threads in idct M/2 * N/2 or M/2 * (N/2+1)

  • other improvements based on profiling

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.