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

problem with x64 ippiCopy YV12 image ROI

David_S_13
Beginner
327 Views

I have an image that I am copying into another image using ROI. Format is YV12.  The code I am using is from the intel sample Image,cpp: BOOL Image::CopyDataP_ROI(void** ppData, int* step, IppiSize roiSize) { if (!(m_InitFlag & initAlloc)) return FALSE;
     if (!ppData) return FALSE;
     if (!m_plane) return FALSE;
     roiSize.width *= ItemSize();
     for (int c=0; c < Channels(); c++) {

          IppiSize size = roiSize;
          CorrectPlaneSize(size.width,size.height,c);
          ippiCopy_8u_C1R((Ipp8u*)ppData, step, (Ipp8u*)GetRoiPtrP(c), StepP(c), size);     
     }
     m_Updated = TRUE;
     return TRUE;
}

If I have a 640x480 image that I copy into a 640x480 ROI, it appears correct.
If I have a 320x240 image that I copy into a 640x480 image, the image appears as shown int he attached image.

The image appears stretched vertically and repeated four times.  
If I have a 640x480 source and resize it to 320x240 and place it within a 320x240 ROI in the destination 640x480 image,  it appears correctly.  It seems that everything works correctly if the source image resolution is the same as the destination resolution.  
The same exact code compiled for 32-bit does not have this issue at all.  Not sure why but could it have something to do with the x64 pointers to the planar data or perhaps the ptr math (common errors when converting to x64).
Has anyone else run into this issue or can perhaps point me int he right direction?  Thanks.

0 Kudos
3 Replies
Igor_A_Intel
Employee
327 Views

Hi,

I don't see anything attached. BTW - do you use correct srcStep and dstStep? Do they match source and destination?

regards, Igor

0 Kudos
David_S_13
Beginner
327 Views

Here is the image I tried to attach in the original post:

imgx

0 Kudos
Sergey_K_Intel
Employee
327 Views

Hi shadowwolfx,

It may happen, that this function erroneously changes CImage resolution data, like m_width. Check CImage.Step() before and after calling of CopyDataP_ROI.

This class might work good on interleaved (RGB) images, but I'm not sure if we use planar images, especially with different sampling like YV12. We haven't checked this sample for several years.

Use debugger to step into this function and to look what's happening with image attributes.

Regards,
Sergey

0 Kudos
Reply