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

Resizing I420 (aka IYUV) or YV12

ambrozija
Beginner
1,049 Views
Hello,
I'm trying to resize I420 image (described herehttp://www.fourcc.org/yuv.php#IYUV). By now I've tried most of the functions available in IPP API, but with no result.
I've tried ippiResizeYUV420_8u_P2R. The status is OK, but the image is scrambled, like the planes are all wrong.
I've also tried SuperSampling (as in this post: http://software.intel.com/en-us/forums/showthread.php?t=85494&p=1#180361), but, as it is mentioned in the post, I got a crash.
I've also tried ippiResizeSqrPixel_8u_C3R. And also, the status is OK, but the image is scrambled.
I've tried the ResizeSqr functions too, to no avail.
Is there any function in IPP API's that I can use for resizing I420 image? And how it should be used?
Thanks,
Goran.
[cpp]pp8u* pSrcY = (Ipp8u*)pSrc; int srcYStep = m_srcWidth; Ipp8u* pSrcUV = pSrc + (m_srcWidth * m_srcHeight); int srcUVStep = m_srcWidth/2; IppiSize srcROISize; srcROISize.width = m_srcWidth; srcROISize.height = m_srcHeight; Ipp8u* pDstY = (Ipp8u*)pDst; int dstYStep = m_dstWidth; Ipp8u* pDstUV = pDst + (m_dstWidth * m_dstHeight); int dstUVStep = m_dstWidth/2; IppiSize dstRoiSize; dstRoiSize.width = m_dstWidth; dstRoiSize.height = m_dstHeight; IppStatus status = ippiResizeYUV420_8u_P2R(pSrcY, srcYStep, pSrcUV, srcUVStep, srcROISize,pDstY, dstYStep, pDstUV, dstUVStep, dstRoiSize, IPPI_INTER_LANCZOS, (Ipp8u*)m_pWorkingBuffer);[/cpp]
[cpp]IppStatus status = ippiResizeSqrPixel_8u_C3R(pSrc, srcROISize, m_srcWidth, srcROI, pDst, m_dstWidth, dstROI, xFactor, yFactor, 0, 0, IPPI_INTER_LANCZOS, m_pWorkingBuffer);[/cpp]
0 Kudos
1 Solution
pvonkaenel
New Contributor III
1,049 Views

What I tend to do on planar images is use ippResizeSqrPixel_8u_C1R on each plane independently, but be sure to initialize with ippiResizeGetBufSize using difference src/dst sizes since, as was mentioned earlier, the luma plane is a different size than the chroma planes.

Something else I've noticed is that ippiResizeFilterInit_8u_C1R with ippResizeFilterLanczos does a better job than ippiResizeSqrPixel_8u_C1R with IPPI_INTER_LANCZOS. Can someone at Intel explain why these two are different?

Peter

View solution in original post

0 Kudos
3 Replies
Jeffrey_M_Intel1
Employee
1,049 Views

Part of the problem may be using a pixel-order function on planar data. Another thing to keep in mind is that the 3 planes aren't the same size. For I420 or YV12 the U and V planes are half the width and height of the Y plane. You may have better results resizing the 3 planes separately.

Best regards,

Jeff

0 Kudos
pvonkaenel
New Contributor III
1,050 Views

What I tend to do on planar images is use ippResizeSqrPixel_8u_C1R on each plane independently, but be sure to initialize with ippiResizeGetBufSize using difference src/dst sizes since, as was mentioned earlier, the luma plane is a different size than the chroma planes.

Something else I've noticed is that ippiResizeFilterInit_8u_C1R with ippResizeFilterLanczos does a better job than ippiResizeSqrPixel_8u_C1R with IPPI_INTER_LANCZOS. Can someone at Intel explain why these two are different?

Peter

0 Kudos
ambrozija
Beginner
1,049 Views
Thanks alot for your help.ippResizeSqrPixel_8u_C1R on each plane did the trick.
Goran.
0 Kudos
Reply