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

Ipp Jpeg conversion gets a lot of dirty gray fields i picture

nipp
Beginner
649 Views

Hi

Running Ipp 5.3.3.082 version and Mpeg4 and H264 works well, but Jpeg gets a lot of dirty fields in picture.

Here are two sample picture, original jpg and resulting dib as 24bit result. The gray fields vary all the time on each frame. You can see that the picture is intact behind these fields.

http://www.kentima.com/download_/peter16B07A2338CD3A62XeAHNx/Intel.zip

These are 2 megapixel picture and it looks a little different with smaller pictures. Then sometimes there is a full frame ok and these gray areas in between all the time.

Using Ipp dll:s and C++/CLI as platform.

Strange since Mpeg4 and H264 is handles the same way in our code, and that implies nothing too wrong there.

UMC::MJPEGVideoDecoder() class i used.

MediaData initialized like this:

UMC::MediaData frame;

frame.SetBufferPointer((Ipp8u*)pcPacket, dwPacketLen);

frame.SetDataSize(dwPacketLen);

//Tried setting frametyp NONE_PICTURE or VIDEO_FRAME, neither works

// frame.SetFrameType(UMC::FrameType::::NONE_PICTURE);// UMC::FrameType::NONE_PICTURE

// frame.SetFrameType(UMC::VIDEO_FRAME);// UMC::FrameType::NONE_PICTURE

frame.SetTime(-1, -1);

UMC::VideoDecoderParams VDecParams;

VDecParams.m_pData = &frame;

GetResolution(pcPacket, dwPacketLen, &VDecParams.info.clip_info.width, &VDecParams.info.clip_info.height);

VDecParams.info.color_format = UMC::RGB24;

VDecParams.info.bitrate = 0;

VDecParams.info.aspect_ratio_width = 1;

VDecParams.info.aspect_ratio_height = 1;

VDecParams.info.framerate = 0.0;

VDecParams.info.duration = 1;

VDecParams.info.interlace_type = UMC::PROGRESSIVE;

VDecParams.info.stream_type = UMC::MJPEG_VIDEO;

VDecParams.info.stream_subtype = UMC::UNDEF_VIDEO_SUBTYPE;

VDecParams.info.streamPID = 0;

VDecParams.lFlags = 0; //

VDecParams.numThreads = 1;

VDecParams.pPostProcessing = NULL;

if(UMC::UMC_OK == umcRes)

{

umcRes = m_pVideoDecoder->Init(&VDecParams);

}

if(UMC::UMC_OK == umcRes) {

umcRes = m_outData.Init(VDecParams.info.clip_info.width, VDecParams.info.clip_info.height, UMC::RGB24, DEFAULT_BITDEPTH);

umcRes = m_outData.SetPlanePointer(m_pBits, 0);

}

//Then decoded

m_inData.SetBufferPointer((Ipp8u*)pcPacket, dwPacketLen);

m_inData.SetDataSize(dwPacketLen);

m_inData.SetTime(-1, -1);

umcRes = m_pVideoDecoder->GetFrame(&m_inDat a, &m_outData);

I don't know what else might be needed?

Would be much obliged for any advice!!!

Best regards

Lars

0 Kudos
4 Replies
nipp
Beginner
649 Views

We've used the ijl15 for ever and thought since doing Mpeg4 and H264 decoding in ipp we could throw ijl15 out, and use ipp 5.3 for everything.

Is it possible to get some help on this?

If any info is missing I'll be glad to supply it.

Really in need here.

/Lars

0 Kudos
Vladimir_Dudnik
Employee
649 Views

Hello Lars,

seems your Motion JPEG input is not an AVI file?

In that case I would recommend you to integrate IPP JPEG decoder from JPEGView sample. The codec in UMC is oriented on UMC infrastructure so when you do not use that (AVI splitter, FileReader and so on) it is better to use simple code.

Regards,
Vladimir

0 Kudos
nipp
Beginner
649 Views

Many thanks for your suggestion, Vladimir.

Yes, we only use source from memory buffer and produce result as a dib i mem too. All drawing on screen fromown code.

Will have a closer look on the sample you mentioned.

Would the Mpeg4, H264 also gain from looking at other than UMC-based samples, maybe?

Thinking of performance aso.

Much obliged, thanks.

/Lars

0 Kudos
Vladimir_Dudnik
Employee
649 Views

OK, there are a little details onIPP JPEG decoder in IPP 5.3 provide simple API, so usage is simple. Basically youneed to doseveral steps:

1. Instantiate CJPEGDecoder object
2. Instantiate CMemBuffInput object and attach your input memory buffer with Open method
3. Attach CMemBuffInput object to CJPEGDecoder with SetSource method
4. Get compressed JPEG image parameters with ReadHeader method
5. Decide desired output image parameters (like sampling, color space, DCT downsampling), allocate output memory buffer depending on image size and specify all these parameters with SetDestination method
6. call ReadData method to do actual decoding JPEG data from input memory buffer to output memory buffer

Note, if your input JPEGcompressed with4:2:2 subsampling you may skip color convertion and upsampling steps and get output in YUY2 format directly, which is faster. To do that you need to specify output color JC_YCBCR and output sampling JS_422

Also note that IPP JPEG decoder is threaded with OpenMP API. The sample's build script does enable threading by default. If you port this into MSVC project you may swant to et 'enable OpenMP' option in project settings to utilize codec threading capabilities.

And finally, in IPP 6.0 beta we introduced newC++ API for image codecs, called as UIC (unified image codec), which simplify and unify access to different image formats. Currently BMP, PNM, JPEG, JPEG2000 and DICOM are supported. You can add support for your own format by developing derived classes.

Regards,
Vladimir

0 Kudos
Reply