- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using following code todecode a jpegimage. At the end of the function call, the image is decoded successfully. However, when execution returns from the function, I get an error saying that heap is corrupted. I am using Visual C++ 2008. I tried to isolate the problem and found that heap corruptionoccurs when ImageDataOrder's destructor is called (as in dataOrder.~ImageDataOrder()). I guess, this would happen at the end of the function call.
void Decode(unsigned char* data, int len)
{
int err;
CMemBuffInput streamIn;
ExcStatus status;
JPEGDecoder _dec;
if(ExcStatusOk != _dec.Init())
throw "";
if(JPEG_OK != streamIn.Open(data, len))
throw "";
if (_dec.AttachStream(streamIn) != ExcStatusOk)
throw "";
ImageColorSpec colorSpec;
ImageSamplingGeometry geometry;
if(ExcStatusOk != _dec.ReadHeader(colorSpec,geometry))
throw "";
ImageDataOrder dataOrder;
int numOfComponents = geometry.NOfComponents();
if(colorSpec.DataRange()->BitDepth() + 1 <= 8)
dataOrder.SetDataType(T8u);
else
dataOrder.SetDataType(T16u);
dataOrder.ReAlloc(Interleaved, numOfComponents);
dataOrder.PixelStep()[0] = numOfComponents;
dataOrder.LineStep() [0] = AlignStep(
geometry.RefGridRect().Width() * numOfComponents);
geometry.SetEnumSampling(S444);
Image imageCn;
imageCn.Buffer().ReAlloc(dataOrder, geometry);
imageCn.ColorSpec().ReAlloc(numOfComponents);
imageCn.ColorSpec().SetColorSpecMethod(Enumerated);
imageCn.ColorSpec().SetComponentToColorMap(Direct);
int i;
for(i = 0; i < numOfComponents; 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 = _dec.SetParams(imageCn.ColorSpec(),
imageCn.Buffer().BufferFormat().SamplingGeometry());
if(ExcStatusOk != status)
throw "";
status = _dec.SetParams(imageCn.ColorSpec(),imageCn.Buffer().BufferFormat().SamplingGeometry());
if(ExcStatusOk != status)throw "";
status = _dec.ReadData(imageCn.Buffer().DataPtr(),dataOrder);
if(ExcStatusOk != status)throw "";
// use the decoded image
}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a problem with my question or nobody knows the answer? :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
The uic_transcoder_con causes the exact same problem. In this case, the error pops up when ittries to return from the method ReadImageJPEG in jpeg.cpp.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please attach the image which cause the issue? We just test on arbitrary JPEG file with the latest IPP 6.0 update 1 and were not able to reproduce the issue.
Regards,
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please attach the image which cause the issue? We just test on arbitrary JPEG file with the latest IPP 6.0 update 1 and were not able to reproduce the issue.
Regards,
Vladimir
I am also running IPP 6.0 update 1. Are you running the debug or release? It does not seem to happen in the release mode (I guess no heap checks for release versions). I need to find a way to send you the jpeg data as it is a byte array I get from a camera. I ma prety sure it is a valid jpeg image as I amable to decode it using the .NET Bitmapclass.
If I run my MFC program in debug mode, I am able to reproduce the problem by just running following function:
void IntelJpegCodec::Test()
{
ImageDataOrder dataOrder;
dataOrder.ReAlloc(Interleaved, 1);
dataOrder.~ImageDataOrder();
}
3rd line causes the error I mentioned originally. The function _CrtCheckMemory returns TRUE after 2nd line, meaning that before the 3rd line heap is OK. I guess that means that something is done inside the destructor to cause the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
It is w_ipp-samples_p_6.0.0.127
The IPP folder is C:Program FilesIntelIPP6.0.1.070ia32
Do I have wrong samples? I could not find any other version on your site.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could someone please let me know if there is a problem with files I have?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
No news yet?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We were not able to reproduce the issue. Could you please attach complete MSVC project, we may need to check project settings, may be there is some mismatch between CRT variants
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We were not able to reproduce the issue. Could you please attach complete MSVC project, we may need to check project settings, may be there is some mismatch between CRT variants
Vladimir
The attached VS 2008 project causes the problem if compiled in debug mode. Just run it in debug mode and press Test button on the form. The zip file is called IppTest.zip. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
Is this problem solved ? I have exactly same problem in 64 bits system in release mode.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Regards,
Vladimir
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page