- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, im using MFC and trying to do some simple JPEG decompression tests to see how fast it can be, i have a program that tests a few other ways(FreeImage, DevIL, etc.) and am trying to get this working with the IPP.
I load a JPEG in my program and decompress it 100 times and average out how long it takes.
Looking through some of the documentation, it seems very complicated to do what i need it to do, I saw the function DecodeHuffmanOne_JPEG and would like to use it but i do not know how..
There is an MFC sample application(ipp-samples\image-processing\image-processing-mfc) but it doesnt seem to use much of the ipp functions and only uses BMP's. I do have all the other samples so if theres somewhere i should look for an example that would be great, otherwise i need some help!
Thanks alot!
Steven Auger
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Steven,
In addition to IPP primitive kernels for JPEG and JPEG2000 compression we also provide complete JPEG and JPEG2000 codec implementation accompanied with sample applications to demonstrate how to call IPP image codecs. I would recommend you to take a look at image-codecsuic sample within IPP sample package.
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This looks promising, thanks! Is there a way to just throw a BYTE* and size into it and it spits me back a BYTE * with the IPP decoded JPEG? that would be really nice and easy but if not then ill figure out how to use this UIC Jpeg decompressor.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As of Right now i have a MFC Dialog based Application compiling with the UIC JPEGDecoder class. Here is the code for the function that gets called on a button press:
void CJpegTesterDlg::OnBnClickedButton5()
{
if(m_pData.IsEmpty())
return;
ULONGLONG start,end;
numImgs = 0;
totaldiff = 0;
while(numImgs < 100)
{
INT width, height;
UINT bpp = 0;
start = ::GetTickCount();
int i;
CStdFileInput fi;
JPEGDecoder jpegdec;
ExcStatus status;
if(!BaseStream::IsOk(fi.Open(m_filename)))
TRACE("BASEStream Failed BaseStream");
status = jpegdec.Init();
if(ExcStatusOk != status)
TRACE("JPEGDecoder Failed Init");
status = jpegdec.AttachStream(fi);
if(ExcStatusOk != status)
TRACE("JPEGDecoder Failed AttachStream");
ImageColorSpec colorSpec;
ImageSamplingGeometry geometry;
status = jpegdec.ReadHeader(colorSpec,geometry);
if(ExcStatusOk != status)
TRACE("JPEGDecoder Failed ReadHeader");
UIC::Image imageCn;
ImageDataOrder dataOrder;
JCOLOR color;
JSS sampling;
int nOfComponents = geometry.NOfComponents();
if(colorSpec.DataRange()->BitDepth() + 1 <= 8)
dataOrder.SetDataType(T8u);
else
dataOrder.SetDataType(T16u);
dataOrder.ReAlloc(Interleaved, nOfComponents);
dataOrder.PixelStep()[0] = nOfComponents;
dataOrder.LineStep() [0] = (((geometry.RefGridRect().Width() * nOfComponents)+ 31) & 0xFFFFFFE0);
geometry.SetEnumSampling(S444);
imageCn.Buffer().ReAlloc(dataOrder, geometry);
imageCn.ColorSpec().ReAlloc(nOfComponents);
imageCn.ColorSpec().SetColorSpecMethod(Enumerated);
imageCn.ColorSpec().SetComponentToColorMap(Direct);
for(i = 0; i < nOfComponents; i++)
{
if(colorSpec.DataRange()->BitDepth() + 1 <= 8)
imageCn.ColorSpec().DataRange().SetAsRange8u(255);
else
imageCn.ColorSpec().DataRange().SetAsRange16u(1 <<
colorSpec.DataRange()->BitDepth());
}
imageCn.ColorSpec().SetEnumColorSpace(RGB);
status = jpegdec.SetParams(imageCn.ColorSpec(),imageCn.Buffer().BufferFormat().SamplingGeometry());
if(ExcStatusOk != status)
TRACE("JPEGDecoder Failed SetParams");
status = jpegdec.ReadData(imageCn.Buffer().DataPtr(),dataOrder);
if(ExcStatusOk != status)
TRACE("JPEGDecoder Failed ReadData");
//m_console.SetImageBytes((BYTE*)(imageCn.Buffer().DataPtr()),
// imageCn.Buffer().BufferFormat().SamplingGeometry().RefGridRect().Width(),
// imageCn.Buffer().BufferFormat().SamplingGeometry().RefGridRect().Height(),
// imageCn.Buffer().BufferFormat().SamplingGeometry().NOfComponents());
//m_console.Refresh();
end = ::GetTickCount();
totaldiff += (end - start);
numImgs++;
}
CString text;
text.Format("avgtime to do 100: %d ms",(totaldiff/numImgs));
m_editTxt.SetWindowText(text);
}
This runs through fine untill the end of the while loop when i run into an exception:
HEAP[JpegTester.exe]: Invalid Address specified to RtlFreeHeap( 008F0000, 01BE9E70 )
Unhandled exception at 0x7c90120e in JpegTester.exe: User breakpoint.
I got this sample from the UIC Documentation (ipp-samplesimage-codecsuicsrcdocuic_manual.pdf)
Also i tried using the old IJL 2.0 and got it working great! but that is now obsolete so i need to get this UIC code working, Is there any function calls that i'm missing? maybe something that the manual is missing? it seems to always break at the end of the loop or end of the function(when i take it out of the loop)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
the piece of code in documentation might be a bit not accurate although it gives you the main idea of how to call UIC codec. I would recommend you to take a look at working code sample uic_transcoder_con. It is available in IPP sample package, image-codecsuic folder.
Regards,
Vladimir
the piece of code in documentation might be a bit not accurate although it gives you the main idea of how to call UIC codec. I would recommend you to take a look at working code sample uic_transcoder_con. It is available in IPP sample package, image-codecsuic folder.
Regards,
Vladimir

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page