Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6709 Discussions

Does UIC support partially decode for ultra-high resolution JPEG ?

Kilik_K_
Beginner
283 Views

Hi, 

I'm trying to decode a 8k x 6k JPEG in 16bits color depth and then make the color channels from RGB to BGRA, but I can NOT allocate a large continuous memory space for it, it's about 366 MB= 274 MB(RGB,16bit)+92 MB(A,16bits). And I want to divide them into seperated memory blocks inside the process(x32) virtual space.

I knew and tried that WIC(window image component) has the ability to decode image by specifiying a WICRect (x,y,width,height). 

So I traced the UIC source code (uic_jpeg_dec.cpp, jpeg.cpp, jpegdec.cpp, etc...), It looks like that I can do what I want by setting a ROI information in ImageSamplingGeometry.

Sad thing was, it failed for me. No matter how I config the origin in geometry.RefGridRect(), I can only got the result buffer starting from (0, 0) even I set the origin to (0, 1000) for example.

Here's my calling procedure. (To decode 8k x 6k jpeg)

1. I allocate 8k * 1k memory space (so in this case, I will need to do ROI decode six times for different y position)

2. Attach this memory block to a CIppImage and pass this CIppImage instance to ReadImageJPEG(BaseStreamInput& in, PARAMS_JPEG& param, CIppImage& image) in jpeg.cpp

3. Set the target decode ROI information (0, 1000, 8k, 1k) to a (ImageSamplingGeometry)variable, called geometry.

4. Then attached the input buffer(CIppImage) to a (UIC.Image) imageCn by calling this imageCn.Buffer().Attach(&dataPtr,dataOrder,geometry);

5. And jpegdec.ReadData(imageCn.Buffer().DataPtr(),dataOrder) is performed.

My Question is ...

1. Does UIC support ROI decode?  I didn't found any code refering to the input origin.

2. If UIC supports, what do I miss in the procedure above ?

Great thanks in advance.

0 Kudos
2 Replies
levicki
Valued Contributor I
283 Views
If by 16-bit you men per channel then that is your problem. As far as I know UIC does not support such bit depth. I have successfully decoded larger images than yours so the size should not be a problem. By the way, 32-bit process should be able to allocate that much contiguous memory. If you cannot, then check the base addresses of all DLLs loaded by your application and make sure they are not fragmenting your process address space. You can rebase your own DLLs (and even the ones you will redistribute) but in order for that to work you need to disable ASLR.
0 Kudos
Sergey_K_Intel
Employee
283 Views
Hi! Yes, UIC by design is not capable to process encoding/decoding using ROIs (or slices). It may the problem, because the size of images is growing quickly. We'll look of what can be done in this direction. 16-bit pixels in UIC can be used in JPEG lossless mode only. Regards, Sergey
0 Kudos
Reply