I have created my own DCT calculation.
How do I use jpeg_write_coefficients to write my 64 DCT values into JPEG file using jpeg_write_coefficients (it needs jvirt_barray_ptr * coef_arrays)?
How do I create this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Look around for the
request_virt_barrayfunction (injmemmgr.c).Also have a look at this question. It’s reading DCT coefficients as opposed to writing them, but it should give you an idea of how coefficient arrays are stored like. Aside from the coefficients, you also need to pass in the quantization table (through the
j_compress_ptr cinfostruct). This is because inside the libjpeg library, forward DCT and quantization is performed in one step. If you want to do the forward DCT by yourself, you have to do the quantization yourself too.It’s also worth reading through the libjpeg documentation. It’s long, but actually quite readable, and will greatly improve your understanding of the library. The most helpful file is
structure.txt. It has sections on memory management and the encoder structure that are likely to help you.