Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would like to add 12bit greyscale support, where to start? #13

Open
smlehbleh opened this issue Aug 24, 2018 · 1 comment
Open

Would like to add 12bit greyscale support, where to start? #13

smlehbleh opened this issue Aug 24, 2018 · 1 comment

Comments

@smlehbleh
Copy link

Hello,
I'd like to add 12bit greyscale support if its not already on the horizon. I'm still trying to figure out how difficult a task it is.
Any pointers on where to start?

Cheers
Russell

@MartinPulec
Copy link
Collaborator

Hi Russel,

no, unfortunately we do not plan this. As for you question, if you check https://www.w3.org/Graphics/JPEG/itu-t81.pdf and look up the phrase "12-bit", you'll see, what is different against 8-bit. GPUJPEG already supports one channel grayscale 8-bit. So, from my point of view, there will be needed to implement following for encoder:

  1. preprocess - it depends on the packing of the source image, it may be needed to fit it to more "sparse" format (eg. 16-bit int) in order to allow DCT access the samples in more reasonable way (12-bit alignment is quite unsuitable for CUDA)
  2. DCT - is computed in float, so there should be sufficient to read the sample from the format from postprocess
  3. quantization - there will be perhaps more to do - there are more quantization tables, are different etc. While 8-bit source
  4. also huffman encoder would need to be extended

For decoder it should be more or less conversely.

Honestly, I am not the original author so I am not as much familiar with JPEG but the difficulty may depend on your experiences with the concepts or if you need to study them - it is not so hard but it will require some work (it is not the case that eg. extending the preprocessor is enough). Knowledge of CUDA is only secondary.

Regards,
Martin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants