Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Atif_Atif
Beginner
95 Views

How to encode Bitmap (RGB Data) to JPEG?

I have literally spent 2 days going through ipp samples & trying to figure out the process to convert pixels in RGB format to JPEG. I find it very annoying that there isn't a single method to do that and the whole process requires multiple complex calls to ipp and requires understanding of jpeg compression scheme....everything in IPP is overly complicated??

So can anyone Please tell me how to convertan array ofRGB data to JPEG...that can I just write to a file. If you can copy/paste the relevant code that would be best!

PS. I tried to understand Huffman coding etc but it all goes over my head *sorry*...so I just need the c++ code to get the job done.

0 Kudos
6 Replies
Vladimir_Dudnik
Employee
95 Views

Hi Atif,

were you able to locate IPP image-codecs samples? They contain high level implementation of JPEG/JPEG2000/PNG codecs and hide complexity with simple C++ interface.

Regards,
Vladimir
renegr
New Contributor I
95 Views

all said before ....
Atif_Atif
Beginner
95 Views

Hi Vladimir,
Yes, I went through many files in the codecs folder, including jpegenc.cpp. Which file in particular are u talking about?

The problem I'm having is that I can't findclear cut instructionsabout the usage of ippi. I havean array of RGB data and I need to know which functions to apply and in what order to get the jpeg file. I'll be doing in-memory conversions and lots of those...so the generic code thatloads pixel data into an image class and then writes to a file is too inefficient for me.

So can you please provide me the simple code that does what I need? Btw, I havesearched the forums, but couldn't find what I wanted...since most of the replies to the questions tell the person to look at the samples - which I've already done.

Thanks!
PaulF_IntelCorp
Employee
95 Views

Hello Atif,

The partitioning of IPP functions is a difficult compromise to achieve. The functions need to meet the needs of the low-level algorithm expert along with those of the high-level application developer.

The functions are built to be low-level just so you can customize and adapt their use to your specific needs. Unfortunately, in some cases the process required to use them means having to understand some complex algorithms, or at least being able to reproduce them from existing implementations.

Regarding the samples and your needs, it seems like the UIC samples are the best place to start. Take a look at the uic_transcoder_con application, which is a console application that utilizes the UIC framework. Obviously, you'll need to disassemble those parts of the app that suit your need, but that's why we provide these samples!

The uic_transcoder_con application can be found here:

...\IPP-samples\6.1.x.yyy\image-codecs\uic\src\application\uic_transcoder_con\

Hope this helps,

Paul
Atif_Atif
Beginner
95 Views

Hi Paul,
I've looked at the sample again, first of all I can't even get it to compile because there is no visual studio .sln file...and setting up all the files in visual studio is taking way too long. Secondly, the code is designed to work with several classes in uic framwork which is making it even harder for me to understand the code.

Can you please tell me in few short steps as to which functions to call to convert RGB data to JPEG? that'll at least give me some idea as to what I need to do.

Thanks,
Atif
Vladimir_Dudnik
Employee
95 Views

Hi Atif,

you should definetely be able to build IPP samples even without visual studio solution files. If you really look through samples you may noticed that every IPP sample comes with build environment based on Makefile and also accompanied with readme.htm file which describes steps required to build and run sample.

The UIC samples even comes with separate prebuilt binary package, so you even do not need to boring with build procedure. And if you are able to run either picnic or uic_transcoder_con application you can easely see how to convert RGB data to JPEG.

Hope this help.

Regards,
Vladimir
Reply