- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Resizing of the YV12 (planar) data using ippiSuperSampling_8u_P3R crashes, with invalid access in reading memory location. Below is the code and the details of the buffer and parameters
Input buffer size(pInputImage) is 518400, srcwidth = 720, srcheight = 480, dstwidth = 400, dstheight = 300. It crashes trying to access memory outside the boundary for eg:
address of pI420SrcData[0] = 0x04020000
address of pI420SrcData[1] = 0x04074600
address of pI420SrcData[2] = 0x04089780
It crashes trying to access 0x0409f170 which according to me is exceeds the boundary of V planar buffer. Please let me know what could be wrong here.
I am using Intel IPP v6.1.2.041
[bash]Ipp8u* ScalingYUV420Data(Ipp8u* pInputImage,unsigned int srcwidth,unsigned int srcheight,unsigned int dstwidth,unsigned int dstheight) { Ipp8u* pI420SrcData[3]; Ipp8u* pI420DestData[3]; IppiRect srcrect; IppiRect destrect; IppiSize srcsize; IppiSize destsize; pI420SrcData[0] = pInputImage; pI420SrcData[1] = pI420SrcData[0] + (srcwidth * srcheight); pI420SrcData[2] = pI420SrcData[1] + (srcwidth * srcheight) / 4 ; // Calculate the resolution srcsize.width = srcwidth; srcsize.height = srcheight; destsize.width = dstwidth; destsize.height = dstheight; int srcstep = srcwidth; int dststep = dstwidth; // Calculate the pointers for destination pI420DestData[0] = m_pScaledDestData; pI420DestData[1] = pI420DestData[0] + (dstwidth * dstheight); pI420DestData[2] = pI420DestData[1] + (dstwidth * dstheight) / 4; int bufsize = 0; if(ippiSuperSamplingGetBufSize( srcsize, destsize, 3, &bufsize ) != ippStsNoErr) { return NULL; } if(bufsize <= 0) { return NULL; } Ipp8u* buf = ippsMalloc_8u( bufsize ); ippiSuperSampling_8u_P3R(pI420SrcData, srcstep, srcsize, pI420DestData, dststep, destsize, buf); if( buf != NULL ) ippsFree( buf ); return m_pScaledDestData; } [/bash]
Link Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without looking the documentation I am not sure if scaling to arbitrary size is supported. If it is, then if you don't have a particular reason for sticking to 6.1 you might try to see if it works in newer version (7.0.4).
Finally, what are the destination addresses? Are you sure you are crashing on read and not on write access?
Finally, what are the destination addresses? Are you sure you are crashing on read and not on write access?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I will try with the newer version.
Crash happend when accessing the memory and pointer address is very near to the source buffer.
I tried using ResizeSqrPixel_8u_P3R function and that also crashed.
Crash happend when accessing the memory and pointer address is very near to the source buffer.
I tried using ResizeSqrPixel_8u_P3R function and that also crashed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Now, I have not perused your code in detail, but just from your description it seems that what you are trying to achieve is not possible with the given function(s), i.e. both 'ippiSuperSampling_8u_P3R' and 'ResizeSqrPixel_8u_P3R'. In either case, all three planes are presumed to be of identical size and even having the same stride (which in my opinion is an unecessary restriction - why can't the strides be different? I doubt that it would have any negative performance impact). In other words, the data that can be resized by those functions are non-subsampled data, i.e. it must be 4:4:4 and thus not 4:2:0. So in this case, the error is simply that the function assumes 4:4:4 and same size for all three planes and then it will access outside your two color difference signal buffers (Cb and Cr ~ U and V).
For resizing 4:2:0, you will instead have to handle the three planes individually, resizing the Y-plane by itself with its resolution parameters, and resizing the Cb and Cr planes with their resolution parameters, both via the '_P1R' variants of either function.
- Jay
For resizing 4:2:0, you will instead have to handle the three planes individually, resizing the Y-plane by itself with its resolution parameters, and resizing the Cb and Cr planes with their resolution parameters, both via the '_P1R' variants of either function.
- Jay
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does anyone have any follow up on this question?
I have a simmilar format I420, (which should be the same as YV12, but with different order of U and V planes) to scale, and I also have tried ippiSuperSampling and ippiResizeSqrPixel.
I'm guessing thatippiResizeYUV420_8u_P2R isn't what I'm looking for either, right?
I've tried all of this functions and I get scaled but I have scrambled picture in the output.
Jay, what you say makes sense, but I couldn't find any _P1R functions? Only C1R?
Goran.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The _C1R variant is the one to use. There is no difference between handling a single plane in a planar format and a combined format consisting of only a single "color"; hence all _C1R functions can be thought of as _P1R's. Sorry for not being more precise about this fact. The same applies to I420 as for YV12. Just ensure to use the correct stride for all planes including with special attention to the two (subsampled) color planes in relation to the memory layout for I420/YV12.
- Jay
- Jay
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